diff --git a/src/declarativeimports/core/windowthumbnail.cpp b/src/declarativeimports/core/windowthumbnail.cpp index b10f0305b..84d8bc865 100644 --- a/src/declarativeimports/core/windowthumbnail.cpp +++ b/src/declarativeimports/core/windowthumbnail.cpp @@ -64,6 +64,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem *parent) , QAbstractNativeEventFilter() , m_xcb(false) , m_winId(0) + , m_paintedSize(QSizeF()) , m_damaged(false) , m_depth(0) #if HAVE_XCB_COMPOSITE @@ -140,6 +141,16 @@ void WindowThumbnail::setWinId(uint32_t winId) emit winIdChanged(); } +qreal WindowThumbnail::paintedWidth() const +{ + return m_paintedSize.width(); +} + +qreal WindowThumbnail::paintedHeight() const +{ + return m_paintedSize.height(); +} + QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) { Q_UNUSED(updatePaintNodeData) @@ -154,7 +165,11 @@ QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData windowToTexture(node); } node->setRect(boundingRect()); - const QSize size(node->texture()->textureSize().scaled(boundingRect().size().toSize(), Qt::KeepAspectRatio)); + const QSizeF size(node->texture()->textureSize().scaled(boundingRect().size().toSize(), Qt::KeepAspectRatio)); + if (size != m_paintedSize) { + m_paintedSize = size; + emit paintedSizeChanged(); + } const qreal x = boundingRect().x() + (boundingRect().width() - size.width()) / 2; const qreal y = boundingRect().y() + (boundingRect().height() - size.height()) / 2; node->setRect(QRectF(QPointF(x, y), size)); diff --git a/src/declarativeimports/core/windowthumbnail.h b/src/declarativeimports/core/windowthumbnail.h index 14fc44a3b..61bc156b0 100644 --- a/src/declarativeimports/core/windowthumbnail.h +++ b/src/declarativeimports/core/windowthumbnail.h @@ -73,6 +73,9 @@ class WindowThumbnail : public QQuickItem, public QAbstractNativeEventFilter { Q_OBJECT Q_PROPERTY(uint winId READ winId WRITE setWinId NOTIFY winIdChanged) + Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) + Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) + public: WindowThumbnail(QQuickItem *parent = 0); virtual ~WindowThumbnail(); @@ -82,8 +85,12 @@ public: uint32_t winId() const; void setWinId(uint32_t winId); + qreal paintedWidth() const; + qreal paintedHeight() const; + Q_SIGNALS: void winIdChanged(); + void paintedSizeChanged(); private: void iconToTexture(WindowTextureNode *textureNode); @@ -94,6 +101,7 @@ private: void discardPixmap(); bool m_xcb; uint32_t m_winId; + QSizeF m_paintedSize; bool m_damaged; int m_depth; #if HAVE_XCB_COMPOSITE