diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-04-29 09:47:02 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-11 15:12:58 +0000 |
commit | 1bf01af30f455b207e5ad479d3fe8e9757d55e6a (patch) | |
tree | 71cfea4d3af740d8581e018474c5ead592444116 /examples | |
parent | 3dab48bcc532f44acc0370d056329a2e5a6b7b6e (diff) |
Tabs example: use TabBar & SwipeView
Change-Id: I4733dac4e6947874eaff9d3f0ef6918e5207e892
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/controls/tabs/main.qml | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/examples/quick/controls/tabs/main.qml b/examples/quick/controls/tabs/main.qml index 5e68d79b..da69dea8 100644 --- a/examples/quick/controls/tabs/main.qml +++ b/examples/quick/controls/tabs/main.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Extras 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 2.0 import QtQuick.XmlListModel 2.0 @@ -50,17 +51,29 @@ ApplicationWindow { visible: true title: "Qt Quick Controls - Tabs Example" - TabView { - id: tabView + header: TabBar { + id: bar + currentIndex: view.currentIndex + TabButton { + text: "Home" + } + TabButton { + text: "Discover" + } + TabButton { + text: "Activity" + } + } + + SwipeView { + id: view spacing: 1 anchors.fill: parent + currentIndex: bar.currentIndex background: Rectangle { color: Theme.frameColor } Rectangle { - Tab.title: "Home" - anchors.fill: parent - Image { id: logo width: window.width / 2 @@ -86,9 +99,6 @@ ApplicationWindow { } Rectangle { - Tab.title: "Discover" - anchors.fill: parent - ListView { anchors.fill: parent anchors.topMargin: -1 @@ -176,9 +186,6 @@ ApplicationWindow { } Rectangle { - Tab.title: "Activity" - anchors.fill: parent - ListView { anchors.fill: parent anchors.topMargin: -1 @@ -268,8 +275,8 @@ ApplicationWindow { } PageIndicator { - count: tabView.count - currentIndex: tabView.currentIndex + count: view.count + currentIndex: view.currentIndex anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter } |