summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/controls/Private/TabBar.qml2
-rw-r--r--src/controls/Styles/Base/TabViewStyle.qml5
-rw-r--r--src/controls/Styles/Desktop/TabViewStyle.qml1
-rw-r--r--tests/auto/controls/data/tst_tabview.qml15
4 files changed, 23 insertions, 0 deletions
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml
index 2e374f99..06bcc2be 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -164,6 +164,7 @@ FocusScope {
objectName: "mousearea"
hoverEnabled: true
focus: true
+ enabled: modelData.enabled
Binding {
target: tabbar
@@ -218,6 +219,7 @@ FocusScope {
readonly property alias nextSelected: tabitem.nextSelected
readonly property alias previsousSelected: tabitem.previousSelected
readonly property alias hovered: tabitem.containsMouse
+ readonly property alias enabled: tabitem.enabled
readonly property bool activeFocus: tabbar.activeFocus
readonly property real availableWidth: tabbar.availableWidth
}
diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml
index 29364bbb..ce00da5f 100644
--- a/src/controls/Styles/Base/TabViewStyle.qml
+++ b/src/controls/Styles/Base/TabViewStyle.qml
@@ -129,6 +129,7 @@ Style {
\row \li readonly property bool \b styleData.nextSelected \li The next tab is selected.
\row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected.
\row \li readonly property bool \b styleData.hovered \li The tab is being hovered.
+ \row \li readonly property bool \b styleData.enabled \li The tab is enabled. (since QtQuick.Controls.Styles 1.2)
\row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus.
\row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs.
\endtable
@@ -166,6 +167,10 @@ Style {
elide: Text.ElideMiddle
renderType: Text.NativeRendering
scale: control.tabPosition === Qt.TopEdge ? 1 : -1
+ property var __syspal: SystemPalette {
+ colorGroup: styleData.enabled ?
+ SystemPalette.Active : SystemPalette.Disabled
+ }
color: __syspal.text
Rectangle {
anchors.centerIn: parent
diff --git a/src/controls/Styles/Desktop/TabViewStyle.qml b/src/controls/Styles/Desktop/TabViewStyle.qml
index cf61a4d1..f20c32cd 100644
--- a/src/controls/Styles/Desktop/TabViewStyle.qml
+++ b/src/controls/Styles/Desktop/TabViewStyle.qml
@@ -103,6 +103,7 @@ Style {
properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos }
hints: control.styleHints
+ enabled: styleData.enabled
selected: styleData.selected
text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace)
hover: styleData.hovered
diff --git a/tests/auto/controls/data/tst_tabview.qml b/tests/auto/controls/data/tst_tabview.qml
index 1648d6c3..635680ac 100644
--- a/tests/auto/controls/data/tst_tabview.qml
+++ b/tests/auto/controls/data/tst_tabview.qml
@@ -390,6 +390,21 @@ TestCase {
verify(!tab3.activeFocus)
verify(!textField.activeFocus)
+ compare(tabView.currentIndex, 2)
+ tab1.enabled = false
+ mouseClick(tab1, tab1.width/2, tab1.height/2)
+ compare(tabView.currentIndex, 2)
+ mouseClick(tab2, tab2.width/2, tab2.height/2)
+ compare(tabView.currentIndex, 1)
+ tab2.enabled = false
+ compare(tabView.currentIndex, 1)
+ tab1.enabled = true
+ mouseClick(tab1, tab1.width/2, tab1.height/2)
+ compare(tabView.currentIndex, 0)
+ tab2.enabled = true
+ mouseClick(tab2, tab2.width/2, tab2.height/2)
+ compare(tabView.currentIndex, 1)
+
item.destroy()
}