mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 06:52:50 -05:00
uncomment toast, and format
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user