From c747edd0026362a14ff407346dbe403dfbfbf76b Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Wed, 14 Apr 2021 14:28:30 +0200 Subject: [PATCH] Text icon! special characters insert for text fields. --- qml/TextSetting.qml | 58 ++++++++++++++++++++++ qml/icons/Text.svg | 77 ++++++++++++++++++++++++++++++ qml/icons/settings/custom/Text.svg | 77 ++++++++++++++++++++++++++++++ qml/js/objects.js | 2 +- 4 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 qml/icons/Text.svg create mode 100644 qml/icons/settings/custom/Text.svg diff --git a/qml/TextSetting.qml b/qml/TextSetting.qml index 2fd705d..d3efe16 100644 --- a/qml/TextSetting.qml +++ b/qml/TextSetting.qml @@ -77,4 +77,62 @@ Item { } } } + + Button { + text: "α" + anchors.right: parent.right + anchors.rightMargin: 5 + anchors.verticalCenter: parent.verticalCenter + width: 20 + height: width + visible: !isInt && !isDouble + onClicked: insertPopup.open() + } + + Popup { + id: insertPopup + x: input.x + y: input.y + input.height + width: 200 + height: insertGrid.insertChars/insertGrid.columns + modal: true + focus: true + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + + Grid { + id: insertGrid + width: parent.width + columns: 10 + + property var insertChars: [ + "α","β","γ","δ","ε","ζ","η","θ","κ","λ", + "μ","ξ","ρ","ς","σ","τ","φ","χ","ψ","ω", + "Γ","Δ","Θ","Λ","Ξ","Π","Σ","Φ","Ψ","Ω", + "∞","≠","≥","≤","∧","∨","∩","∪","⊂","⊃", + "⊕","⊗","∈","∀","∃","∂"," "," "," "," ", + "¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","⁰", + "₁","₂","₃","₄","₅","₆","₇","₈","₉","₀", + "ₐ","ₑ","ₒ","ₓ","ₔ","ₕ","ₖ","ₗ","ₘ","ₙ", + "ₚ","ₛ","ₜ","₊","₋","₌","₍","₎"," "," " + + ] + Repeater { + model: parent.insertChars.length + + Button { + id: insertBtn + width: insertGrid.width/insertGrid.columns + height: width + text: insertGrid.insertChars[modelData] + flat: text == " " + + onClicked: { + input.insert(input.cursorPosition, insertGrid.insertChars[modelData]) + insertPopup.close() + input.focus = true + } + } + } + } + } } diff --git a/qml/icons/Text.svg b/qml/icons/Text.svg new file mode 100644 index 0000000..ba11d73 --- /dev/null +++ b/qml/icons/Text.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/qml/icons/settings/custom/Text.svg b/qml/icons/settings/custom/Text.svg new file mode 100644 index 0000000..ba11d73 --- /dev/null +++ b/qml/icons/settings/custom/Text.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/qml/js/objects.js b/qml/js/objects.js index 0318af6..72e3527 100644 --- a/qml/js/objects.js +++ b/qml/js/objects.js @@ -398,7 +398,7 @@ class GainBode extends ExecutableObject { export() { return [this.name, this.visible, this.color.toString(), this.labelContent, - this.om_0.name, this.pass.toString(), this.gain.toEditableString(), this.labelPosition, this.labelX] + this.om_0.name, this.pass.toString(), this.gain.toEditableString(), this.labelPosition, this.labelX, this.omGraduation] } execute(x=1) {