diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2022-03-04 12:28:49 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2022-03-08 15:44:17 +0100 |
commit | 034d8898f8166423db085da529787e56204c8e15 (patch) | |
tree | f58e930c7880d1cd79cd39745ed366d27dcd9e55 /src/gui/painting/qpainter.cpp | |
parent | 87725ee75981ec9ab25456c41acc74681c85ae2e (diff) | |
download | qtbase-034d8898f8166423db085da529787e56204c8e15.tar.gz |
Fix deprecated uses of QScopedPointer
By changing it to unique_ptr.
Pick-to: 6.2 6.3
Change-Id: I91abb69445b537d4c95983ae735341882352b29d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index f1b02f3e9b..704b841b15 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ // QtCore +#include <memory> #include <qdebug.h> #include <qmath.h> #include <qmutex.h> @@ -77,6 +78,9 @@ QT_BEGIN_NAMESPACE +// We changed the type from QScopedPointer to unique_ptr, make sure it's binary compatible: +static_assert(sizeof(QScopedPointer<QPainterPrivate>) == sizeof(std::unique_ptr<QPainterPrivate>)); + #define QGradient_StretchToDevice 0x10000000 #define QPaintEngine_OpaqueBackground 0x40000000 @@ -276,9 +280,9 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) // the current d_ptr to the shared painter's d_ptr. sp->save(); ++sp->d_ptr->refcount; - sp->d_ptr->d_ptrs.push_back(q->d_ptr.data()); - q->d_ptr.take(); - q->d_ptr.reset(sp->d_ptr.data()); + sp->d_ptr->d_ptrs.push_back(q->d_ptr.get()); + Q_UNUSED(q->d_ptr.release()); + q->d_ptr.reset(sp->d_ptr.get()); Q_ASSERT(q->d_ptr->state); @@ -333,7 +337,7 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q) } q->restore(); - q->d_ptr.take(); + Q_UNUSED(q->d_ptr.release()); q->d_ptr.reset(original); if (emulationEngine) { |