[kcm-kwintabbox] Add clipTo property to thumbnailitem implementation
This commit is contained in:
parent
f07209d685
commit
2e78144a14
2 changed files with 17 additions and 0 deletions
|
@ -29,6 +29,7 @@ WindowThumbnailItem::WindowThumbnailItem(QQuickPaintedItem* parent)
|
|||
: QQuickPaintedItem(parent)
|
||||
, m_wId(0)
|
||||
, m_image()
|
||||
, m_clipToItem(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,15 @@ void WindowThumbnailItem::setWId(qulonglong wId)
|
|||
findImage();
|
||||
}
|
||||
|
||||
void WindowThumbnailItem::setClipTo(QQuickItem *clip)
|
||||
{
|
||||
if (m_clipToItem == clip) {
|
||||
return;
|
||||
}
|
||||
m_clipToItem = clip;
|
||||
emit clipToChanged();
|
||||
}
|
||||
|
||||
void WindowThumbnailItem::findImage()
|
||||
{
|
||||
QString imagePath;
|
||||
|
|
|
@ -31,6 +31,7 @@ class WindowThumbnailItem : public QQuickPaintedItem
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
||||
Q_PROPERTY(QQuickItem *clipTo READ clipTo WRITE setClipTo NOTIFY clipToChanged)
|
||||
public:
|
||||
explicit WindowThumbnailItem(QQuickPaintedItem *parent = 0);
|
||||
virtual ~WindowThumbnailItem();
|
||||
|
@ -38,7 +39,11 @@ public:
|
|||
qulonglong wId() const {
|
||||
return m_wId;
|
||||
}
|
||||
QQuickItem *clipTo() const {
|
||||
return m_clipToItem;
|
||||
}
|
||||
void setWId(qulonglong wId);
|
||||
void setClipTo(QQuickItem *clip);
|
||||
virtual void paint(QPainter *painter) override;
|
||||
|
||||
enum Thumbnail {
|
||||
|
@ -49,10 +54,12 @@ public:
|
|||
};
|
||||
Q_SIGNALS:
|
||||
void wIdChanged(qulonglong wid);
|
||||
void clipToChanged();
|
||||
private:
|
||||
void findImage();
|
||||
qulonglong m_wId;
|
||||
QImage m_image;
|
||||
QQuickItem *m_clipToItem;
|
||||
};
|
||||
|
||||
} // KWin
|
||||
|
|
Loading…
Reference in a new issue