From f6a716a11a26e2ce76f8ed71ad1733e939ca468b Mon Sep 17 00:00:00 2001 From: J-P Nurmi <jpnurmi@digia.com> Date: Wed, 29 May 2013 16:17:02 +0200 Subject: [PATCH] Remove remaining references to PageStack Change-Id: I59a9846c83340d0752659ef22cbb19a4be6a4129 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> --- .../controls/touch/content/ButtonPage.qml | 2 +- examples/quick/controls/touch/main.qml | 12 +++++----- src/controls/StackView.qml | 6 ++--- src/controls/plugins.qmltypes | 4 ++-- src/controls/qquickstack.cpp | 24 +++++++++---------- src/controls/qquickstack_p.h | 12 +++++----- tests/auto/controls/data/tst_stack.qml | 6 ++--- .../{tst_pagestack.qml => tst_stackview.qml} | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-) rename tests/auto/controls/data/{tst_pagestack.qml => tst_stackview.qml} (96%) diff --git a/examples/quick/controls/touch/content/ButtonPage.qml b/examples/quick/controls/touch/content/ButtonPage.qml index 635ce3b99..f431a52e8 100644 --- a/examples/quick/controls/touch/content/ButtonPage.qml +++ b/examples/quick/controls/touch/content/ButtonPage.qml @@ -86,7 +86,7 @@ Item { anchors.margins: 20 style: touchStyle text: "Dont press me" - onClicked: if (pageStack) pageStack.pop() + onClicked: if (stackView) stackView.pop() } } diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml index 3058a0d31..9f93cb783 100644 --- a/examples/quick/controls/touch/main.qml +++ b/examples/quick/controls/touch/main.qml @@ -54,8 +54,8 @@ ApplicationWindow { // Implements back key navigation Keys.onReleased: { if (event.key === Qt.Key_Back) { - if (pageStack.depth > 1) { - pageStack.pop(); + if (stackView.depth > 1) { + stackView.pop(); event.accepted = true; } else { Qt.quit(); } } @@ -72,7 +72,7 @@ ApplicationWindow { width: opacity ? 60 : 0 anchors.left: parent.left anchors.leftMargin: 20 - opacity: pageStack.depth > 1 ? 1 : 0 + opacity: stackView.depth > 1 ? 1 : 0 anchors.verticalCenter: parent.verticalCenter antialiasing: true height: 60 @@ -87,7 +87,7 @@ ApplicationWindow { id: backmouse anchors.fill: parent anchors.margins: -10 - onClicked: pageStack.pop() + onClicked: stackView.pop() } } @@ -126,7 +126,7 @@ ApplicationWindow { } StackView { - id: pageStack + id: stackView anchors.fill: parent initialItem: Item { @@ -137,7 +137,7 @@ ApplicationWindow { anchors.fill: parent delegate: AndroidDelegate { text: title - onClicked: pageStack.push(Qt.resolvedUrl(page)) + onClicked: stackView.push(Qt.resolvedUrl(page)) } } } diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index c7b2366f2..2c760e89e 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -797,7 +797,7 @@ Item { } element.item.Stack.__index = element.index - element.item.Stack.__stackView = root + element.item.Stack.__view = root // Let item fill all available space by default: element.item.width = Qt.binding(function() { return root.width }) element.item.height = Qt.binding(function() { return root.height }) @@ -842,7 +842,7 @@ Item { // might reenter on pop if pushed several times: item.visible = false __setStatus(item, Stack.Inactive) - item.Stack.__stackView = null + item.Stack.__view = null item.Stack.__index = -1 if (element.originalParent) item.parent = element.originalParent @@ -871,7 +871,7 @@ Item { // Since an item can be pushed several times, we need to update its properties: enterItem.parent = root - enterItem.Stack.__stackView = root + enterItem.Stack.__view = root enterItem.Stack.__index = transition.inElement.index __currentItem = enterItem diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes index 8997cecfa..bd8508da5 100644 --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -199,7 +199,7 @@ Module { Property { name: "__index"; type: "int" } Property { name: "status"; type: "Status"; isReadonly: true } Property { name: "__status"; type: "Status" } - Property { name: "pageStack"; type: "QQuickItem"; isReadonly: true; isPointer: true } - Property { name: "__stackView"; type: "QQuickItem"; isPointer: true } + Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__view"; type: "QQuickItem"; isPointer: true } } } diff --git a/src/controls/qquickstack.cpp b/src/controls/qquickstack.cpp index 1723ef72d..5d3accffd 100644 --- a/src/controls/qquickstack.cpp +++ b/src/controls/qquickstack.cpp @@ -64,7 +64,7 @@ QQuickStack::QQuickStack(QObject *object) : QObject(object), m_index(-1), m_status(Inactive), - m_pageStack(0) + m_view(0) { } @@ -77,9 +77,9 @@ QQuickStack *QQuickStack::qmlAttachedProperties(QObject *object) \readonly \qmlproperty int Stack::index - This property holds the index of the item inside \l{pageStack}{StackView}, - so that \l{StackView::get()}{pageStack.get(index)} will return the item itself. - If \l{Stack::pageStack}{pageStack} is \c null, \a index will be \c -1. + This property holds the index of the item inside \l{view}{StackView}, + so that \l{StackView::get()}{StackView.get(index)} will return the item itself. + If \l{Stack::view}{view} is \c null, \a index will be \c -1. */ int QQuickStack::index() const { @@ -121,21 +121,21 @@ void QQuickStack::setStatus(Status status) /*! \readonly - \qmlproperty StackView Stack::pageStack + \qmlproperty StackView Stack::view This property holds the StackView the item is in. If the item is not inside - a StackView, \a pageStack will be \c null. + a StackView, \a view will be \c null. */ -QQuickItem *QQuickStack::pageStack() const +QQuickItem *QQuickStack::view() const { - return m_pageStack; + return m_view; } -void QQuickStack::setStackView(QQuickItem *pageStack) +void QQuickStack::setView(QQuickItem *view) { - if (m_pageStack != pageStack) { - m_pageStack = pageStack; - emit pageStackChanged(); + if (m_view != view) { + m_view = view; + emit viewChanged(); } } diff --git a/src/controls/qquickstack_p.h b/src/controls/qquickstack_p.h index a4b366443..c34dd1a3e 100644 --- a/src/controls/qquickstack_p.h +++ b/src/controls/qquickstack_p.h @@ -53,8 +53,8 @@ class QQuickStack : public QObject Q_PROPERTY(int __index READ index WRITE setIndex NOTIFY indexChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(Status __status READ status WRITE setStatus NOTIFY statusChanged) - Q_PROPERTY(QQuickItem* pageStack READ pageStack NOTIFY pageStackChanged) - Q_PROPERTY(QQuickItem* __stackView READ pageStack WRITE setStackView NOTIFY pageStackChanged) + Q_PROPERTY(QQuickItem* view READ view NOTIFY viewChanged) + Q_PROPERTY(QQuickItem* __view READ view WRITE setView NOTIFY viewChanged) Q_ENUMS(Status) public: @@ -75,18 +75,18 @@ public: Status status() const; void setStatus(Status status); - QQuickItem *pageStack() const; - void setStackView(QQuickItem *pageStack); + QQuickItem *view() const; + void setView(QQuickItem *view); signals: void statusChanged(); - void pageStackChanged(); + void viewChanged(); void indexChanged(); private: int m_index; Status m_status; - QQuickItem *m_pageStack; + QQuickItem *m_view; }; QT_END_NAMESPACE diff --git a/tests/auto/controls/data/tst_stack.qml b/tests/auto/controls/data/tst_stack.qml index fa833680f..a7363de7a 100644 --- a/tests/auto/controls/data/tst_stack.qml +++ b/tests/auto/controls/data/tst_stack.qml @@ -58,8 +58,8 @@ TestCase { compare(item.status, 0); // Stack.Inactive } - function test_pageStack() { - var item = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.Controls 1.0; Item { property StackView pageStack: Stack.pageStack }', testCase, ''); - compare(item.pageStack, null); + function test_view() { + var item = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.Controls 1.0; Item { property StackView view: Stack.view }', testCase, ''); + compare(item.view, null); } } diff --git a/tests/auto/controls/data/tst_pagestack.qml b/tests/auto/controls/data/tst_stackview.qml similarity index 96% rename from tests/auto/controls/data/tst_pagestack.qml rename to tests/auto/controls/data/tst_stackview.qml index b20556fbd..3daac7855 100644 --- a/tests/auto/controls/data/tst_pagestack.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -60,10 +60,10 @@ TestCase { StackView {} } - function test_pagestack() { + function test_stackview() { var component = stackComponent var stack = component.createObject(testCase); - verify (stack !== null, "pagestack created is null") + verify (stack !== null, "stackview created is null") verify (stack.depth === 0) stack.push(anItem) verify (stack.depth === 1) -- GitLab