diff options
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/PageStack.qml | 38 | ||||
-rw-r--r-- | src/controls/StackViewDelegate.qml (renamed from src/controls/PageTransition.qml) | 6 | ||||
-rw-r--r-- | src/controls/controls.pro | 2 | ||||
-rw-r--r-- | src/controls/qmldir | 2 | ||||
-rw-r--r-- | src/controls/qtstack.cpp | 16 | ||||
-rw-r--r-- | src/controls/qtstack_p.h | 10 |
6 files changed, 37 insertions, 37 deletions
diff --git a/src/controls/PageStack.qml b/src/controls/PageStack.qml index 77a25760..a6b41ea1 100644 --- a/src/controls/PageStack.qml +++ b/src/controls/PageStack.qml @@ -288,7 +288,7 @@ import "Private/PageStack.js" as JSArray \qml PageStack { - pageTransition: PageTransition { + delegate: StackViewDelegate { function transitionFinished(properties) { properties.exitPage.opacity = 1 @@ -315,9 +315,9 @@ import "Private/PageStack.js" as JSArray PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that contains the properties \c enterPage and \c exitPage. You set the target of your inner animations to those pages. Since the same page instance can be pushed several - times to a pagestack, and since pages also can override transitions, your PageTransition + times to a pagestack, and since pages also can override transitions, your StackViewDelegate always need to override - \l {PageTransition::transitionFinished(properties)}{PageTransition.transitionFinished(properties)}. + \l {StackViewDelegate::transitionFinished(properties)}{StackViewDelegate.transitionFinished(properties)}. Implement this function to reset any properties animated on the exitPage so that later transitions can expect the pages to be in a default state. @@ -326,7 +326,7 @@ import "Private/PageStack.js" as JSArray \qml PageStack { - pageTransition: PageTransition { + delegate: StackViewDelegate { function transitionFinished(properties) { properties.exitPage.x = 0 @@ -363,13 +363,13 @@ import "Private/PageStack.js" as JSArray \endqml A single Page can also override the transition to use when itself is pushed or popped. This can - be done by just assigning another PageTransition object to \l{Stack::pageTransition}{Stack.pageTransition}. + be done by just assigning another StackViewDelegate object to \l{Stack::delegate}{Stack.delegate}. \section2 Advanced usage After PageStack finds the correct transition to use (it first checks - \l{Stack::pageTransition}{Stack.pageTransition}, then \l {PageStack::pageTransition}{pageTransition}) - it calls \l {PageTransition::getTransition(properties)}{PageTransition.getTransition(properties)}. + \l{Stack::delegate}{Stack.delegate}, then \l {PageStack::delegate}{delegate}) + it calls \l {StackViewDelegate::getTransition(properties)}{StackViewDelegate.getTransition(properties)}. The base implementation of this function just looks for a property named \c properties.name inside itself (root), which is how it finds \c {property Component pushTransition} in the examples above. @@ -398,7 +398,7 @@ import "Private/PageStack.js" as JSArray The following example shows how you can decide run-time which animation to use: \qml - PageTransition { + StackViewDelegate { function getTransition(properties) { return (properties.enterPage.index % 2) ? horizontalAnimation : verticalAnimation @@ -482,10 +482,10 @@ Item { \a busy is \c true if a page transition is running, and \c false otherwise. */ readonly property bool busy: __currentTransition !== null - /*! The animations to use for page transitions. - For better understanding on how to apply custom page transitions, read \l{Transitions}. - \sa {Stack::animations}{Stack.transitions} */ - property PageTransition pageTransition: PageSlideTransition {} + /*! The transitions to use when pushing or popping items. + For better understanding on how to apply custom transitions, read \l{Transitions}. + \sa {Stack::transitions}{Stack.transitions} */ + property StackViewDelegate delegate: StackViewSlideDelegate {} /*! Pushes a page onto the stack. The function takes a property list as argument, which should contain one or more of the following properties: @@ -909,9 +909,9 @@ Item { if (enterPage === exitPage) return - __searchForAnimationIn(transition.transitionElement.page.Stack.pageTransition, transition) + __searchForAnimationIn(transition.transitionElement.page.Stack.delegate, transition) if (!transition.animation) - __searchForAnimationIn(root.pageTransition, transition) + __searchForAnimationIn(root.delegate, transition) if (!transition.animation) { console.warn("Warning: PageStack: no", transition.name, "found!") return @@ -933,16 +933,16 @@ Item { } /*! \internal */ - function __searchForAnimationIn(source, transition) + function __searchForAnimationIn(delegate, transition) { - if (source) { - transition.pageTransition = source + if (delegate) { + transition.delegate = delegate transition.properties = { "name":transition.name, "enterPage":transition.enterPage, "exitPage":transition.exitPage, "immediate":transition.immediate } - var anim = source.getTransition(transition.properties) + var anim = delegate.getTransition(transition.properties) if (anim.createObject) { anim = anim.createObject(null, transition.properties) anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() }) @@ -962,7 +962,7 @@ Item { __setPageStatus(__currentTransition.exitPage, Stack.Inactive); __setPageStatus(__currentTransition.enterPage, Stack.Active); __currentTransition.properties.animation = __currentTransition.animation - __currentTransition.pageTransition.transitionFinished(__currentTransition.properties) + __currentTransition.delegate.transitionFinished(__currentTransition.properties) if (!__currentTransition.push || __currentTransition.replace) __cleanup(__currentTransition.outElement) diff --git a/src/controls/PageTransition.qml b/src/controls/StackViewDelegate.qml index 228ae789..f82779d4 100644 --- a/src/controls/PageTransition.qml +++ b/src/controls/StackViewDelegate.qml @@ -41,10 +41,10 @@ import QtQuick 2.1 /*! - \qmltype PageTransition + \qmltype StackViewDelegate \inqmlmodule QtQuick.Controls 1.0 - \brief The component for managing page transitions. + \brief A delegate used by PageStack for loading transitions. See the documentation for the \l {QtQuick.Controls1::PageStack} {PageStack} component. @@ -60,7 +60,7 @@ QtObject { function transitionFinished(properties) { - console.warn("Warning: PageTransition: the current transition did not override " + console.warn("Warning: StackViewDelegate: the current transition did not override " + "transitionFinished(properties). This can cause the exit page to " + "be left in a state that makes it unusable for further usage!") } diff --git a/src/controls/controls.pro b/src/controls/controls.pro index 51716652..3e1b70ce 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -16,13 +16,13 @@ QML_FILES = \ Menu.qml \ PageAnimation.qml \ PageStack.qml \ - PageTransition.qml \ ProgressBar.qml \ RadioButton.qml \ ScrollView.qml \ Slider.qml \ SpinBox.qml \ SplitView.qml \ + StackViewDelegate.qml \ StatusBar.qml \ Tab.qml \ TabView.qml \ diff --git a/src/controls/qmldir b/src/controls/qmldir index be9fff4f..2cd2db5a 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -10,13 +10,13 @@ MenuBar 1.0 MenuBar.qml Menu 1.0 Menu.qml PageAnimation 1.0 PageAnimation.qml PageStack 1.0 PageStack.qml -PageTransition 1.0 PageTransition.qml ProgressBar 1.0 ProgressBar.qml RadioButton 1.0 RadioButton.qml ScrollView 1.0 ScrollView.qml Slider 1.0 Slider.qml SpinBox 1.0 SpinBox.qml SplitView 1.0 SplitView.qml +StackViewDelegate 1.0 StackViewDelegate.qml StatusBar 1.0 StatusBar.qml Tab 1.0 Tab.qml TabView 1.0 TabView.qml diff --git a/src/controls/qtstack.cpp b/src/controls/qtstack.cpp index 09f2c534..f1933191 100644 --- a/src/controls/qtstack.cpp +++ b/src/controls/qtstack.cpp @@ -65,7 +65,7 @@ QtStack::QtStack(QObject *object) m_index(-1), m_status(Inactive), m_pageStack(0), - m_pageTransition(0) + m_delegate(0) { } @@ -141,23 +141,23 @@ void QtStack::setPageStack(QQuickItem *pageStack) } /*! - \qmlproperty PageTransition Stack::pageTransition + \qmlproperty delegate Stack::delegate This property can be set to override the default animations used during a page transition. To better understand how to use this property, refer to the \l{PageStack#Transitions}{transition documentation} in PageStack. \sa {PageStack::animations}{PageStack.animations} */ -QObject *QtStack::pageTransition() const +QObject *QtStack::delegate() const { - return m_pageTransition; + return m_delegate; } -void QtStack::setPageTransition(QObject* pageTransition) +void QtStack::setdelegate(QObject* delegate) { - if (m_pageTransition != pageTransition) { - m_pageTransition = pageTransition; - emit pageTransitionChanged(); + if (m_delegate != delegate) { + m_delegate = delegate; + emit delegateChanged(); } } diff --git a/src/controls/qtstack_p.h b/src/controls/qtstack_p.h index aa22bf8c..43282fed 100644 --- a/src/controls/qtstack_p.h +++ b/src/controls/qtstack_p.h @@ -55,7 +55,7 @@ class QtStack : public QObject Q_PROPERTY(Status __status READ status WRITE setStatus NOTIFY statusChanged) Q_PROPERTY(QQuickItem* pageStack READ pageStack NOTIFY pageStackChanged) Q_PROPERTY(QQuickItem* __pageStack READ pageStack WRITE setPageStack NOTIFY pageStackChanged) - Q_PROPERTY(QObject* pageTransition READ pageTransition WRITE setPageTransition NOTIFY pageTransitionChanged) + Q_PROPERTY(QObject* delegate READ delegate WRITE setdelegate NOTIFY delegateChanged) Q_ENUMS(Status) public: @@ -79,20 +79,20 @@ public: QQuickItem *pageStack() const; void setPageStack(QQuickItem *pageStack); - QObject *pageTransition() const; - void setPageTransition(QObject* pageTransition); + QObject *delegate() const; + void setdelegate(QObject* delegate); signals: void statusChanged(); void pageStackChanged(); void indexChanged(); - void pageTransitionChanged(); + void delegateChanged(); private: int m_index; Status m_status; QQuickItem *m_pageStack; - QObject *m_pageTransition; + QObject *m_delegate; }; QT_END_NAMESPACE |