summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2022-02-07 17:36:33 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2022-02-24 20:17:41 +0100
commit51ff94ec9224e35669428ec700bf17a1d4a094a8 (patch)
tree1f89d6b64b5433badbaf8a687a37628c7cccbf3e /examples
parent4cca8ee527bfa94947f897d4d9b91aa8eb63d9c3 (diff)
Avoid using deprecated API in the icons example
Fixes compilation warning. Fixes: QTBUG-100155 Change-Id: I1af2e69c070497509645c933df58fd42277cfb18 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/widgets/icons/iconpreviewarea.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/widgets/widgets/icons/iconpreviewarea.cpp b/examples/widgets/widgets/icons/iconpreviewarea.cpp
index d0ee50fbb1..e537e0d100 100644
--- a/examples/widgets/widgets/icons/iconpreviewarea.cpp
+++ b/examples/widgets/widgets/icons/iconpreviewarea.cpp
@@ -52,6 +52,7 @@
#include <QGridLayout>
#include <QLabel>
+#include <QWindow>
//! [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());