~zsombi/ubuntu-ui-toolkit/themingWithItemChangeListener

« back to all changes in this revision

Viewing changes to src/Ubuntu/Components/plugin/ucthemingextension.cpp

  • Committer: Zsombor Egri
  • Date: 2015-10-07 09:24:05 UTC
  • Revision ID: zsombor.egri@canonical.com-20151007092405-qz3tprt6rru6bgg7
do not connect to the parentChanged signal, but use QQuickItemChangeListener

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    , m_prevParent(Q_NULLPTR)
100
100
    , m_extension(Q_NULLPTR)
101
101
{
102
 
    // get parent item changes
103
 
    connect(m_item, &QQuickItem::parentChanged, this, &UCItemAttached::handleParentChanged);
 
102
    QQuickItemPrivate::get(m_item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
104
103
}
105
104
 
106
105
UCItemAttached::~UCItemAttached()
107
106
{
 
107
    QQuickItemPrivate::get(m_item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
108
108
}
109
109
 
110
110
UCItemAttached *UCItemAttached::qmlAttachedProperties(QObject *owner)
119
119
}
120
120
 
121
121
// handle parent changes
122
 
void UCItemAttached::handleParentChanged(QQuickItem *newParent)
 
122
void UCItemAttached::itemParentChanged(QQuickItem *, QQuickItem *newParent)
123
123
{
124
124
    if (newParent == m_prevParent || QQuickItemPrivate::get(m_item)->wasDeleted) {
125
125
        return;