diff options
Diffstat (limited to 'src/widgets/widgets/qlabel.cpp')
-rw-r--r-- | src/widgets/widgets/qlabel.cpp | 97 |
1 files changed, 27 insertions, 70 deletions
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index a0b5bdd39f..f373ecfab4 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -186,54 +186,30 @@ QLabelPrivate::~QLabelPrivate() {fowler}{GUI Design Handbook: Label} */ -#ifndef QT_NO_PICTURE -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \deprecated - - New code should use the other overload which returns QPicture by-value. - - This function returns the label's picture or \c nullptr if the label doesn't have a - picture. -*/ - -const QPicture *QLabel::picture() const -{ - Q_D(const QLabel); - return d->picture; -} -#endif // QT_DEPRECATED_SINCE(5, 15) - /*! + \fn QPicture QLabel::picture(Qt::ReturnByValueConstant) const + \obsolete Use the overload without argument instead. \since 5.15 + Returns the label's picture. Previously, Qt provided a version of \c picture() which returned the picture - 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 QPicture *picPtr = label->picture(); - QPicture picVal = label->picture(Qt::ReturnByValue); - \endcode + by-pointer. That version is now removed. This overload allowed to + explicitly differentiate between the by-pointer function and the by-value. +*/ - If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE - macro, then you can omit \c Qt::ReturnByValue as shown below: +/*! + \since 6.0 - \code - QPicture picVal = label->picture(); - \endcode + Returns the label's picture. */ - -QPicture QLabel::picture(Qt::ReturnByValueConstant) const +QPicture QLabel::picture() const { Q_D(const QLabel); if (d->picture) return *(d->picture); return QPicture(); } -#endif /*! @@ -389,26 +365,6 @@ void QLabel::clear() \property QLabel::pixmap \brief the label's pixmap. - Previously, Qt provided a version of \c pixmap() which returned the pixmap - 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 QPixmap *pixmapPtr = label->pixmap(); - QPixmap pixmapVal = label->pixmap(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 - QPixmap pixmapVal = label->pixmap(); - \endcode - - If no pixmap has been set, the deprecated getter function will return - \c nullptr. - Setting the pixmap clears any previous content. The buddy shortcut, if any, is disabled. */ @@ -426,29 +382,30 @@ void QLabel::setPixmap(const QPixmap &pixmap) d->updateLabel(); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \deprecated - - New code should use the other overload which returns QPixmap by-value. -*/ -const QPixmap *QLabel::pixmap() const +QPixmap QLabel::pixmap() const { Q_D(const QLabel); - return d->pixmap; + if (d->pixmap) + return *(d->pixmap); + return QPixmap(); } -#endif // QT_DEPRECATED_SINCE(5, 15) /*! + \fn QPixmap QLabel::pixmap(Qt::ReturnByValueConstant) const + + \obsolete Use the overload without argument instead. \since 5.15 + + Returns the label's pixmap. + + Previously, Qt provided a version of \c pixmap() which returned the pixmap + by-pointer. That version has now been removed. This overload allowed to + explicitly differentiate between the by-pointer function and the by-value. + + \code + QPixmap pixmapVal = label->pixmap(Qt::ReturnByValue); + \endcode */ -QPixmap QLabel::pixmap(Qt::ReturnByValueConstant) const -{ - Q_D(const QLabel); - if (d->pixmap) - return *(d->pixmap); - return QPixmap(); -} #ifndef QT_NO_PICTURE /*! |