summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qmessagebox.cpp
diff options
context:
space:
mode:
authorSze Howe Koh <szehowe.koh@gmail.com>2019-09-02 07:32:49 +0800
committerSze Howe Koh <szehowe.koh@gmail.com>2020-01-26 01:19:38 +0800
commit114ff44f3c42e2575c60e6b5c8459acfea2dc60d (patch)
treed4c3b28279a49f079e8886c0aec0c4a2f6088543 /src/widgets/dialogs/qmessagebox.cpp
parente9a797799ee7e81d1cd113ba56f62705ae150e5c (diff)
QLabel: Allow pixmap() and picture() to return by-value
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 <aha_1980@gmx.de>
Diffstat (limited to 'src/widgets/dialogs/qmessagebox.cpp')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 854fee6e33..4e7a4a65e3 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -305,7 +305,7 @@ void QMessageBoxPrivate::setupLayout()
Q_Q(QMessageBox);
delete q->layout();
QGridLayout *grid = new QGridLayout;
- bool hasIcon = iconLabel->pixmap() && !iconLabel->pixmap()->isNull();
+ bool hasIcon = !iconLabel->pixmap(Qt::ReturnByValue).isNull();
if (hasIcon)
grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
@@ -1323,9 +1323,7 @@ void QMessageBox::setIcon(Icon icon)
QPixmap QMessageBox::iconPixmap() const
{
Q_D(const QMessageBox);
- if (d->iconLabel && d->iconLabel->pixmap())
- return *d->iconLabel->pixmap();
- return QPixmap();
+ return d->iconLabel->pixmap(Qt::ReturnByValue);
}
void QMessageBox::setIconPixmap(const QPixmap &pixmap)