aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-15 22:48:46 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-15 20:49:55 +0000
commitf48728e61e8e1e828d0a5a1ea64e90e5a8112735 (patch)
treede9a34839cfbb4a88a3a4b7061830b3635cdd76e
parent67d69d5b79f7533e322887f98271c3d8702f9f9f (diff)
Pimplify QQuickExclusiveAttached
Change-Id: I47a70f189e0573b9128a4f2953ae9f6df8f7921f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/qquickexclusivegroup.cpp26
-rw-r--r--src/controls/qquickexclusivegroup_p.h4
2 files changed, 21 insertions, 9 deletions
diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp
index 325dfe19..5144bf92 100644
--- a/src/controls/qquickexclusivegroup.cpp
+++ b/src/controls/qquickexclusivegroup.cpp
@@ -141,8 +141,16 @@ void QQuickExclusiveGroup::removeCheckable(QObject *object)
TODO
*/
+class QQuickExclusiveAttachedPrivate : public QObjectPrivate
+{
+public:
+ QQuickExclusiveAttachedPrivate() : group(Q_NULLPTR) { }
+
+ QQuickExclusiveGroup *group;
+};
+
QQuickExclusiveAttached::QQuickExclusiveAttached(QObject *parent) :
- QObject(parent), m_group(Q_NULLPTR)
+ QObject(*(new QQuickExclusiveAttachedPrivate), parent)
{
}
@@ -158,17 +166,19 @@ QQuickExclusiveAttached *QQuickExclusiveAttached::qmlAttachedProperties(QObject
*/
QQuickExclusiveGroup *QQuickExclusiveAttached::group() const
{
- return m_group;
+ Q_D(const QQuickExclusiveAttached);
+ return d->group;
}
void QQuickExclusiveAttached::setGroup(QQuickExclusiveGroup *group)
{
- if (m_group != group) {
- if (m_group)
- m_group->removeCheckable(parent());
- m_group = group;
- if (m_group)
- m_group->addCheckable(parent());
+ Q_D(QQuickExclusiveAttached);
+ if (d->group != group) {
+ if (d->group)
+ d->group->removeCheckable(parent());
+ d->group = group;
+ if (group)
+ group->addCheckable(parent());
emit groupChanged();
}
}
diff --git a/src/controls/qquickexclusivegroup_p.h b/src/controls/qquickexclusivegroup_p.h
index ce000c50..100b7725 100644
--- a/src/controls/qquickexclusivegroup_p.h
+++ b/src/controls/qquickexclusivegroup_p.h
@@ -55,6 +55,7 @@
QT_BEGIN_NAMESPACE
class QQuickExclusiveGroupPrivate;
+class QQuickExclusiveAttachedPrivate;
class Q_QUICKCONTROLS_EXPORT QQuickExclusiveGroup : public QObject
{
@@ -98,7 +99,8 @@ Q_SIGNALS:
void groupChanged();
private:
- QQuickExclusiveGroup *m_group;
+ Q_DISABLE_COPY(QQuickExclusiveAttached)
+ Q_DECLARE_PRIVATE(QQuickExclusiveAttached)
};
QT_END_NAMESPACE