diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-24 13:37:43 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-25 09:43:35 +0000 |
commit | 6b4a6b0deb54f9a65d75d9c9f1e60b32ced1a781 (patch) | |
tree | 47e8507f89553a682fdddf0de0793ecc0441c0c1 | |
parent | 6beb454e2ca4ce6a25ae1637d8dd9d395a18443c (diff) |
TabBar: improve the behavior of flickable tabs
When using flickable tabs, make sure the next or previous tab is
a bit visible to make it clear that there are more tabs and ensure
that the content is not flickable when there is less content than
available size.
Change-Id: I231ac8e99007103517ff49e747282af43cc6f8ea
Task-number: QTBUG-55129
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/imports/controls/TabBar.qml | 8 | ||||
-rw-r--r-- | src/imports/controls/material/TabBar.qml | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml index 6f3e040b..6a575167 100644 --- a/src/imports/controls/TabBar.qml +++ b/src/imports/controls/TabBar.qml @@ -34,7 +34,7 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.7 import QtQuick.Templates 2.0 as T T.TabBar { @@ -58,7 +58,13 @@ T.TabBar { spacing: control.spacing orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded snapMode: ListView.SnapToItem + + highlightMoveDuration: 0 + highlightRangeMode: ListView.ApplyRange + preferredHighlightBegin: 40 + preferredHighlightEnd: width - 40 } //! [contentItem] diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml index 22a80efa..901e3328 100644 --- a/src/imports/controls/material/TabBar.qml +++ b/src/imports/controls/material/TabBar.qml @@ -34,7 +34,7 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.7 import QtQuick.Templates 2.0 as T import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material.impl 2.0 @@ -59,11 +59,16 @@ T.TabBar { spacing: control.spacing orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded snapMode: ListView.SnapToItem highlightMoveDuration: 250 highlightResizeDuration: 0 highlightFollowsCurrentItem: true + highlightRangeMode: ListView.ApplyRange + preferredHighlightBegin: 48 + preferredHighlightEnd: width - 48 + highlight: Item { z: 2 Rectangle { |