[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)
|
: QQuickPaintedItem(parent)
|
||||||
, m_wId(0)
|
, m_wId(0)
|
||||||
, m_image()
|
, m_image()
|
||||||
|
, m_clipToItem(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +44,15 @@ void WindowThumbnailItem::setWId(qulonglong wId)
|
||||||
findImage();
|
findImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowThumbnailItem::setClipTo(QQuickItem *clip)
|
||||||
|
{
|
||||||
|
if (m_clipToItem == clip) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_clipToItem = clip;
|
||||||
|
emit clipToChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void WindowThumbnailItem::findImage()
|
void WindowThumbnailItem::findImage()
|
||||||
{
|
{
|
||||||
QString imagePath;
|
QString imagePath;
|
||||||
|
|
|
@ -31,6 +31,7 @@ class WindowThumbnailItem : public QQuickPaintedItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
||||||
|
Q_PROPERTY(QQuickItem *clipTo READ clipTo WRITE setClipTo NOTIFY clipToChanged)
|
||||||
public:
|
public:
|
||||||
explicit WindowThumbnailItem(QQuickPaintedItem *parent = 0);
|
explicit WindowThumbnailItem(QQuickPaintedItem *parent = 0);
|
||||||
virtual ~WindowThumbnailItem();
|
virtual ~WindowThumbnailItem();
|
||||||
|
@ -38,7 +39,11 @@ public:
|
||||||
qulonglong wId() const {
|
qulonglong wId() const {
|
||||||
return m_wId;
|
return m_wId;
|
||||||
}
|
}
|
||||||
|
QQuickItem *clipTo() const {
|
||||||
|
return m_clipToItem;
|
||||||
|
}
|
||||||
void setWId(qulonglong wId);
|
void setWId(qulonglong wId);
|
||||||
|
void setClipTo(QQuickItem *clip);
|
||||||
virtual void paint(QPainter *painter) override;
|
virtual void paint(QPainter *painter) override;
|
||||||
|
|
||||||
enum Thumbnail {
|
enum Thumbnail {
|
||||||
|
@ -49,10 +54,12 @@ public:
|
||||||
};
|
};
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void wIdChanged(qulonglong wid);
|
void wIdChanged(qulonglong wid);
|
||||||
|
void clipToChanged();
|
||||||
private:
|
private:
|
||||||
void findImage();
|
void findImage();
|
||||||
qulonglong m_wId;
|
qulonglong m_wId;
|
||||||
QImage m_image;
|
QImage m_image;
|
||||||
|
QQuickItem *m_clipToItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // KWin
|
} // KWin
|
||||||
|
|
Loading…
Reference in a new issue