refactor: tabbar

pull/10/head
kateleet 3 years ago
parent 7939ac69be
commit f804cbcd96

@ -92,27 +92,22 @@ FishUI.Window {
id: _tabbar id: _tabbar
anchors.fill: parent anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing / 2 anchors.margins: FishUI.Units.smallSpacing / 2
anchors.rightMargin: FishUI.Units.largeSpacing * 2 anchors.rightMargin: FishUI.Units.largeSpacing * 4
currentIndex : _tabView.currentIndex currentIndex: _tabView.currentIndex
model: _tabView.count
onNewTabClicked: openNewTab() onNewTabClicked: openNewTab()
Repeater { delegate: FishUI.TabButton {
id: _repeater
model: _tabView.count
FishUI.TabButton {
id: _tabBtn id: _tabBtn
text: _tabView.contentModel.get(index).title text: _tabView.contentModel.get(index).title
implicitHeight: parent.height Layout.fillHeight: true
// implicitWidth: _repeater.count === 1 ? 200 height: _tabbar.height - FishUI.Units.smallSpacing / 2
// : parent.width / _repeater.count width: Math.min(_tabbar.width / _tabbar.count,
_tabBtn.contentWidth)
implicitWidth: Math.min(_tabBtn.contentWidth,
parent.width / _repeater.count)
ToolTip.delay: 1000 ToolTip.delay: 500
ToolTip.timeout: 5000 ToolTip.timeout: 5000
checked: _tabView.currentIndex === index checked: _tabView.currentIndex === index
@ -132,7 +127,42 @@ FishUI.Window {
root.closeProtection(index) root.closeProtection(index)
} }
} }
}
// Repeater {
// id: _repeater
// model: _tabView.count
// FishUI.TabButton {
// id: _tabBtn
// text: _tabView.contentModel.get(index).title
// implicitHeight: parent.height
//// implicitWidth: _repeater.count === 1 ? 200
//// : parent.width / _repeater.count
// implicitWidth: Math.min(_tabBtn.contentWidth,
// parent.width / _repeater.count)
// ToolTip.delay: 1000
// ToolTip.timeout: 5000
// checked: _tabView.currentIndex === index
// font.pointSize: 9
// font.family: "Noto Sans Mono"
// ToolTip.visible: hovered
// ToolTip.text: _tabView.contentModel.get(index).title
// onClicked: {
// _tabView.currentIndex = index
// _tabView.currentItem.forceActiveFocus()
// }
// onCloseClicked: {
// root.closeProtection(index)
// }
// }
// }
} }
} }

Loading…
Cancel
Save