diff --git a/examples/quick/controls/gallery/content/Styles.qml b/examples/quick/controls/gallery/content/Styles.qml index b5e98f8043df67fb505a80e4b70a94864e3b34d2..a65f30242b81eb472d7f060cf2f4a638a382bd8a 100644 --- a/examples/quick/controls/gallery/content/Styles.qml +++ b/examples/quick/controls/gallery/content/Styles.qml @@ -258,13 +258,13 @@ Item { BorderImage { id: image anchors.fill: parent - source: tab.selected ? "../images/tab_selected.png" : "../images/tab.png" + source: styleData.selected ? "../images/tab_selected.png" : "../images/tab.png" border.left: 50 smooth: false border.right: 50 } Text { - text: tab.title + text: styleData.title anchors.centerIn: parent } } diff --git a/examples/quick/controls/touch/content/TabBarPage.qml b/examples/quick/controls/touch/content/TabBarPage.qml index c96314be7791bae0201a8035e8bfe23b822e6dcf..7651a3c1af4f613b0adaf9d6d5cb70a0c3b94f89 100644 --- a/examples/quick/controls/touch/content/TabBarPage.qml +++ b/examples/quick/controls/touch/content/TabBarPage.qml @@ -80,11 +80,11 @@ Item { anchors.fill: parent border.bottom: 8 border.top: 8 - source: tab.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" + source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" Text { anchors.centerIn: parent color: "white" - text: tab.title.toUpperCase() + text: styleData.title.toUpperCase() font.pixelSize: 16 } Rectangle { diff --git a/src/private/TabBar.qml b/src/private/TabBar.qml index 49b10584d661619728d55246cae20d7d69149792..aa1f919bebca4217af50b7ef15c15ea3fb4567ab 100644 --- a/src/private/TabBar.qml +++ b/src/private/TabBar.qml @@ -195,7 +195,7 @@ FocusScope { property int index: tabindex property real availableWidth: tabbar.availableWidth - property QtObject tab: QtObject { + property QtObject styleData: QtObject { readonly property alias index: tabitem.tabindex readonly property alias selected: tabitem.selected readonly property alias title: tabitem.title diff --git a/src/styles/Base/TabViewStyle.qml b/src/styles/Base/TabViewStyle.qml index dfe1e4e985927992e190a36342b34831701c90c0..91750ba9cf72aa16d8863aa7fd08ff4d49b6b60a 100644 --- a/src/styles/Base/TabViewStyle.qml +++ b/src/styles/Base/TabViewStyle.qml @@ -59,7 +59,7 @@ import QtQuick.Controls.Private 1.0 style: TabViewStyle { frameOverlap: 1 tab: Rectangle { - color: tab.selected ? "steelblue" :"lightsteelblue" + color: styleData.selected ? "steelblue" :"lightsteelblue" border.color: "steelblue" implicitWidth: Math.max(text.width + 4, 80) implicitHeight: 20 @@ -67,8 +67,8 @@ import QtQuick.Controls.Private 1.0 Text { id: text anchors.centerIn: parent - text: tab.title - color: tab.selected ? "white" : "black" + text: styleData.title + color: styleData.selected ? "white" : "black" } } frame: Rectangle { color: "steelblue" } @@ -119,16 +119,16 @@ Style { } /*! This defines the tab. You can access the tab state through the - \c tab property, with the following properties: + \c styleData property, with the following properties: \table - \li readonly property int index - This is the current tab index. - \li readonly property bool selected - This is the active tab. - \li readonly property string title - Tab title text. - \li readonly property bool nextSelected - The next tab is selected. - \li readonly property bool previousSelected - The previous tab is selected. - \li readonly property bool hovered - The tab is currently under the mouse. - \li readonly property bool activeFocus - The tab button has keyboard focus. + \li readonly property int styleData.index - This is the current tab index. + \li readonly property bool styleData.selected - This is the active tab. + \li readonly property string styleData.title - Tab title text. + \li readonly property bool styleData.nextSelected - The next tab is selected. + \li readonly property bool styleData.previousSelected - The previous tab is selected. + \li readonly property bool styleData.hovered - The tab is currently under the mouse. + \li readonly property bool styleData.activeFocus - The tab button has keyboard focus. \endtable */ property Component tab: Item { @@ -143,16 +143,16 @@ Style { clip: true Item { anchors.fill: parent - anchors.bottomMargin: tab.selected ? 0 : 2 + anchors.bottomMargin: styleData.selected ? 0 : 2 clip: true BorderImage { anchors.fill: parent - source: tab.selected ? "images/tab_selected.png" : "images/tab.png" + source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" border.top: 6 border.bottom: 6 border.left: 6 border.right: 6 - anchors.topMargin: tab.selected ? 0 : 1 + anchors.topMargin: styleData.selected ? 0 : 1 } BorderImage { anchors.fill: parent @@ -160,7 +160,7 @@ Style { anchors.leftMargin: -2 anchors.rightMargin: -1 source: "images/focusframe.png" - visible: tab.activeFocus && tab.selected + visible: styleData.activeFocus && styleData.selected border.left: 4 border.right: 4 border.top: 4 @@ -170,7 +170,7 @@ Style { Text { id: textitem anchors.centerIn: parent - text: tab.title + text: styleData.title renderType: Text.NativeRendering scale: control.tabPosition === Qt.TopEdge ? 1 : -1 color: __syspal.text diff --git a/src/styles/Desktop/TabViewStyle.qml b/src/styles/Desktop/TabViewStyle.qml index 455b99dbe653d76b3a385d990e2632d5021577a3..b28300e2e90c6710dd7bfec7f3b1d6720a66fd0e 100644 --- a/src/styles/Desktop/TabViewStyle.qml +++ b/src/styles/Desktop/TabViewStyle.qml @@ -74,13 +74,13 @@ Style { property Component tab: Item { id: item property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle" - property string selectedpos: tab.nextSelected ? "next" : tab.previousSelected ? "previous" : "" + property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : "" property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom" property int tabHSpace: __barstyle.pixelMetric("tabhspace"); property int tabVSpace: __barstyle.pixelMetric("tabvspace"); property int totalOverlap: tabOverlap * (control.count - 1) property real maxTabWidth: (control.width + totalOverlap) / control.count - implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(tab.title)) + tabHSpace + 2) + implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2) implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) StyleItem { @@ -97,9 +97,9 @@ Style { properties: { "hasFrame" : true } hints: [orientation, tabpos, selectedpos] - selected: tab.selected - text: elidedText(tab.title, tabbarItem.elide, item.width - item.tabHSpace) - hover: tab.hovered + selected: styleData.selected + text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace) + hover: styleData.hovered hasFocus: tabbarItem.activeFocus && selected } }