From 51ff94ec9224e35669428ec700bf17a1d4a094a8 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 7 Feb 2022 17:36:33 +0100 Subject: [PATCH] Avoid using deprecated API in the icons example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes compilation warning. Fixes: QTBUG-100155 Change-Id: I1af2e69c070497509645c933df58fd42277cfb18 Reviewed-by: Volker Hilsheimer Reviewed-by: Morten Johan Sørvig --- examples/widgets/widgets/icons/iconpreviewarea.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/widgets/widgets/icons/iconpreviewarea.cpp b/examples/widgets/widgets/icons/iconpreviewarea.cpp index d0ee50fbb14..e537e0d1000 100644 --- a/examples/widgets/widgets/icons/iconpreviewarea.cpp +++ b/examples/widgets/widgets/icons/iconpreviewarea.cpp @@ -52,6 +52,7 @@ #include #include +#include //! [0] IconPreviewArea::IconPreviewArea(QWidget *parent) @@ -152,14 +153,11 @@ QLabel *IconPreviewArea::createPixmapLabel() //! [5] void IconPreviewArea::updatePixmapLabels() { - QWindow *window = nullptr; - if (const QWidget *nativeParent = nativeParentWidget()) - window = nativeParent->windowHandle(); for (int column = 0; column < NumModes; ++column) { for (int row = 0; row < NumStates; ++row) { const QPixmap pixmap = - icon.pixmap(window, size, IconPreviewArea::iconModes().at(column), - IconPreviewArea::iconStates().at(row)); + icon.pixmap(size, devicePixelRatio(), IconPreviewArea::iconModes().at(column), + IconPreviewArea::iconStates().at(row)); QLabel *pixmapLabel = pixmapLabels[column][row]; pixmapLabel->setPixmap(pixmap); pixmapLabel->setEnabled(!pixmap.isNull());