1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 15:02:50 -05:00

uncomment toast, and format

This commit is contained in:
bbedward
2025-07-24 19:46:05 -04:00
parent 762785b27a
commit fc52aa2c7a
21 changed files with 575 additions and 427 deletions

View File

@@ -20,32 +20,29 @@ ScrollView {
property real wheelStepSize: 60
property bool hoverUpdatesSelection: true
property bool keyboardNavigationActive: false
signal keyboardNavigationReset()
signal keyboardNavigationReset()
signal itemClicked(int index, var modelData)
signal itemHovered(int index)
// Ensure the current item is visible
function ensureVisible(index) {
if (index < 0 || index >= grid.count) return;
if (index < 0 || index >= grid.count)
return ;
var itemY = Math.floor(index / grid.actualColumns) * grid.cellHeight;
var itemBottom = itemY + grid.cellHeight;
if (itemY < grid.contentY) {
if (itemY < grid.contentY)
grid.contentY = itemY;
} else if (itemBottom > grid.contentY + grid.height) {
else if (itemBottom > grid.contentY + grid.height)
grid.contentY = itemBottom - grid.height;
}
}
onCurrentIndexChanged: {
if (keyboardNavigationActive) {
if (keyboardNavigationActive)
ensureVisible(currentIndex);
}
}
}
clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
@@ -157,9 +154,9 @@ ScrollView {
cursorShape: Qt.PointingHandCursor
z: 10
onEntered: {
if (hoverUpdatesSelection && !keyboardNavigationActive) {
if (hoverUpdatesSelection && !keyboardNavigationActive)
currentIndex = index;
}
itemHovered(index);
}
onPositionChanged: {