diff options
Diffstat (limited to 'src/styles/Base/TabViewStyle.qml')
-rw-r--r-- | src/styles/Base/TabViewStyle.qml | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/styles/Base/TabViewStyle.qml b/src/styles/Base/TabViewStyle.qml index dfe1e4e9..f5cd1047 100644 --- a/src/styles/Base/TabViewStyle.qml +++ b/src/styles/Base/TabViewStyle.qml @@ -45,6 +45,7 @@ import QtQuick.Controls.Private 1.0 \qmltype TabViewStyle \inqmlmodule QtQuick.Controls.Styles 1.0 \since QtQuick.Controls.Styles 1.0 + \ingroup viewsstyling \brief Provides custom styling for TabView \qml @@ -59,7 +60,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 +68,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,23 +120,24 @@ 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. + \row \li readonly property int \b styleData.index \li This is the current tab index. + \row \li readonly property bool \b styleData.selected \li This is the active tab. + \row \li readonly property string \b styleData.title \li Tab title text. + \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.activeFocus \li The tab button has keyboard focus. + \row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs. \endtable */ property Component tab: Item { scale: control.tabPosition === Qt.TopEdge ? 1 : -1 property int totalOverlap: tabOverlap * (control.count - 1) - property real maxTabWidth: (availableWidth + totalOverlap) / control.count + property real maxTabWidth: (styleData.availableWidth + totalOverlap) / control.count implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20)) implicitHeight: Math.round(textitem.implicitHeight + 10) @@ -143,16 +145,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 +162,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 +172,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 |