From 405cff37fc3479b2c9f895c60a4e98155cee5650 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 25 Jun 2015 15:02:47 +0200 Subject: Docs: TabBar & TabButton Change-Id: Ib06c610b1637831ddce6214507b07f29bc67421d Reviewed-by: J-P Nurmi --- src/controls/qquicktabbar.cpp | 47 +++++++++++++++++++++++++++++++++++++--- src/controls/qquicktabbutton.cpp | 14 +++++++++++- 2 files changed, 57 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/controls/qquicktabbar.cpp b/src/controls/qquicktabbar.cpp index c868f41c..7714ddbe 100644 --- a/src/controls/qquicktabbar.cpp +++ b/src/controls/qquicktabbar.cpp @@ -48,7 +48,47 @@ QT_BEGIN_NAMESPACE \ingroup tabs \brief A tab bar control. - TODO + TabBar provides a tab-based navigation model. TabBar is populated with + TabButton controls, and can be used together with any layout or container + control that provides \c currentIndex -property, such as \l StackLayout + or \l SwipeView + + ### TODO: screenshot + + \code + ApplicationWindow { + visible:true + + header: TabBar { + id: bar + TabButton { + text: qsTr("Home") + } + TabButton { + text: qsTr("Discover") + } + TabButton { + text: qsTr("Activity") + } + } + + StackLayout { + anchors.fill: parent + currentIndex: bar.currentIndex + Item { + id: homeTab + } + Item { + id: discoverTab + } + Item { + id: activityTab + } + } + } + \endcode + + \sa TabButton, {Customizing TabBar} */ class QQuickTabBarPrivate : public QQuickContainerPrivate @@ -147,7 +187,7 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) : /*! \qmlproperty int QtQuickControls2::TabBar::currentIndex - TODO + This property holds the current index. */ int QQuickTabBar::currentIndex() const { @@ -168,8 +208,9 @@ void QQuickTabBar::setCurrentIndex(int index) /*! \qmlproperty Item QtQuickControls2::TabBar::currentItem + \readonly - TODO + This property holds the current item. */ QQuickItem *QQuickTabBar::currentItem() const { diff --git a/src/controls/qquicktabbutton.cpp b/src/controls/qquicktabbutton.cpp index 62a556af..dacffc24 100644 --- a/src/controls/qquicktabbutton.cpp +++ b/src/controls/qquicktabbutton.cpp @@ -46,7 +46,19 @@ QT_BEGIN_NAMESPACE \ingroup tabs \brief A tab button control. - TODO + TabButton is used in conjunction with a \l TabBar. + + ### TODO: screenshot + + \code + TabBar { + TabButton { text: qsTr("Home") } + TabButton { text: qsTr("Discover") } + TabButton { text: qsTr("Activity") } + } + \endcode + + \sa TabBar, {Customizing TabButton} */ QQuickTabButton::QQuickTabButton(QQuickItem *parent) : -- cgit v1.2.3