From 6d78f47d310f69242a88c4e279b49a659d378066 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 17 Oct 2026 11:13:43 +0200 Subject: qtmaildir settings: a colour picker for colour fields An account's chip colour and each tag colour were #rrggbb typed by hand. A swatch beside each now shows the colour and opens Qt's own ColorDialog, which writes the choice back as #rrggbb; typing still works. The add-tag row has one too, filling its field. Setting.qml gains a colour flag rather than a second component, since a colour key is an ordinary text key with a swatch. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/qtmaildir/Setting.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'desktop/modules/qtmaildir/Setting.qml') diff --git a/desktop/modules/qtmaildir/Setting.qml b/desktop/modules/qtmaildir/Setting.qml index 59e9c1b..66d0a46 100644 --- a/desktop/modules/qtmaildir/Setting.qml +++ b/desktop/modules/qtmaildir/Setting.qml @@ -26,6 +26,8 @@ Column { property string kind: "text" property real min: -Infinity property real max: Infinity + // A #rrggbb key: a swatch beside the field opens a colour dialog. + property bool colour: false // What a search hit scrolls to. objectName: section + "/" + key width: parent ? parent.width : 0 @@ -61,8 +63,17 @@ Column { color: Theme.subtext font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } } + ColourPick { + id: pick + anchors { right: parent.right; verticalCenter: parent.verticalCenter } + visible: s.colour + width: s.colour ? 34 : 0 + colour: s.value + onPicked: hex => s.commit(hex) + } Rectangle { - anchors { left: lbl.right; leftMargin: 8; right: parent.right; top: parent.top; bottom: parent.bottom } + anchors { left: lbl.right; leftMargin: 8; right: pick.left; rightMargin: s.colour ? 8 : 0 + top: parent.top; bottom: parent.bottom } radius: 8 color: Theme.surface TextInput { -- cgit v1.2.3