mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 06:33:09 +00:00
homescreens/halcyon: Fix favorites delegate so it doesn't stretch beyond visual boundary
f
This commit is contained in:
parent
fbc644fced
commit
d3054b1983
1 changed files with 33 additions and 30 deletions
|
|
@ -17,7 +17,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
|
|
||||||
MouseArea {
|
Item {
|
||||||
id: delegate
|
id: delegate
|
||||||
property int visualIndex: 0
|
property int visualIndex: 0
|
||||||
|
|
||||||
|
|
@ -39,6 +39,12 @@ MouseArea {
|
||||||
|
|
||||||
signal folderOpenRequested()
|
signal folderOpenRequested()
|
||||||
|
|
||||||
|
property alias drag: mouseArea.drag
|
||||||
|
Drag.active: delegate.drag.active
|
||||||
|
Drag.source: delegate
|
||||||
|
Drag.hotSpot.x: delegate.width / 2
|
||||||
|
Drag.hotSpot.y: delegate.height / 2
|
||||||
|
|
||||||
function openContextMenu() {
|
function openContextMenu() {
|
||||||
dialogLoader.active = true;
|
dialogLoader.active = true;
|
||||||
dialogLoader.item.open();
|
dialogLoader.item.open();
|
||||||
|
|
@ -70,28 +76,6 @@ MouseArea {
|
||||||
application.runApplication();
|
application.runApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool inDrag: false
|
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
||||||
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launch();
|
|
||||||
onReleased: {
|
|
||||||
parent.Drag.drop();
|
|
||||||
inDrag = false;
|
|
||||||
}
|
|
||||||
onPressAndHold: { inDrag = true; openContextMenu() }
|
|
||||||
|
|
||||||
drag.target: inDrag ? delegate : undefined
|
|
||||||
Drag.active: delegate.drag.active
|
|
||||||
Drag.source: delegate
|
|
||||||
Drag.hotSpot.x: delegate.width / 2
|
|
||||||
Drag.hotSpot.y: delegate.height / 2
|
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
id: hoverHandler
|
|
||||||
acceptedDevices: PointerDevice.Mouse
|
|
||||||
acceptedPointerTypes: PointerDevice.GenericPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: dialogLoader
|
id: dialogLoader
|
||||||
active: false
|
active: false
|
||||||
|
|
@ -111,25 +95,44 @@ MouseArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
MouseArea {
|
||||||
id: baseItem
|
id: mouseArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: delegate.leftPadding
|
||||||
|
anchors.rightMargin: delegate.rightPadding
|
||||||
|
|
||||||
|
property bool inDrag: false
|
||||||
|
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launch();
|
||||||
|
onReleased: {
|
||||||
|
delegate.parent.Drag.drop();
|
||||||
|
inDrag = false;
|
||||||
|
}
|
||||||
|
onPressAndHold: { inDrag = true; openContextMenu() }
|
||||||
|
|
||||||
|
drag.target: inDrag ? delegate : undefined
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: hoverHandler
|
||||||
|
acceptedDevices: PointerDevice.Mouse
|
||||||
|
acceptedPointerTypes: PointerDevice.GenericPointer
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: delegate.leftPadding
|
|
||||||
anchors.rightMargin: delegate.rightPadding
|
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (hoverHandler.hovered ? Qt.rgba(255, 255, 255, 0.1) : "transparent")
|
color: mouseArea.pressed ? Qt.rgba(255, 255, 255, 0.2) : (hoverHandler.hovered ? Qt.rgba(255, 255, 255, 0.1) : "transparent")
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
leftMargin: PlasmaCore.Units.smallSpacing * 2 + delegate.leftPadding
|
leftMargin: PlasmaCore.Units.smallSpacing * 2
|
||||||
topMargin: PlasmaCore.Units.smallSpacing
|
topMargin: PlasmaCore.Units.smallSpacing
|
||||||
rightMargin: PlasmaCore.Units.smallSpacing * 2 + delegate.rightPadding
|
rightMargin: PlasmaCore.Units.smallSpacing * 2
|
||||||
bottomMargin: PlasmaCore.Units.smallSpacing
|
bottomMargin: PlasmaCore.Units.smallSpacing
|
||||||
}
|
}
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue