diff options
author | Yuhang Zhao <[email protected]> | 2023-02-20 17:06:46 +0800 |
---|---|---|
committer | Yuhang Zhao <[email protected]> | 2023-02-22 22:27:35 +0800 |
commit | f7fd5eaf95c964956b2b353784105c89950ffff2 (patch) | |
tree | 999559256f061a87dc4e3d0957f21d11cd0a15d8 | |
parent | b4b4c8140112e3e327ca7bfc1263b948001b93f8 (diff) |
Fix qtbase build when all deprecated code are disabled
Adjust the callers to use the non-deprecated APIs.
Pick-to: 6.5
Change-Id: I8e96f25684a2d613bc400a8626dc9e3af2bb8dcf
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r-- | examples/widgets/desktop/screenshot/screenshot.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/doc/src/imageviewer.qdoc | 4 | ||||
-rw-r--r-- | examples/widgets/draganddrop/draggableicons/dragwidget.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/widgets/imageviewer/imageviewer.cpp | 6 | ||||
-rw-r--r-- | src/widgets/accessible/simplewidgets.cpp | 8 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/examples/widgets/desktop/screenshot/screenshot.cpp b/examples/widgets/desktop/screenshot/screenshot.cpp index 271ef8c7766..5a4ba901b7d 100644 --- a/examples/widgets/desktop/screenshot/screenshot.cpp +++ b/examples/widgets/desktop/screenshot/screenshot.cpp @@ -62,7 +62,7 @@ void Screenshot::resizeEvent(QResizeEvent * /* event */) { QSize scaledSize = originalPixmap.size(); scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio); - if (scaledSize != screenshotLabel->pixmap(Qt::ReturnByValue).size()) + if (scaledSize != screenshotLabel->pixmap().size()) updateScreenshotLabel(); } //! [1] diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc index 17b969d4c82..aa6eec46d8a 100644 --- a/examples/widgets/doc/src/imageviewer.qdoc +++ b/examples/widgets/doc/src/imageviewer.qdoc @@ -151,8 +151,8 @@ will expand to \code - if (imageLabel->pixmap(Qt::ReturnByValue).isNull()) - qFatal("ASSERT: "imageLabel->pixmap(Qt::ReturnByValue).isNull()" in file ..."); + if (imageLabel->pixmap().isNull()) + qFatal("ASSERT: "imageLabel->pixmap().isNull()" in file ..."); \endcode In release mode, the macro simply disappear. The mode can be set diff --git a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp index 135574d058f..ba06c836d4d 100644 --- a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp +++ b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp @@ -95,7 +95,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event) if (!child) return; - QPixmap pixmap = child->pixmap(Qt::ReturnByValue); + QPixmap pixmap = child->pixmap(); QByteArray itemData; QDataStream dataStream(&itemData, QIODevice::WriteOnly); diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp index 619e0c12009..a883e7c58af 100644 --- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp +++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp @@ -161,7 +161,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event) //! [16] QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); - drag->setPixmap(child->pixmap(Qt::ReturnByValue)); + drag->setPixmap(child->pixmap()); drag->setHotSpot(hotSpot); child->hide(); diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp index d2bffc01d50..fd8fbaf2b83 100644 --- a/examples/widgets/widgets/imageviewer/imageviewer.cpp +++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp @@ -158,14 +158,14 @@ void ImageViewer::saveAs() void ImageViewer::print() //! [5] //! [6] { - Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull()); + Q_ASSERT(!imageLabel->pixmap().isNull()); #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) //! [6] //! [7] QPrintDialog dialog(&printer, this); //! [7] //! [8] if (dialog.exec()) { QPainter painter(&printer); - QPixmap pixmap = imageLabel->pixmap(Qt::ReturnByValue); + QPixmap pixmap = imageLabel->pixmap(); QRect rect = painter.viewport(); QSize size = pixmap.size(); size.scale(rect.size(), Qt::KeepAspectRatio); @@ -343,7 +343,7 @@ void ImageViewer::scaleImage(double factor) //! [23] //! [24] { scaleFactor *= factor; - imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size()); + imageLabel->resize(scaleFactor * imageLabel->pixmap().size()); adjustScrollBar(scrollArea->horizontalScrollBar(), factor); adjustScrollBar(scrollArea->verticalScrollBar(), factor); diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index d0e42fde85a..da4566bfff6 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -403,10 +403,10 @@ QAccessible::Role QAccessibleDisplay::role() const #if QT_CONFIG(label) QLabel *l = qobject_cast<QLabel*>(object()); if (l) { - if (!l->pixmap(Qt::ReturnByValue).isNull()) + if (!l->pixmap().isNull()) return QAccessible::Graphic; #ifndef QT_NO_PICTURE - if (!l->picture(Qt::ReturnByValue).isNull()) + if (!l->picture().isNull()) return QAccessible::Graphic; #endif #if QT_CONFIG(movie) @@ -531,7 +531,7 @@ QSize QAccessibleDisplay::imageSize() const #endif return QSize(); #if QT_CONFIG(label) - return label->pixmap(Qt::ReturnByValue).size(); + return label->pixmap().size(); #endif } @@ -544,7 +544,7 @@ QPoint QAccessibleDisplay::imagePosition() const #endif return QPoint(); #if QT_CONFIG(label) - if (label->pixmap(Qt::ReturnByValue).isNull()) + if (label->pixmap().isNull()) return QPoint(); return QPoint(label->mapToGlobal(label->pos())); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 08e7a1f213f..cf731b2961c 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -272,7 +272,7 @@ void QMessageBoxPrivate::setupLayout() Q_Q(QMessageBox); delete q->layout(); QGridLayout *grid = new QGridLayout; - bool hasIcon = !iconLabel->pixmap(Qt::ReturnByValue).isNull(); + const bool hasIcon = !iconLabel->pixmap().isNull(); if (hasIcon) grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); @@ -1329,7 +1329,7 @@ void QMessageBox::setIcon(Icon icon) QPixmap QMessageBox::iconPixmap() const { Q_D(const QMessageBox); - return d->iconLabel->pixmap(Qt::ReturnByValue); + return d->iconLabel->pixmap(); } void QMessageBox::setIconPixmap(const QPixmap &pixmap) diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 9d260cf4cf3..d6287717d97 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -414,8 +414,8 @@ public: } QSize minimumSizeHint() const override { - if (!pixmap(Qt::ReturnByValue).isNull()) - return pixmap(Qt::ReturnByValue).deviceIndependentSize().toSize(); + if (!pixmap().isNull()) + return pixmap().deviceIndependentSize().toSize(); return QFrame::minimumSizeHint(); } |