From 114ff44f3c42e2575c60e6b5c8459acfea2dc60d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 2 Sep 2019 07:32:49 +0800 Subject: QLabel: Allow pixmap() and picture() to return by-value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous versions of these functions that returned by-pointer are held over from Qt 1 times. They are inconsistent with the rest of the Qt API. [ChangeLog][QtWidgets][QLabel] QLabel::pixmap() and QLabel::picture() can now return by-value instead of by-pointer. Task-number: QTBUG-48701 Change-Id: I23ce319a7b1f757e1f4dec697551bb472e92fabf Reviewed-by: André Hartmann --- src/widgets/accessible/simplewidgets.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/widgets/accessible/simplewidgets.cpp') diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 9dbbe9c608..107fd729fe 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -76,6 +76,9 @@ #include #include #endif +#ifndef QT_NO_PICTURE +#include +#endif #include #include #include @@ -431,10 +434,10 @@ QAccessible::Role QAccessibleDisplay::role() const #if QT_CONFIG(label) QLabel *l = qobject_cast(object()); if (l) { - if (l->pixmap()) + if (!l->pixmap(Qt::ReturnByValue).isNull()) return QAccessible::Graphic; #ifndef QT_NO_PICTURE - if (l->picture()) + if (!l->picture(Qt::ReturnByValue).isNull()) return QAccessible::Graphic; #endif #if QT_CONFIG(movie) @@ -558,10 +561,7 @@ QSize QAccessibleDisplay::imageSize() const #endif return QSize(); #if QT_CONFIG(label) - const QPixmap *pixmap = label->pixmap(); - if (!pixmap) - return QSize(); - return pixmap->size(); + return label->pixmap(Qt::ReturnByValue).size(); #endif } @@ -574,8 +574,7 @@ QPoint QAccessibleDisplay::imagePosition() const #endif return QPoint(); #if QT_CONFIG(label) - const QPixmap *pixmap = label->pixmap(); - if (!pixmap) + if (label->pixmap(Qt::ReturnByValue).isNull()) return QPoint(); return QPoint(label->mapToGlobal(label->pos())); -- cgit v1.2.1