mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-23 19:54:02 -04:00
1 parent
be9aeaefbc
commit
fc42786fec
1 file changed
+19
@@ -55,6 +55,16 @@ Rectangle {
|
||||
autoExpandForTab(keyboardHighlightIndex);
|
||||
}
|
||||
|
||||
function ensureRowVisible(item) {
|
||||
if (!item || sidebarFlickable.height <= 0)
|
||||
return;
|
||||
const itemY = item.mapToItem(sidebarFlickable.contentItem, 0, 0).y;
|
||||
const viewH = sidebarFlickable.height;
|
||||
if (itemY >= sidebarFlickable.contentY && itemY + item.height <= sidebarFlickable.contentY + viewH)
|
||||
return;
|
||||
sidebarFlickable.contentY = Math.max(0, Math.min(itemY - viewH / 4, sidebarFlickable.contentHeight - viewH));
|
||||
}
|
||||
|
||||
function selectHighlighted() {
|
||||
if (keyboardHighlightIndex < 0)
|
||||
return;
|
||||
@@ -723,6 +733,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
id: sidebarFlickable
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentHeight: sidebarColumn.height
|
||||
@@ -974,6 +985,10 @@ Rectangle {
|
||||
readonly property bool hasTab: categoryDelegate.modelData.tabIndex !== undefined && !categoryDelegate.modelData.children
|
||||
readonly property bool isActive: hasTab && root.currentIndex === categoryDelegate.modelData.tabIndex
|
||||
readonly property bool isHighlighted: hasTab && root.keyboardHighlightIndex === categoryDelegate.modelData.tabIndex
|
||||
onIsHighlightedChanged: {
|
||||
if (isHighlighted)
|
||||
Qt.callLater(root.ensureRowVisible, categoryRow);
|
||||
}
|
||||
|
||||
color: {
|
||||
if (isActive)
|
||||
@@ -1069,6 +1084,10 @@ Rectangle {
|
||||
|
||||
readonly property bool isActive: root.currentIndex === modelData.tabIndex
|
||||
readonly property bool isHighlighted: root.keyboardHighlightIndex === modelData.tabIndex
|
||||
onIsHighlightedChanged: {
|
||||
if (isHighlighted)
|
||||
Qt.callLater(root.ensureRowVisible, childDelegate);
|
||||
}
|
||||
|
||||
width: childrenColumn.width
|
||||
height: Math.max(Theme.iconSize - 4, Theme.fontSizeSmall + 1) + Theme.spacingS * 2
|
||||
|
||||
Reference in new issue
Block a user