-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.4
If a tabbutton is anchored wrt its parent (tabBar), it gives a warning when removed from tab.
TabBar {
id: tabBar
width: 500
height: 44
anchors.top: parent.top
background: Rectangle {
color: "gray"
}
TabButton {
id: defaultTab
width: 120
height: tabBar.height
anchors.top: parent.top // If user comments this, tabbutton will not be positioned correctly.
/** background rectangle for default tab */
background: Rectangle {
id: tabBackground
border.color: (defaultTab.activeFocus ||
defaultTab.hovered) ?
"blue" : "red"
border.width: 1
color: "yellow"
}
}
}
Button {
id: button
width: 50
height: 50
text: "close"
anchors.centerIn:parent
onClicked:{
tabBar.removeItem(tabBar.itemAt(tabBar.currentIndex));
}
}
Warning is generated for anchors.top: parent.top:
TypeError: Cannot read property 'top' of null
As a workaround user can set implicitHeight and comment the anchor settings, which will prevent the warning and will position the tabbutton correctly.
But there should not be such warning.