diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt5HelperWindow.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt5HelperWindow.qml new file mode 100644 index 00000000000..a2232b13da5 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt5HelperWindow.qml @@ -0,0 +1,4 @@ +import QtQuick.Window 2.15 + +Window { +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt6HelperWindow.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt6HelperWindow.qml new file mode 100644 index 00000000000..448a7575a47 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/Qt6HelperWindow.qml @@ -0,0 +1,4 @@ +import QtQuick 2.15 + +Window { +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index d621fcb0cf5..722338ac1dd 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -26,7 +26,6 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 import QtQuickDesignerTheme 1.0 -import QtQuick.Dialogs 1.3 import StudioTheme 1.0 as StudioTheme import StudioControls 1.0 as StudioControls @@ -559,12 +558,13 @@ Column { } } - onApply: { + onApplied : { if (presetList.gradientData.stopsCount > 0) { applyPreset(); } } + onSaved: { gradientLine.savePreset(); presetList.updatePresets(); @@ -588,7 +588,7 @@ Column { MouseArea { anchors.fill: parent onClicked: { - presetList.open() + presetList.show() } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetList.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetList.qml index aa96c2fb77b..fb2ca5e41d2 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetList.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetList.qml @@ -25,19 +25,22 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 -import QtQuick.Dialogs 1.3 +import Qt.labs.platform 1.1 import QtQuickDesignerTheme 1.0 import HelperWidgets 2.0 import StudioControls 1.0 as StudioControls import StudioTheme 1.0 as StudioTheme -Dialog { + +HelperWindow { id: dialogWindow width: 1200 height: 650 title: qsTr("Gradient Picker") signal saved + signal applied + signal accepted property alias gradientData: gradientPickerData @@ -62,8 +65,6 @@ Dialog { GradientPresetDefaultListModel { id: defaultPresetListModel } GradientPresetCustomListModel { id: customPresetListModel } - standardButtons: Dialog.NoButton - Rectangle { anchors.fill: parent anchors.margins: -12 @@ -117,7 +118,7 @@ Dialog { id: deleteDialog visible: false modality: Qt.WindowModal - standardButtons: Dialog.No | Dialog.Yes + buttons: StandardButton.No | StandardButton.Yes title: qsTr("Delete preset?") text: qsTr("Are you sure you want to delete this preset?") onAccepted: customPresetListModel.deletePreset(customTabContent.deleteId) @@ -129,9 +130,9 @@ Dialog { Layout.alignment: Qt.AlignBottom | Qt.AlignRight Layout.topMargin: 5 - Button { id: buttonClose; text: qsTr("Close"); onClicked: { dialogWindow.reject(); } } + Button { id: buttonClose; text: qsTr("Close"); onClicked: { dialogWindow.hide(); } } Button { id: buttonSave; text: qsTr("Save"); onClicked: { dialogWindow.saved(); } } - Button { id: buttonApply; text: qsTr("Apply"); onClicked: { dialogWindow.apply(); } } + Button { id: buttonApply; text: qsTr("Apply"); onClicked: { dialogWindow.applied(); dialogWindow.hide(); } } } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp index 92ac7fdf8f1..70b7ce76df4 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp @@ -72,11 +72,22 @@ void Quick2PropertyEditorView::registerQmlTypes() Tooltip::registerDeclarativeType(); EasingCurveEditor::registerDeclarativeType(); RichTextEditorProxy::registerDeclarativeType(); - QUrl regExpUrl = QUrl::fromLocalFile(PropertyEditorQmlBackend::propertyEditorResourcesPath() - + "/RegExpValidator.qml"); + + const QString resourcePath = PropertyEditorQmlBackend::propertyEditorResourcesPath(); + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QUrl regExpUrl = QUrl::fromLocalFile(resourcePath + "/RegExpValidator.qml"); qmlRegisterType(regExpUrl, "HelperWidgets", 2, 0, "RegExpValidator"); + + const QString qtPrefix = "/Qt6"; +#else + const QString qtPrefix = "/Qt5"; #endif + qmlRegisterType(QUrl::fromLocalFile(resourcePath + qtPrefix + "HelperWindow.qml"), + "HelperWidgets", + 2, + 0, + "HelperWindow"); } }