summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcursor.cpp
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-01-29 16:57:12 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-01-29 16:57:27 +0100
commita1dbdcbd6e818118f5fc28cdd39e47a02380adbd (patch)
tree0d813d9d72baeb1b5f7be048e775896c73f134f5 /src/gui/kernel/qcursor.cpp
parent67ea445f09db9feea4e863faa12c45fb007f53a4 (diff)
parent4cbadf699838406d14366ce61deec03cf45113f7 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: src/corelib/Qt5CoreConfigExtras.cmake.in src/corelib/Qt5CoreMacros.cmake src/dbus/Qt5DBusConfigExtras.cmake.in src/widgets/Qt5WidgetsConfigExtras.cmake.in Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
Diffstat (limited to 'src/gui/kernel/qcursor.cpp')
-rw-r--r--src/gui/kernel/qcursor.cpp78
1 files changed, 76 insertions, 2 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index f5a794b642..7f6fdafbd0 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -325,7 +325,7 @@ QDataStream &operator<<(QDataStream &s, const QCursor &c)
if (isPixmap)
s << c.pixmap();
else
- s << *c.bitmap() << *c.mask();
+ s << c.bitmap(Qt::ReturnByValue) << c.mask(Qt::ReturnByValue);
s << c.hotSpot();
}
return s;
@@ -565,7 +565,12 @@ void QCursor::setShape(Qt::CursorShape shape)
}
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
+ \deprecated
+
+ New code should use the other overload which returns QBitmap by-value.
+
Returns the cursor bitmap, or \nullptr if it is one of the
standard cursors.
*/
@@ -577,6 +582,10 @@ const QBitmap *QCursor::bitmap() const
}
/*!
+ \deprecated
+
+ New code should use the other overload which returns QBitmap by-value.
+
Returns the cursor bitmap mask, or \nullptr if it is one of the
standard cursors.
*/
@@ -587,6 +596,71 @@ const QBitmap *QCursor::mask() const
QCursorData::initialize();
return d->bmm;
}
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
+/*!
+ \since 5.15
+
+ Returns the cursor bitmap, or a null bitmap if it is one of the
+ standard cursors.
+
+ Previously, Qt provided a version of \c bitmap() which returned the bitmap
+ by-pointer. That version is now deprecated. To maintain compatibility
+ with old code, you can explicitly differentiate between the by-pointer
+ function and the by-value function:
+
+ \code
+ const QBitmap *bmpPtr = cursor->bitmap();
+ QBitmap bmpVal = cursor->bitmap(Qt::ReturnByValue);
+ \endcode
+
+ If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE
+ macro, then you can omit \c Qt::ReturnByValue as shown below:
+
+ \code
+ QBitmap bmpVal = cursor->bitmap();
+ \endcode
+*/
+QBitmap QCursor::bitmap(Qt::ReturnByValue_t) const
+{
+ if (!QCursorData::initialized)
+ QCursorData::initialize();
+ if (d->bm)
+ return *(d->bm);
+ return QBitmap();
+}
+
+/*!
+ \since 5.15
+
+ Returns the cursor bitmap mask, or a null bitmap if it is one of the
+ standard cursors.
+
+ Previously, Qt provided a version of \c mask() which returned the bitmap
+ by-pointer. That version is now deprecated. To maintain compatibility
+ with old code, you can explicitly differentiate between the by-pointer
+ function and the by-value function:
+
+ \code
+ const QBitmap *bmpPtr = cursor->mask();
+ QBitmap bmpVal = cursor->mask(Qt::ReturnByValue);
+ \endcode
+
+ If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE
+ macro, then you can omit \c Qt::ReturnByValue as shown below:
+
+ \code
+ QBitmap bmpVal = cursor->mask();
+ \endcode
+*/
+QBitmap QCursor::mask(Qt::ReturnByValue_t) const
+{
+ if (!QCursorData::initialized)
+ QCursorData::initialize();
+ if (d->bmm)
+ return *(d->bmm);
+ return QBitmap();
+}
/*!
Returns the cursor pixmap. This is only valid if the cursor is a
@@ -657,7 +731,7 @@ QCursor &QCursor::operator=(const QCursor &c)
*/
QCursor::operator QVariant() const
{
- return QVariant(QVariant::Cursor, this);
+ return QVariant(QMetaType::QCursor, this);
}
#ifndef QT_NO_DEBUG_STREAM