aboutsummaryrefslogtreecommitdiffstats
path: root/src/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/qquickstyleattached.cpp21
-rw-r--r--src/controls/qquickstyleattached_p.h2
2 files changed, 8 insertions, 15 deletions
diff --git a/src/controls/qquickstyleattached.cpp b/src/controls/qquickstyleattached.cpp
index 85a4b3c8..91ad6b10 100644
--- a/src/controls/qquickstyleattached.cpp
+++ b/src/controls/qquickstyleattached.cpp
@@ -147,14 +147,20 @@ static QList<QQuickStyleAttached *> findChildStyles(const QMetaObject *type, QOb
QQuickStyleAttached::QQuickStyleAttached(QObject *parent) : QObject(parent)
{
- QQuickItem *item = parentItem();
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent);
+ if (!item) {
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent);
+ if (popup)
+ item = popup->popupItem();
+ }
+
if (item)
QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
}
QQuickStyleAttached::~QQuickStyleAttached()
{
- QQuickItem *item = parentItem();
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent());
if (item)
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
@@ -176,17 +182,6 @@ QSharedPointer<QSettings> QQuickStyleAttached::settings(const QString &group)
return QSharedPointer<QSettings>();
}
-QQuickItem *QQuickStyleAttached::parentItem() const
-{
- QQuickItem *item = qobject_cast<QQuickItem *>(parent());
- if (!item) {
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent());
- if (popup)
- item = popup->popupItem();
- }
- return item;
-}
-
QList<QQuickStyleAttached *> QQuickStyleAttached::childStyles() const
{
return m_childStyles;
diff --git a/src/controls/qquickstyleattached_p.h b/src/controls/qquickstyleattached_p.h
index 591aa133..61e04bf6 100644
--- a/src/controls/qquickstyleattached_p.h
+++ b/src/controls/qquickstyleattached_p.h
@@ -73,8 +73,6 @@ public:
protected:
void init();
- QQuickItem *parentItem() const;
-
QList<QQuickStyleAttached *> childStyles() const;
QQuickStyleAttached *parentStyle() const;