cc: don't shift edit button slot, bump qml-common

This commit is contained in:
bbedward
2026-10-10 18:14:12 -04:00
parent 2cc720cf2d
commit f1ea842bca
8 changed files with 26 additions and 23 deletions
Generated
+3 -3
View File
@@ -3,11 +3,11 @@
"dank-qml-common": {
"flake": false,
"locked": {
"lastModified": 1791581769,
"narHash": "sha256-Q87fFPp2fysHdMrk2/sQ7+c+Sc2RZAQGKnAZWEEFOHQ=",
"lastModified": 1791670308,
"narHash": "sha256-vcAOSK+6buTddG8sJi8JOnaFfxSztmL8nOzsnUTzGd0=",
"owner": "AvengeMedia",
"repo": "dank-qml-common",
"rev": "9314fc4df5a90c95bddcda83d696a1fd8c895aea",
"rev": "50ca5ccb4913098b0b67807d9ff7f642e79067b0",
"type": "github"
},
"original": {
@@ -53,7 +53,9 @@ Item {
// Grid columns, so footer widths line up with the tiles above.
readonly property real spacing: CcMetrics.gridGap
readonly property real pitch: grid.cellWidth
readonly property real editActionsWidth: Theme.iconButtonSize * 3 + spacing * 2
readonly property real editActionsWidth: Theme.iconButtonSize * 2 + spacing
// The pencil turns into the check, so the row shrinks away from it and the same spot leaves edit mode.
readonly property bool editAtEnd: items.some(item => item.widget.id === WidgetUtils.EDIT_ID && WidgetUtils.footerEnds(item.widget))
// The row owns its full width in both modes, so capacity never changes under the user's feet; edit mode
// shows the whole row scaled into the room beside the edit buttons, so every width stays reachable.
readonly property real trackWidth: width
@@ -233,7 +235,7 @@ Item {
transform: Scale {
id: trackScale
origin.x: I18n.isRtl ? track.width - track.overhang : track.overhang
origin.x: I18n.isRtl !== root.editAtEnd ? track.width - track.overhang : track.overhang
origin.y: track.height / 2
xScale: root.trackScale
yScale: root.trackScale
@@ -433,7 +435,8 @@ Item {
Item {
id: editActions
anchors.right: parent.right
anchors.left: root.editAtEnd ? parent.left : undefined
anchors.right: root.editAtEnd ? undefined : parent.right
anchors.verticalCenter: parent.verticalCenter
width: root.editActionsWidth
height: CcMetrics.footerHeight
@@ -498,18 +501,6 @@ Item {
color: root.overTrash ? Theme.onErrorContainer : CcMetrics.tileInactiveContent
}
}
DActionButton {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
buttonSize: Theme.iconButtonSize
iconName: "check"
iconSize: CcMetrics.iconBoxIconSize
iconColor: Theme.onPrimary
backgroundColor: Theme.primary
tooltipText: I18n.tr("Save")
onClicked: root.finishRequested()
}
}
CcMenu {
@@ -1,4 +1,5 @@
import QtQuick
import "../utils/widgets.js" as WidgetUtils
Loader {
id: root
@@ -46,7 +47,7 @@ Loader {
Binding {
target: root.item
property: "interactive"
value: !root.grid.editMode
value: !root.grid.editMode || root.widgetData.id === WidgetUtils.EDIT_ID
when: root.item !== null
}
@@ -20,6 +20,7 @@ DEditableGridSlot {
readonly property real smallSpanLimit: (1 + CcMetrics.smallRowFraction) / 2
passthrough: tileItem?.passthrough ?? null
restCursor: widgetData.id === WidgetUtils.EDIT_ID ? Qt.PointingHandCursor : Qt.OpenHandCursor
raised: dragging || resizing || (tileItem?.memberDragging ?? false)
function reanchor(small) {
@@ -31,6 +32,11 @@ DEditableGridSlot {
return (requested + bias + CcMetrics.gridGap) / grid.cellWidth;
}
onClicked: {
if (widgetData.id === WidgetUtils.EDIT_ID)
root.grid.editRequested();
}
onPressAndHold: {
if (!editChrome.hasOptions)
return;
@@ -464,7 +464,7 @@ FocusScope {
onColorPickerRequested: root.host.openColorPicker()
onCloseRequested: root.host.close()
onSettingsRequested: root.host.openSettings()
onEditRequested: root.host.editMode = true
onEditRequested: root.host.editMode = !root.host.editMode
onAccountsRequested: root.host.openAccounts()
onLockRequested: {
root.host.close();
@@ -6,9 +6,11 @@ CcTile {
id: root
readonly property string action: widgetData?.id ?? ""
readonly property bool finishing: action === "edit" && (host?.editMode ?? false)
toggle: false
iconName: widgetDef?.icon ?? ""
active: finishing
iconName: finishing ? "check" : widgetDef?.icon ?? ""
title: widgetDef?.text ?? ""
restIconColor: action === "power" ? Theme.error : CcMetrics.tileInactiveIcon
+4 -1
View File
@@ -14,11 +14,13 @@ Item {
property var resizeOrigin: null
property var dragOrigin: null
property Item passthrough: null
property int restCursor: Qt.OpenHandCursor
property bool raised: dragging || resizing
readonly property bool interactionEnabled: resizeOrigin !== null || dragOrigin !== null || !grid.interacting
signal resizeRequested(real requestedWidth, real requestedHeight)
signal pressAndHold
signal clicked
function moveDrag(scenePosition) {
if (!dragOrigin || !dragging)
@@ -160,9 +162,10 @@ Item {
enabled: visible && (root.dragOrigin !== null || !root.grid.interacting)
hoverEnabled: enabled
acceptedButtons: Qt.LeftButton
cursorShape: root.dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor
cursorShape: root.dragging ? Qt.ClosedHandCursor : root.restCursor
containmentMask: root.passthrough ? passthroughMask : null
onPressAndHold: root.pressAndHold()
onClicked: root.clicked()
onWheel: wheel => wheel.accepted = true
}