diff --git a/examples/gallery/content/Controls.qml b/examples/gallery/content/Controls.qml index ff4c370a9a3f9f4364243c0c1f765ebfbe2602b2..2c6b874031912227cea7c9c8d287df561ea4cae8 100644 --- a/examples/gallery/content/Controls.qml +++ b/examples/gallery/content/Controls.qml @@ -51,7 +51,7 @@ Item { anchors.fill: parent enabled: enabledCheck.checked - property string tabPosition: tabPositionGroup.current === r2 ? "Bottom" : "Top" + property int tabPosition: tabPositionGroup.current === r2 ? Qt.BottomEdge : Qt.TopEdge Row { id: contentRow @@ -163,7 +163,7 @@ Item { Row { RadioButton { id: r1 - text: "North" + text: "Top" KeyNavigation.tab: r2 checked: true exclusiveGroup: tabPositionGroup @@ -171,7 +171,7 @@ Item { } RadioButton { id: r2 - text: "South" + text: "Bottom" KeyNavigation.tab: area exclusiveGroup: tabPositionGroup } diff --git a/examples/gallery/main.qml b/examples/gallery/main.qml index 911cbe1d83c5883ee60c0867d0da4a81dd03f6a0..113772049e85b3700eeb1e2e9b566eae9e915165 100644 --- a/examples/gallery/main.qml +++ b/examples/gallery/main.qml @@ -266,7 +266,7 @@ ApplicationWindow { TabView { id:frame enabled: enabledCheck.checked - tabPosition: controlPage.item ? controlPage.item.tabPosition : "Top" + tabPosition: controlPage.item ? controlPage.item.tabPosition : Qt.TopEdge anchors.top: toolbar.bottom anchors.bottom: parent.bottom anchors.right: parent.right diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index c8e4b7a64f1e1a70dc6a176745bb7698c94a8cb7..b269c7c77e8810903d334a32b1bd4eda6b017a3e 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -69,14 +69,14 @@ FocusScope { property bool tabsVisible: true /*! - \qmlproperty string TabView::tabPosition + \qmlproperty enumeration TabView::tabPosition \list - \li "Top" (default) - \li "Bottom" + \li Qt.TopEdge (default) + \li Qt.BottomEdge \endlist */ - property string tabPosition: "Top" + property int tabPosition: Qt.TopEdge /*! \internal */ default property alias data: stack.data @@ -169,8 +169,8 @@ FocusScope { z: tabbarItem.z - 1 anchors.fill: parent - anchors.topMargin: tabbarItem && tabsVisible && tabPosition == "Top" ? Math.max(0, tabbarItem.height - stack.baseOverlap) : 0 - anchors.bottomMargin: tabbarItem && tabsVisible && tabPosition == "Bottom" ? Math.max(0, tabbarItem.height - stack.baseOverlap) : 0 + anchors.topMargin: tabbarItem && tabsVisible && tabPosition == Qt.TopEdge ? Math.max(0, tabbarItem.height - stack.baseOverlap) : 0 + anchors.bottomMargin: tabbarItem && tabsVisible && tabPosition == Qt.BottomEdge ? Math.max(0, tabbarItem.height - stack.baseOverlap) : 0 sourceComponent: frameVisible && loader.item ? loader.item.frame : null property var control: root @@ -201,7 +201,7 @@ FocusScope { states: [ State { name: "Bottom" - when: tabPosition == "Bottom" && tabbarItem != undefined + when: tabPosition == Qt.BottomEdge && tabbarItem != undefined PropertyChanges { target: tabbarItem anchors.topMargin: tabbarItem.height diff --git a/src/styles/Desktop/TabViewStyle.qml b/src/styles/Desktop/TabViewStyle.qml index 1ec473d8164c42e9e6742761c09dc4014a0a51f8..d2ba2280fa23a22aecabab56a7015138e764b46b 100644 --- a/src/styles/Desktop/TabViewStyle.qml +++ b/src/styles/Desktop/TabViewStyle.qml @@ -51,6 +51,7 @@ Style { property string tabBarAlignment: __barstyle.styleHint("tabbaralignment"); property int tabOverlap: __barstyle.pixelMetric("taboverlap"); property int tabBaseOverlap: __barstyle.pixelMetric("tabbaseoverlap"); + property string tabPosition: control.tabPosition == Qt.TopEdge ? "Top" : "Bottom" property Component frame: StyleItem { id: styleitem @@ -58,7 +59,7 @@ Style { anchors.topMargin: 1//stack.baseOverlap z: style == "oxygen" ? 1 : 0 elementType: "tabframe" - hints: control.tabPosition + hints: tabPosition value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0 minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0 maximum: tabbarItem && tabsVisible ? tabbarItem.width : width @@ -85,7 +86,7 @@ Style { anchors.fill: parent anchors.leftMargin: (selected && style == "mac") ? -1 : 0 - hints: [control.tabsPosition, tabpos, selectedpos] + hints: [tabPosition, tabpos, selectedpos] selected: tab.selected text: title