10import org.kde.kirigami as Kirigami
15 readonly property Kirigami.PageRow pageRow: {
17 const pr = parent?.pageRow ?? null;
18 return pr as Kirigami.PageRow;
34 if (pageRow.layers.depth > 1) {
39 return pageRow.layers.depth - 2;
41 return pageRow.currentIndex;
47 function selectIndex(index:
int) {
51 if (pageRow.layers.depth > 1) {
56 while (pageRow.layers.depth > index + 2) {
60 pageRow.currentIndex = index;
66 orientation: ListView.Horizontal
67 boundsBehavior: Flickable.StopAtBounds
68 interactive: Kirigami.Settings.hasTransientTouchInput
75 const preferredPosition = currentItem.x + (currentItem.width - width) / 2;
79 if (LayoutMirroring.enabled) {
81 const maxLeftPosition = -contentWidth;
82 const minRightPosition = -width;
83 return Math.round(Math.min(minRightPosition, Math.max(preferredPosition, maxLeftPosition)));
85 const minLeftPosition = 0;
86 const maxRightPosition = contentWidth - width;
87 return Math.round(Math.max(minLeftPosition, Math.min(preferredPosition, maxRightPosition)));
91 Behavior on contentX {
93 duration: Kirigami.Units.longDuration
94 easing.type: Easing.InOutQuad
102 if (root.pageRow.layers.depth > 1) {
104 return root.pageRow.layers.depth - 1;
106 return root.pageRow.depth;
110 delegate: MouseArea {
113 required
property int index
117 readonly
property Item page: {
121 if (root.pageRow.layers.depth > 1) {
124 return pageRow.layers.get(index + 1);
126 return pageRow.get(index);
131 width: Math.ceil(layout.implicitWidth)
132 height: ListView.view?.
height ?? 0
134 hoverEnabled: !Kirigami.Settings.tabletMode
136 onClicked: mouse => {
137 root.selectIndex(index);
142 color: Kirigami.Theme.highlightColor
144 radius: Kirigami.Units.cornerRadius
145 opacity: root.count > 1 && parent.containsMouse ? 0.1 : 0
155 visible: delegate.index > 0
156 Layout.alignment:
Qt.AlignVCenter
157 Layout.preferredHeight: Kirigami.Units.iconSizes.small
158 Layout.preferredWidth: Kirigami.Units.iconSizes.small
160 color: Kirigami.Theme.textColor
161 source: LayoutMirroring.enabled ?
"go-next-symbolic-rtl" :
"go-next-symbolic"
164 Layout.leftMargin: Kirigami.Units.largeSpacing
165 Layout.rightMargin: Kirigami.Units.largeSpacing
166 color: Kirigami.Theme.textColor
167 verticalAlignment: Text.AlignVCenter
168 wrapMode: Text.NoWrap
169 text: delegate.page?.title ??
""
170 opacity: delegate.ListView.isCurrentItem ? 1 : 0.4