diff options
Diffstat (limited to 'src/quicktemplates2/qquickcontainer.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcontainer.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index c95cfc75..decc6e8a 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -548,7 +548,7 @@ QQmlListProperty<QQuickItem> QQuickContainer::contentChildren() This property holds the index of the current item. - \sa currentItem + \sa currentItem, incrementCurrentIndex(), decrementCurrentIndex() */ int QQuickContainer::currentIndex() const { @@ -568,6 +568,36 @@ void QQuickContainer::setCurrentIndex(int index) } /*! + \qmlmethod void QtQuick.Controls::Container::incrementCurrentIndex() + \since QtQuick.Controls 2.1 + + Increments the current index of the container. + + \sa currentIndex +*/ +void QQuickContainer::incrementCurrentIndex() +{ + Q_D(QQuickContainer); + if (d->currentIndex < count() - 1) + setCurrentIndex(d->currentIndex + 1); +} + +/*! + \qmlmethod void QtQuick.Controls::Container::decrementCurrentIndex() + \since QtQuick.Controls 2.1 + + Decrements the current index of the container. + + \sa currentIndex +*/ +void QQuickContainer::decrementCurrentIndex() +{ + Q_D(QQuickContainer); + if (d->currentIndex > 0) + setCurrentIndex(d->currentIndex - 1); +} + +/*! \qmlproperty Item QtQuick.Controls::Container::currentItem \readonly |