ensure a tab is selected
This commit is contained in:
parent
322bf6ab6c
commit
faccd995e2
@ -90,6 +90,7 @@ FocusScope {
|
|||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: buttonFrame
|
id: buttonFrame
|
||||||
|
|
||||||
|
visible: currentTab !== null
|
||||||
x: currentTab.x + backgroundFrame.margins.left
|
x: currentTab.x + backgroundFrame.margins.left
|
||||||
y: backgroundFrame.margins.top
|
y: backgroundFrame.margins.top
|
||||||
width: currentTab.width + buttonFrame.margins.left + buttonFrame.margins.right
|
width: currentTab.width + buttonFrame.margins.left + buttonFrame.margins.right
|
||||||
@ -113,10 +114,5 @@ FocusScope {
|
|||||||
rightMargin: backgroundFrame.margins.right + buttonFrame.margins.right
|
rightMargin: backgroundFrame.margins.right + buttonFrame.margins.right
|
||||||
bottomMargin: backgroundFrame.margins.bottom + buttonFrame.margins.bottom
|
bottomMargin: backgroundFrame.margins.bottom + buttonFrame.margins.bottom
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
|
||||||
if (!root.currentTab) {
|
|
||||||
root.currentTab = tabBarLayout.children[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,16 @@ Item {
|
|||||||
}
|
}
|
||||||
root.implicitWidth = contentWidth
|
root.implicitWidth = contentWidth
|
||||||
root.implicitHeight = contentHeight
|
root.implicitHeight = contentHeight
|
||||||
|
if (root.parent.currentTab === null) {
|
||||||
|
//99% of the cases this loop will be length 1 but a tabbar can also have other children, such as Repeater
|
||||||
|
for (var i = 0; i < tabBarLayout.children.length; ++i) {
|
||||||
|
//anything with a checked property may act as tabbutton
|
||||||
|
if (tabBarLayout.children[i].checked !== undefined) {
|
||||||
|
root.parent.currentTab = tabBarLayout.children[i]
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user