21import QtQuick.Controls
24import org.mauikit.controls as Maui
30 implicitWidth: implicitContentWidth + leftPadding + rightPadding
31 implicitHeight: implicitContentHeight + topPadding + bottomPadding
33 spacing: Maui.Style.space.medium
40 default property list<QtObject> items
45 property list<QtObject> hiddenItems
50 property int currentIndex : 0
55 readonly
property int count : control.items.length + control.hiddenItems.length
57 property int display: ToolButton.TextBesideIcon
61 signal clicked(
int index)
66 signal pressAndHold(
int index)
68 signal itemVisibilityChanged(
int index,
bool visible)
72 signal doubleClicked(
int index)
74 Behavior on implicitWidth
78 duration: Maui.Style.units.shortDuration
79 easing.type: Easing.InOutQuad
83 property Component delegate : ToolButton
88 visible: modelData.visible
89 onVisibleChanged: control.itemVisibilityChanged(index, visible)
90 checked: index === control.currentIndex
92 leftPadding: Maui.Style.space.big
93 rightPadding: Maui.Style.space.big
95 icon.name: modelData.Maui.Controls.iconName
96 text: modelData.Maui.Controls.title
98 display: checked ? (!isWide ? ToolButton.IconOnly : ToolButton.TextBesideIcon) : ToolButton.IconOnly
104 if(index === control.currentIndex )
109 control.currentIndex = index
110 control.clicked(index)
116 onEntered: control.currentIndex = index
120 contentItem: RowLayout
123 spacing: control.spacing
128 delegate: control.delegate
135 leftPadding: Maui.Style.space.big
136 rightPadding: Maui.Style.space.big
137 readonly
property QtObject obj : control.currentIndex >= control.items.length && control.currentIndex < control.count? control.hiddenItems[control.currentIndex - control.items.length] : null
139 visible: obj && obj.visible
142 icon.name: obj ? obj.Maui.Controls.iconName :
""
146 display: checked ? (!isWide ? ToolButton.IconOnly : ToolButton.TextBesideIcon) : ToolButton.IconOnly
148 text: obj ? obj.Maui.
Controls.title :
""
154 icon.name:
"overflow-menu"
155 visible: control.hiddenItems.length > 0
157 Layout.alignment:
Qt.AlignCenter
158 display: checked ? ToolButton.TextBesideIcon : ToolButton.IconOnly
160 Behavior on implicitWidth
164 duration: Maui.Style.units.shortDuration
165 easing.type: Easing.InOutQuad
171 model: control.hiddenItems
175 text: modelData.Maui.Controls.title
176 icon.name: modelData.Maui.Controls.iconName
179 checked: control.currentIndex === control.items.length + index
184 if(control.items.length + index === control.currentIndex)
189 control.currentIndex = control.items.length + index
190 control.clicked(control.currentIndex)