mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
listview: workaround delegates overlapping and make spotlight launcher
have a stable anchor
port 1.5
(cherry picked from commit 2cb48aaf6b)
This commit is contained in:
@@ -32,21 +32,12 @@ Singleton {
|
||||
PauseAnimation {
|
||||
duration: Math.max(0, Math.min(addTransition.ViewTransition.index - (addTransition.ViewTransition.targetIndexes[0] ?? 0), root._staggerCap)) * root._staggerMs
|
||||
}
|
||||
ParallelAnimation {
|
||||
DankAnim {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: Theme.expressiveDurations.fast
|
||||
easing.bezierCurve: Theme.expressiveCurves.emphasizedDecel
|
||||
}
|
||||
DankAnim {
|
||||
property: "y"
|
||||
from: addTransition.ViewTransition.destination.y + Theme.spacingS
|
||||
to: addTransition.ViewTransition.destination.y
|
||||
duration: Theme.expressiveDurations.fast
|
||||
easing.bezierCurve: Theme.expressiveCurves.emphasizedDecel
|
||||
}
|
||||
DankAnim {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: Theme.expressiveDurations.fast
|
||||
easing.bezierCurve: Theme.expressiveCurves.emphasizedDecel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,20 +217,6 @@ Item {
|
||||
pressDelay: 0
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "snap"
|
||||
when: Theme.snapListModelChanges
|
||||
PropertyChanges {
|
||||
target: clipboardListView
|
||||
add: null
|
||||
remove: null
|
||||
displaced: null
|
||||
move: null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= count) {
|
||||
return;
|
||||
@@ -293,20 +279,6 @@ Item {
|
||||
pressDelay: 0
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "snap"
|
||||
when: Theme.snapListModelChanges
|
||||
PropertyChanges {
|
||||
target: savedListView
|
||||
add: null
|
||||
remove: null
|
||||
displaced: null
|
||||
move: null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= count) {
|
||||
return;
|
||||
|
||||
@@ -362,11 +362,12 @@ Item {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: KeyboardFocus.keyboardFocus(keyboardActive, null)
|
||||
|
||||
// Anchored top+bottom: dynamic layer-surface resizes misbehave on some compositors
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: root.useSingleWindow
|
||||
bottom: root.useSingleWindow
|
||||
bottom: true
|
||||
}
|
||||
|
||||
WlrLayershell.margins {
|
||||
@@ -377,7 +378,6 @@ Item {
|
||||
}
|
||||
|
||||
implicitWidth: root.useSingleWindow ? 0 : root.windowWidth
|
||||
implicitHeight: root.useSingleWindow ? 0 : root.windowHeight
|
||||
|
||||
mask: Region {
|
||||
item: inputMask
|
||||
|
||||
@@ -301,20 +301,6 @@ Item {
|
||||
clip: true
|
||||
spacing: Theme.spacingXXS
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "snap"
|
||||
when: Theme.snapListModelChanges
|
||||
PropertyChanges {
|
||||
target: processListView
|
||||
add: null
|
||||
remove: null
|
||||
displaced: null
|
||||
move: null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
model: ScriptModel {
|
||||
values: root.cachedProcesses
|
||||
objectProp: "pid"
|
||||
|
||||
@@ -28,6 +28,70 @@ ListView {
|
||||
displaced: ListViewTransitions.displaced
|
||||
move: ListViewTransitions.move
|
||||
|
||||
// QQmlDelegateModel can release a delegate back to its cache without hiding it,
|
||||
// leaving a stale row painted over live ones. Hide anything the view no longer claims.
|
||||
Connections {
|
||||
target: listView.model?.objectName !== undefined ? listView.model : null
|
||||
ignoreUnknownSignals: true
|
||||
function onRowsInserted() {
|
||||
orphanSweep.arm();
|
||||
}
|
||||
function onRowsRemoved() {
|
||||
orphanSweep.arm();
|
||||
}
|
||||
function onRowsMoved() {
|
||||
orphanSweep.arm();
|
||||
}
|
||||
function onModelReset() {
|
||||
orphanSweep.arm();
|
||||
}
|
||||
}
|
||||
|
||||
FrameAnimation {
|
||||
id: orphanSweep
|
||||
|
||||
property int frames: 0
|
||||
|
||||
function arm() {
|
||||
frames = 0;
|
||||
running = true;
|
||||
}
|
||||
|
||||
onTriggered: {
|
||||
const kids = listView.contentItem.children;
|
||||
const rows = [];
|
||||
for (let i = 0; i < kids.length; i++) {
|
||||
const c = kids[i];
|
||||
if (!c || c.index === undefined)
|
||||
continue;
|
||||
const claimed = listView.itemAtIndex(c.index) === c;
|
||||
if (claimed && !c.visible) {
|
||||
c.visible = true;
|
||||
continue;
|
||||
}
|
||||
if (c.visible)
|
||||
rows.push({
|
||||
item: c,
|
||||
claimed: claimed
|
||||
});
|
||||
}
|
||||
for (let a = 0; a < rows.length; a++) {
|
||||
if (rows[a].claimed)
|
||||
continue;
|
||||
for (let b = 0; b < rows.length; b++) {
|
||||
if (a === b || !rows[b].claimed)
|
||||
continue;
|
||||
if (Math.abs(rows[a].item.y - rows[b].item.y) < rows[b].item.height / 2) {
|
||||
rows[a].item.visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (++frames >= 3)
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMovementStarted: {
|
||||
isUserScrolling = true;
|
||||
vbar._scrollBarActive = true;
|
||||
|
||||
Reference in New Issue
Block a user