From bf6bda9487ce63275264eff66e609a89bacb6416 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 25 Jan 2016 21:57:29 +0100 Subject: Update the item when the DevicePixelRatio changes Since the rendering of the item depends on the device pixel ratio then it needs to be updated whenever this changes. [ChangeLog][QQuickPaintedItem] When the device pixel ratio is changed for the screen the item is rendered on then the item will be updated. Change-Id: Idf3c73faf0c13573c570fe22b5fb9e97fe1e66e2 Reviewed-by: Robin Burchell --- src/quick/items/qquickpainteditem.cpp | 7 +++++++ src/quick/items/qquickpainteditem.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index ad8d94d240..63e90a5cce 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -657,4 +657,11 @@ QSGTextureProvider *QQuickPaintedItem::textureProvider() const return d->textureProvider; } +void QQuickPaintedItem::itemChange(ItemChange change, const ItemChangeData &value) +{ + if (change == ItemDevicePixelRatioHasChanged) + update(); + QQuickItem::itemChange(change, value); +} + QT_END_NAMESPACE diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h index bb4e7f1f85..ff559cd10e 100644 --- a/src/quick/items/qquickpainteditem.h +++ b/src/quick/items/qquickpainteditem.h @@ -115,6 +115,7 @@ protected: QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent = Q_NULLPTR); QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; void releaseResources() Q_DECL_OVERRIDE; + void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE; private Q_SLOTS: void invalidateSceneGraph(); -- cgit v1.2.3