From ca0d84dcaebcd19631844496e768818874ddc607 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:48:57 +0100 Subject: [PATCH] Always prefix text in ColorDialog with a hashtag CURA 8687 --- resources/qml/ColorDialog.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml index fabd4caad3..358e8b9ef5 100644 --- a/resources/qml/ColorDialog.qml +++ b/resources/qml/ColorDialog.qml @@ -41,7 +41,13 @@ UM.Dialog selectByMouse: true anchors.top: colorLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{6})$/ } + onTextChanged: { + if (!text.startsWith("#")) + { + text = `#${text}`; + } + } + validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{0,6})$/ } } Rectangle