diff --git a/components/TabFrame.qml b/components/TabFrame.qml index 841e9659e638eee6e7bc20519fb73ec88f659e91..47e1a40d83a4a89855e78d08d40e81e69a160eb7 100644 --- a/components/TabFrame.qml +++ b/components/TabFrame.qml @@ -5,23 +5,16 @@ Item { id: tabWidget width: 100 height: 100 - focus: true - property TabBar tabbar property int current: 0 property int count: stack.children.length property bool frame:true property bool tabsVisible: true property string position: "North" default property alias tabs : stack.children + property Item tabBar: tabbarItem onCurrentChanged: __setOpacities() Component.onCompleted: __setOpacities() - onTabbarChanged: { - tabbar.tabFrame = tabWidget - tabbar.anchors.top = tabWidget.top - tabbar.anchors.left = tabWidget.left - tabbar.anchors.right = tabWidget.right - } property int __baseOverlap : frameitem.pixelMetric("tabbaseoverlap")// add paintmargins; function __setOpacities() { @@ -48,9 +41,9 @@ Item { z: style == "oxygen" ? 1 : 0 elementType: "tabframe" info: position - value: tabbar && tabsVisible && tabbar.tab(current) ? tabbar.tab(current).x : 0 - minimum: tabbar && tabsVisible && tabbar.tab(current) ? tabbar.tab(current).width : 0 - maximum: tabbar && tabsVisible ? tabbar.tabWidth : width + value: tabbarItem && tabsVisible && tabbarItem.tab(current) ? tabbarItem.tab(current).x : 0 + minimum: tabbarItem && tabsVisible && tabbarItem.tab(current) ? tabbarItem.tab(current).width : 0 + maximum: tabbarItem && tabsVisible ? tabbarItem.tabWidth : width anchors.fill: parent property int frameWidth: pixelMetric("defaultframewidth") @@ -63,27 +56,34 @@ Item { anchors.bottomMargin: anchors.margins + (frameitem.style =="mac" ? 6 : 0) } - anchors.topMargin: tabbar && tabsVisible && position == "North" ? tabbar.height - __baseOverlap : 0 + anchors.topMargin: tabbarItem && tabsVisible && position == "North" ? tabbarItem.height - __baseOverlap : 0 states: [ State { name: "South" - when: position == "South" && tabbar!= undefined + when: position == "South" && tabbarItem!= undefined PropertyChanges { target: frameitem anchors.topMargin: 0 - anchors.bottomMargin: tabbar ? tabbar.height - __baseOverlap: 0 + anchors.bottomMargin: tabbarItem ? tabbarItem.height - __baseOverlap: 0 } PropertyChanges { - target: tabbar + target: tabbarItem anchors.topMargin: -__baseOverlap } AnchorChanges { - target: tabbar + target: tabbarItem anchors.top: frameitem.bottom anchors.bottom: undefined } } ] } + TabBar { + id: tabbarItem + tabFrame: tabWidget + anchors.top: tabWidget.top + anchors.left: tabWidget.left + anchors.right: tabWidget.right + } } diff --git a/examples/Browser.qml b/examples/Browser.qml index 4b2d79442e80fa86a97e139ef5093395f6dcafe4..e4295003e9f629c00d31ff520dcda920eb4e1106 100644 --- a/examples/Browser.qml +++ b/examples/Browser.qml @@ -172,7 +172,6 @@ Rectangle { TabFrame { id:frame - tabbar: TabBar{parent:frame} anchors.top:toolbar.bottom anchors.bottom:parent.bottom anchors.right:parent.right diff --git a/examples/Gallery.qml b/examples/Gallery.qml index 4eee50e46e36d8d31656ee8d88be7f597374b8a2..604729ab6db52ab61b27ebea3e8c2689d1b7b6e8 100644 --- a/examples/Gallery.qml +++ b/examples/Gallery.qml @@ -208,7 +208,6 @@ Rectangle { TabFrame { id:frame - tabbar: TabBar{parent: frame; KeyNavigation.tab:button1} position: tabPositionGroup.checkedButton == r2 ? "South" : "North" KeyNavigation.tab:button1 KeyNavigation.backtab: button2 @@ -241,7 +240,7 @@ Rectangle { width: 96 tooltip:"This is an interesting tool tip" KeyNavigation.tab: button2 - KeyNavigation.backtab: frame.tabbar + KeyNavigation.backtab: frame.tabBar } Button { id:button2 diff --git a/examples/TableViewGallery.qml b/examples/TableViewGallery.qml index 41a966c3c1a1f2cc516fdc8a6f2633c21a27da85..21d92687f89ac6fc6b295ea97f52ef529380984f 100644 --- a/examples/TableViewGallery.qml +++ b/examples/TableViewGallery.qml @@ -6,7 +6,7 @@ Rectangle { width: 538 + frame.margins * 2 height: 360 + frame.margins * 2 - ToolBar{ + ToolBar { id: toolbar width: parent.width height: 40 @@ -75,7 +75,6 @@ Rectangle { id:frame focus:true enabled: toolbar.enabled - tabbar: TabBar{parent: frame} property int margins : styleitem.style == "mac" ? 16 : 0 height: parent.height - 34