From dccf28b7c344822b7459635099ebe3abdf5fd107 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 17 Apr 2020 17:19:24 +0200 Subject: Remove deprecated members from several QtGui classes Those can be trivially removed as they have direct replacements, or are completely unused. The migration path for QCursor::bitmap and QCursor::mask is QBitmap *pb = c.bitmap(); // up to 5.15, warns in 5.15 QBitmap vb = c.bitmap(Qt::ReturnByValue); // from 5.15, works in 6 QBitmap b = c.bitmap(); // from 6.0 on Change-Id: I3b3acd1c7f09c4c8414e98b3ce11986f1ecd5eda Reviewed-by: Shawn Rutledge --- src/gui/kernel/qcursor.cpp | 81 ++++++++++--------------------------------- src/gui/kernel/qcursor.h | 19 ++++------ src/gui/kernel/qdrag.cpp | 30 ---------------- src/gui/kernel/qdrag.h | 4 --- src/gui/kernel/qkeysequence.h | 4 --- src/gui/kernel/qpalette.cpp | 18 ---------- src/gui/kernel/qpalette.h | 3 -- 7 files changed, 26 insertions(+), 133 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 1efa28a5af..7ebf59290c 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -565,63 +565,25 @@ 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. + \fn QBitmap QCursor::bitmap(Qt::ReturnByValueConstant) const + \since 5.15 + \obsolete Use the overload without argument instead. - Returns the cursor bitmap, or \nullptr if it is one of the + Returns the cursor bitmap, or a null bitmap if it is one of the standard cursors. -*/ -const QBitmap *QCursor::bitmap() const -{ - if (!QCursorData::initialized) - QCursorData::initialize(); - return d->bm; -} -/*! - \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. + Previously, Qt provided a version of \c bitmap() which returned the bitmap + by-pointer. That version is now removed. To maintain compatibility + with old code, this function was provided to differentiate between the by-pointer + function and the by-value function. */ -const QBitmap *QCursor::mask() const -{ - if (!QCursorData::initialized) - 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::ReturnByValueConstant) const +QBitmap QCursor::bitmap() const { if (!QCursorData::initialized) QCursorData::initialize(); @@ -631,29 +593,24 @@ QBitmap QCursor::bitmap(Qt::ReturnByValueConstant) const } /*! + \fn QBitmap QCursor::mask(Qt::ReturnByValueConstant) const \since 5.15 + \obsolete Use the overload without argument instead. 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: + by-pointer. That version is now removed. To maintain compatibility + with old code, this function was provided to differentiate between the by-pointer + function and the by-value function. +*/ - \code - QBitmap bmpVal = cursor->mask(); - \endcode +/*! + Returns the cursor bitmap mask, or a null bitmap if it is one of the + standard cursors. */ -QBitmap QCursor::mask(Qt::ReturnByValueConstant) const +QBitmap QCursor::mask() const { if (!QCursorData::initialized) QCursorData::initialize(); diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 3ae6b98ced..d3b4140ec7 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -97,19 +98,13 @@ public: Qt::CursorShape shape() const; void setShape(Qt::CursorShape newShape); -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") - const QBitmap *bitmap() const; // ### Qt 7: Remove function +#if QT_DEPRECATED_SINCE(6, 6) + QBitmap bitmap(Qt::ReturnByValueConstant) const { return bitmap(); } + QBitmap mask(Qt::ReturnByValueConstant) const { return mask(); } +#endif // QT_DEPRECATED_SINCE(6, 6) + QBitmap bitmap() const; + QBitmap mask() const; - QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") - const QBitmap *mask() const; // ### Qt 7: Remove function - - QBitmap bitmap(Qt::ReturnByValueConstant) const; - QBitmap mask(Qt::ReturnByValueConstant) const; -#else - QBitmap bitmap(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg - QBitmap mask(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg -#endif // QT_DEPRECATED_SINCE(5, 15) QPixmap pixmap() const; QPoint hotSpot() const; diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index 3712eace15..d6dfc6387c 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -287,36 +287,6 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa return d->executed_action; } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - - \b{Note:} It is recommended to use exec() instead of this function. - - Starts the drag and drop operation and returns a value indicating the requested - drop action when it is completed. The drop actions that the user can choose - from are specified in \a request. Qt::CopyAction is always allowed. - - \b{Note:} Although the drag and drop operation can take some time, this function - does not block the event loop. Other events are still delivered to the application - while the operation is performed. - - \sa exec() -*/ -Qt::DropAction QDrag::start(Qt::DropActions request) -{ - Q_D(QDrag); - if (!d->data) { - qWarning("QDrag: No mimedata set before starting the drag"); - return d->executed_action; - } - d->supported_actions = request | Qt::CopyAction; - d->default_action = Qt::IgnoreAction; - d->executed_action = QDragManager::self()->drag(this); - return d->executed_action; -} -#endif - /*! Sets the drag \a cursor for the \a action. This allows you to override the default native cursors. To revert to using the diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h index 7acd5088bd..eaa677b50d 100644 --- a/src/gui/kernel/qdrag.h +++ b/src/gui/kernel/qdrag.h @@ -74,10 +74,6 @@ public: QObject *source() const; QObject *target() const; -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QDrag::exec() instead") - Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction); -#endif Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction); Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction); diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index 67c79519e6..8b7ff12bed 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -178,10 +178,6 @@ public: static QKeySequence mnemonic(const QString &text); static QList keyBindings(StandardKey key); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED operator QString() const { return toString(QKeySequence::NativeText); } - QT_DEPRECATED operator int() const { if (1 <= count()) return operator [](0); return 0; } -#endif operator QVariant() const; int operator[](uint i) const; QKeySequence &operator=(const QKeySequence &other); diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index f6180be8a8..92c43688cc 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -919,24 +919,6 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) return true; } -/*! \fn int QPalette::serialNumber() const - \obsolete - - Returns a number that identifies the contents of this QPalette - object. Distinct QPalette objects can only have the same serial - number if they refer to the same contents (but they don't have - to). Also, the serial number of a QPalette may change during the - lifetime of the object. - - Use cacheKey() instead. - - \warning The serial number doesn't necessarily change when the - palette is altered. This means that it may be dangerous to use it - as a cache key. - - \sa operator==() -*/ - /*! Returns a number that identifies the contents of this QPalette object. Distinct QPalette objects can have the same key if diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index fd0ef2e2d9..1f0f6725d8 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -152,9 +152,6 @@ public: inline bool operator!=(const QPalette &p) const { return !(operator==(p)); } bool isCopyOf(const QPalette &p) const; -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } -#endif qint64 cacheKey() const; QPalette resolve(const QPalette &other) const; -- cgit v1.2.3