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 <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Yuhang Zhao 2023-02-20 17:06:46 +08:00
parent b4b4c81401
commit f7fd5eaf95
8 changed files with 16 additions and 16 deletions

View File

@ -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]

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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()));

View File

@ -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)

View File

@ -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();
}