aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-27 08:07:06 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-27 08:25:52 +0000
commit0babb4de001be4aa75d9ea0bfbab869a1c2b27c7 (patch)
treec64ffcbf68b0efb9fa663bd53a1c01af4989c3e6
parente59982c968dad7ffe4e3c0fd63325187b3f07b42 (diff)
Rename QQuickStackAttached to QQuickStackViewAttached
In QQC1 the attached property was called "Stack", purely because we couldn't have both QML and C++ types with the same name. Now the attached properties are provided by StackView itself, so this is the correct name. Change-Id: I0f98d73735cff14c444a9e843b7cb56dc8a45cd8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quicktemplates2/qquickstackelement.cpp16
-rw-r--r--src/quicktemplates2/qquickstackview.cpp30
-rw-r--r--src/quicktemplates2/qquickstackview_p.h17
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h8
5 files changed, 36 insertions, 37 deletions
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 9f518335..b03028eb 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -151,7 +151,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickSpinBox>(uri, 2, 0, "SpinBox");
qmlRegisterType<QQuickSpinButton>();
qmlRegisterType<QQuickStackView>(uri, 2, 0, "StackView");
- qmlRegisterType<QQuickStackAttached>();
+ qmlRegisterType<QQuickStackViewAttached>();
qmlRegisterType<QQuickSwipeDelegate>(uri, 2, 0, "SwipeDelegate");
qmlRegisterType<QQuickSwipe>();
qmlRegisterType<QQuickSwipeViewAttached>();
diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp
index b90774a2..8b31af30 100644
--- a/src/quicktemplates2/qquickstackelement.cpp
+++ b/src/quicktemplates2/qquickstackelement.cpp
@@ -47,11 +47,11 @@
QT_BEGIN_NAMESPACE
-static QQuickStackAttached *attachedStackObject(QQuickStackElement *element)
+static QQuickStackViewAttached *attachedStackObject(QQuickStackElement *element)
{
- QQuickStackAttached *attached = qobject_cast<QQuickStackAttached *>(qmlAttachedPropertiesObject<QQuickStackView>(element->item, false));
+ QQuickStackViewAttached *attached = qobject_cast<QQuickStackViewAttached *>(qmlAttachedPropertiesObject<QQuickStackView>(element->item, false));
if (attached)
- QQuickStackAttachedPrivate::get(attached)->element = element;
+ QQuickStackViewAttachedPrivate::get(attached)->element = element;
return attached;
}
@@ -82,7 +82,7 @@ QQuickStackElement::~QQuickStackElement()
if (ownComponent)
delete component;
- QQuickStackAttached *attached = attachedStackObject(this);
+ QQuickStackViewAttached *attached = attachedStackObject(this);
if (item) {
if (ownItem) {
item->setParentItem(nullptr);
@@ -98,7 +98,7 @@ QQuickStackElement::~QQuickStackElement()
item->setParentItem(originalParent);
} else {
if (attached)
- QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, nullptr);
+ QQuickStackViewAttachedPrivate::get(attached)->itemParentChanged(item, nullptr);
}
}
}
@@ -205,7 +205,7 @@ void QQuickStackElement::setIndex(int value)
return;
index = value;
- QQuickStackAttached *attached = attachedStackObject(this);
+ QQuickStackViewAttached *attached = attachedStackObject(this);
if (attached)
emit attached->indexChanged();
}
@@ -216,7 +216,7 @@ void QQuickStackElement::setView(QQuickStackView *value)
return;
view = value;
- QQuickStackAttached *attached = attachedStackObject(this);
+ QQuickStackViewAttached *attached = attachedStackObject(this);
if (attached)
emit attached->viewChanged();
}
@@ -227,7 +227,7 @@ void QQuickStackElement::setStatus(QQuickStackView::Status value)
return;
status = value;
- QQuickStackAttached *attached = attachedStackObject(this);
+ QQuickStackViewAttached *attached = attachedStackObject(this);
if (!attached)
return;
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 34d8d3c1..079dc915 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -314,9 +314,9 @@ QQuickStackView::~QQuickStackView()
qDeleteAll(d->elements);
}
-QQuickStackAttached *QQuickStackView::qmlAttachedProperties(QObject *object)
+QQuickStackViewAttached *QQuickStackView::qmlAttachedProperties(QObject *object)
{
- return new QQuickStackAttached(object);
+ return new QQuickStackViewAttached(object);
}
/*!
@@ -994,9 +994,9 @@ bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
return window && !window->mouseGrabberItem();
}
-void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+void QQuickStackViewAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
{
- Q_Q(QQuickStackAttached);
+ Q_Q(QQuickStackViewAttached);
int oldIndex = element ? element->index : -1;
QQuickStackView *oldView = element ? element->view : nullptr;
QQuickStackView::Status oldStatus = element ? element->status : QQuickStackView::Inactive;
@@ -1015,10 +1015,10 @@ void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem
emit q->statusChanged();
}
-QQuickStackAttached::QQuickStackAttached(QObject *parent) :
- QObject(*(new QQuickStackAttachedPrivate), parent)
+QQuickStackViewAttached::QQuickStackViewAttached(QObject *parent) :
+ QObject(*(new QQuickStackViewAttachedPrivate), parent)
{
- Q_D(QQuickStackAttached);
+ Q_D(QQuickStackViewAttached);
QQuickItem *item = qobject_cast<QQuickItem *>(parent);
if (item) {
QQuickItemPrivate::get(item)->addItemChangeListener(d, QQuickItemPrivate::Parent);
@@ -1028,9 +1028,9 @@ QQuickStackAttached::QQuickStackAttached(QObject *parent) :
}
}
-QQuickStackAttached::~QQuickStackAttached()
+QQuickStackViewAttached::~QQuickStackViewAttached()
{
- Q_D(QQuickStackAttached);
+ Q_D(QQuickStackViewAttached);
QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
if (parentItem)
QQuickItemPrivate::get(parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Parent);
@@ -1043,9 +1043,9 @@ QQuickStackAttached::~QQuickStackAttached()
This attached property holds the stack index of the item it's
attached to, or \c -1 if the item is not in a stack.
*/
-int QQuickStackAttached::index() const
+int QQuickStackViewAttached::index() const
{
- Q_D(const QQuickStackAttached);
+ Q_D(const QQuickStackViewAttached);
return d->element ? d->element->index : -1;
}
@@ -1056,9 +1056,9 @@ int QQuickStackAttached::index() const
This attached property holds the stack view of the item it's
attached to, or \c null if the item is not in a stack.
*/
-QQuickStackView *QQuickStackAttached::view() const
+QQuickStackView *QQuickStackViewAttached::view() const
{
- Q_D(const QQuickStackAttached);
+ Q_D(const QQuickStackViewAttached);
return d->element ? d->element->view : nullptr;
}
@@ -1075,9 +1075,9 @@ QQuickStackView *QQuickStackAttached::view() const
\value StackView.Activating The item is being activated (becoming the current item).
\value StackView.Active The item is active, that is, the current item.
*/
-QQuickStackView::Status QQuickStackAttached::status() const
+QQuickStackView::Status QQuickStackViewAttached::status() const
{
- Q_D(const QQuickStackAttached);
+ Q_D(const QQuickStackViewAttached);
return d->element ? d->element->status : QQuickStackView::Inactive;
}
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
index 9bf60183..e14bf2d4 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -55,8 +55,9 @@ QT_BEGIN_NAMESPACE
class QQmlV4Function;
class QQuickTransition;
class QQuickStackElement;
-class QQuickStackAttached;
class QQuickStackViewPrivate;
+class QQuickStackViewAttached;
+class QQuickStackViewAttachedPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackView : public QQuickControl
{
@@ -76,7 +77,7 @@ public:
explicit QQuickStackView(QQuickItem *parent = nullptr);
~QQuickStackView();
- static QQuickStackAttached *qmlAttachedProperties(QObject *object);
+ static QQuickStackViewAttached *qmlAttachedProperties(QObject *object);
bool isBusy() const;
int depth() const;
@@ -157,9 +158,7 @@ private:
Q_DECLARE_PRIVATE(QQuickStackView)
};
-class QQuickStackAttachedPrivate;
-
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackAttached : public QObject
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackViewAttached : public QObject
{
Q_OBJECT
Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
@@ -167,8 +166,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackAttached : public QObject
Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL)
public:
- explicit QQuickStackAttached(QObject *parent = nullptr);
- ~QQuickStackAttached();
+ explicit QQuickStackViewAttached(QObject *parent = nullptr);
+ ~QQuickStackViewAttached();
int index() const;
QQuickStackView *view() const;
@@ -185,8 +184,8 @@ Q_SIGNALS:
/*Q_REVISION(1)*/ void removed();
private:
- Q_DISABLE_COPY(QQuickStackAttached)
- Q_DECLARE_PRIVATE(QQuickStackAttached)
+ Q_DISABLE_COPY(QQuickStackViewAttached)
+ Q_DECLARE_PRIVATE(QQuickStackViewAttached)
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index 425f37b4..13fd9b28 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -97,14 +97,14 @@ public:
QQuickItemViewTransitioner *transitioner;
};
-class QQuickStackAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+class QQuickStackViewAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
- Q_DECLARE_PUBLIC(QQuickStackAttached)
+ Q_DECLARE_PUBLIC(QQuickStackViewAttached)
public:
- QQuickStackAttachedPrivate() : element(nullptr) { }
+ QQuickStackViewAttachedPrivate() : element(nullptr) { }
- static QQuickStackAttachedPrivate *get(QQuickStackAttached *attached)
+ static QQuickStackViewAttachedPrivate *get(QQuickStackViewAttached *attached)
{
return attached->d_func();
}