From a7c14b54931c3efa4cac255670f9fc9528891e0b Mon Sep 17 00:00:00 2001 From: Lukasz Ornatek Date: Mon, 20 Jul 2020 12:09:18 +0200 Subject: Support multiline text Use rich text editor widget as dialog for multiline text input Change-Id: I13147e776867032fe1145d6a8a37fcd6976399e4 Task-number: QDS-2229 Reviewed-by: Marco Bubke --- .../imports/HelperWidgets/StandardTextSection.qml | 62 ++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) (limited to 'share') diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml index 6c5e6fde86..777fb0adc4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml @@ -26,6 +26,8 @@ import QtQuick 2.1 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 +import StudioControls 1.0 as StudioControls +import StudioTheme 1.0 as StudioTheme Section { anchors.left: parent.left @@ -46,9 +48,29 @@ Section { Label { text: qsTr("Text") } - LineEdit { - backendValue: backendValues.text - Layout.fillWidth: true + + RowLayout { + LineEdit { + backendValue: backendValues.text + Layout.fillWidth: true + } + + StudioControls.AbstractButton { + id: richTextEditorButton + buttonIcon: StudioTheme.Constants.textAlignTop + onClicked: { + richTextDialogLoader.show() + } + } + + RichTextEditor{ + onRejected: { + hideWidget() + } + onAccepted: { + hideWidget() + } + } } Label { @@ -219,4 +241,38 @@ Section { Layout.fillWidth: true } } + + Loader { + id: richTextDialogLoader + + visible: false + active: visible + + function show() { + richTextDialogLoader.visible = true + } + + sourceComponent: Item { + id: richTextEditorParent + + Component.onCompleted: { + richTextEditor.showWidget() + richTextEditor.richText = backendValues.text.value + } + + RichTextEditor { + id: richTextEditor + + onRejected: { + hideWidget() + richTextDialogLoader.visible = false + } + onAccepted: { + backendValues.text.value = richTextEditor.richText + hideWidget() + richTextDialogLoader.visible = false + } + } + } + } } -- cgit v1.2.3