Remove parent window id from ThumbnailItem

Luckily a QQuickItem contains the pointer to the QQuickWindow which
holds the item. This means we no longer need the hack to find the
parent window.
icc-effect-5.14.5
Martin Gräßlin 2013-08-12 19:31:25 +02:00
parent 388944314a
commit 416b881a00
2 changed files with 0 additions and 23 deletions

View File

@ -37,7 +37,6 @@ namespace KWin
AbstractThumbnailItem::AbstractThumbnailItem(QQuickItem *parent)
: QQuickPaintedItem(parent)
, m_parent(QWeakPointer<EffectWindowImpl>())
, m_parentWindow(0)
, m_brightness(1.0)
, m_saturation(1.0)
, m_clipToItem()
@ -70,24 +69,9 @@ void AbstractThumbnailItem::init()
}
}
void AbstractThumbnailItem::setParentWindow(qulonglong parentWindow)
{
m_parentWindow = parentWindow;
findParentEffectWindow();
if (!m_parent.isNull()) {
m_parent.data()->registerThumbnail(this);
}
}
void AbstractThumbnailItem::findParentEffectWindow()
{
if (effects) {
if (m_parentWindow) {
if (EffectWindowImpl *w = static_cast<EffectWindowImpl*>(effects->findWindow(m_parentWindow))) {
m_parent = QWeakPointer<EffectWindowImpl>(w);
return;
}
}
QQuickWindow *qw = window();
if (!qw) {
kDebug(1212) << "No QQuickWindow assigned yet";
@ -95,7 +79,6 @@ void AbstractThumbnailItem::findParentEffectWindow()
}
if (auto *w = static_cast<EffectWindowImpl*>(effects->findWindow(qw->winId()))) {
m_parent = QWeakPointer<EffectWindowImpl>(w);
m_parentWindow = qw->winId();
}
}
}

View File

@ -35,16 +35,11 @@ class EffectWindowImpl;
class AbstractThumbnailItem : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(qulonglong parentWindow READ parentWindow WRITE setParentWindow)
Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
Q_PROPERTY(QQuickItem *clipTo READ clipTo WRITE setClipTo NOTIFY clipToChanged)
public:
virtual ~AbstractThumbnailItem();
qulonglong parentWindow() const {
return m_parentWindow;
}
void setParentWindow(qulonglong parentWindow);
qreal brightness() const;
qreal saturation() const;
QQuickItem *clipTo() const;
@ -73,7 +68,6 @@ private Q_SLOTS:
private:
void findParentEffectWindow();
QWeakPointer<EffectWindowImpl> m_parent;
qulonglong m_parentWindow;
qreal m_brightness;
qreal m_saturation;
QPointer<QQuickItem> m_clipToItem;