diff --git a/kcmkwin/kwintabbox/thumbnailitem.cpp b/kcmkwin/kwintabbox/thumbnailitem.cpp index 6b4f2599f2..95766a22a1 100644 --- a/kcmkwin/kwintabbox/thumbnailitem.cpp +++ b/kcmkwin/kwintabbox/thumbnailitem.cpp @@ -20,21 +20,18 @@ along with this program. If not, see . #include "thumbnailitem.h" // Qt -#include -#include -#include #include +#include // KDE #include namespace KWin { -WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent) - : QDeclarativeItem(parent) +WindowThumbnailItem::WindowThumbnailItem(QQuickPaintedItem* parent) + : QQuickPaintedItem(parent) , m_wId(0) , m_image() { - setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); } WindowThumbnailItem::~WindowThumbnailItem() @@ -75,11 +72,10 @@ void WindowThumbnailItem::findImage() } } -void WindowThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void WindowThumbnailItem::paint(QPainter *painter) { if (m_image.isNull()) { - // no image: default behavior - QDeclarativeItem::paint(painter, option, widget); + return; } QSizeF difference(boundingRect().width() - m_image.width(), boundingRect().height() - m_image.height()); const QRectF drawRect(boundingRect().x() + difference.width()/2.0, boundingRect().y(), m_image.width(), m_image.height()); diff --git a/kcmkwin/kwintabbox/thumbnailitem.h b/kcmkwin/kwintabbox/thumbnailitem.h index 2eca9baa1e..6b4bca4002 100644 --- a/kcmkwin/kwintabbox/thumbnailitem.h +++ b/kcmkwin/kwintabbox/thumbnailitem.h @@ -21,24 +21,25 @@ along with this program. If not, see . #ifndef KWIN_THUMBNAILITEM_H #define KWIN_THUMBNAILITEM_H -#include +#include +#include namespace KWin { -class WindowThumbnailItem : public QDeclarativeItem +class WindowThumbnailItem : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) public: - explicit WindowThumbnailItem(QDeclarativeItem *parent = 0); + explicit WindowThumbnailItem(QQuickPaintedItem *parent = 0); virtual ~WindowThumbnailItem(); qulonglong wId() const { return m_wId; } void setWId(qulonglong wId); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual void paint(QPainter *painter) override; enum Thumbnail { Konqueror = 1,