diff options
author | Michal Klocek <michal.klocek@qt.io> | 2021-06-10 10:14:15 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-06-29 03:52:27 +0200 |
commit | 8454505a2c79454ffa92a780166a81738c0d7f30 (patch) | |
tree | be09322cfb5165a95dbad5133474c34b9734cf13 /src/webenginequick | |
parent | 8bf3fb9d042502ddfc187e574c6f83a8994c8a41 (diff) |
Port qqc2 delegates to Qt6 and cmake build
It seems that dialogs in qqc2 are still not native windows,
but embedded qquickitems. We used qqc1 dialogs so they look good
on desktop and behave like dialogs. With Qt6 qcc1 are gone,
therefore switch dialogs to qqc2. Unfortunately they no longer
behaves as dialogs (controls are just placed in the middle of a
parent window), but still it is better than nothing.
Task-number: QTBUG-93666
Change-Id: I282ac9c8228eb0bfeefce9b8ef4f657f02a597e7
Reviewed-by: Balazs Egedi <egedib@inf.u-szeged.hu>
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
(cherry picked from commit e90adbb6cffda30c0041b215d71198cd016e0f09)
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginequick')
-rw-r--r-- | src/webenginequick/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/webenginequick/ui2/AlertDialog.qml | 20 | ||||
-rw-r--r-- | src/webenginequick/ui2/AuthenticationDialog.qml | 28 | ||||
-rw-r--r-- | src/webenginequick/ui2/CMakeLists.txt | 36 | ||||
-rw-r--r-- | src/webenginequick/ui2/ConfirmDialog.qml | 20 | ||||
-rw-r--r-- | src/webenginequick/ui2/Menu.qml | 6 | ||||
-rw-r--r-- | src/webenginequick/ui2/MenuItem.qml | 5 | ||||
-rw-r--r-- | src/webenginequick/ui2/MenuSeparator.qml | 2 | ||||
-rw-r--r-- | src/webenginequick/ui2/PromptDialog.qml | 20 | ||||
-rw-r--r-- | src/webenginequick/ui2/ToolTip.qml | 2 | ||||
-rw-r--r-- | src/webenginequick/ui2/qmldir | 2 |
11 files changed, 88 insertions, 54 deletions
diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt index 57ced1441..7ebd758f4 100644 --- a/src/webenginequick/CMakeLists.txt +++ b/src/webenginequick/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(plugin) if(QT_FEATURE_webenginequick_testsupport) add_subdirectory(testsupport) endif() +add_subdirectory(ui2) qt_internal_add_module(WebEngineQuick ${configureMode} SOURCES diff --git a/src/webenginequick/ui2/AlertDialog.qml b/src/webenginequick/ui2/AlertDialog.qml index 4f63c5b70..58398b577 100644 --- a/src/webenginequick/ui2/AlertDialog.qml +++ b/src/webenginequick/ui2/AlertDialog.qml @@ -37,10 +37,9 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Dialog { property alias text: message.text @@ -48,10 +47,11 @@ Dialog { signal accepted() signal rejected() title: qsTr("Alert Dialog") - modality: Qt.NonModal + modal: false + anchors.centerIn: parent //handle the case where users simply closes the dialog - onVisibilityChanged: { + onVisibleChanged: { if (visible == false && handled == false) { handled = true; rejected(); @@ -66,7 +66,7 @@ Dialog { close(); } - contentItem: ColumnLayout { + ColumnLayout { id: rootLayout anchors.fill: parent anchors.margins: 4 @@ -78,9 +78,9 @@ Dialog { Layout.alignment: Qt.AlignRight spacing: 8 Image { - source: "information.png" + source: "qrc:/qt-project.org/imports/QtWebEngine/Controls2Delegates/information.png" } - Text { + Label { id: message Layout.fillWidth: true color: palette.windowText @@ -89,7 +89,7 @@ Dialog { Item { Layout.fillHeight: true } - Controls.Button { + Button { Layout.alignment: Qt.AlignHCenter text: qsTr("OK") onClicked: acceptDialog() diff --git a/src/webenginequick/ui2/AuthenticationDialog.qml b/src/webenginequick/ui2/AuthenticationDialog.qml index 52fcce3f1..0fa61091a 100644 --- a/src/webenginequick/ui2/AuthenticationDialog.qml +++ b/src/webenginequick/ui2/AuthenticationDialog.qml @@ -37,10 +37,9 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Dialog { property alias text: message.text @@ -48,10 +47,11 @@ Dialog { signal accepted(string user, string password) signal rejected() title: qsTr("Authentication Required") - modality: Qt.NonModal + modal: false + anchors.centerIn: parent //handle the case where users simply closes the dialog - onVisibilityChanged: { + onVisibleChanged: { if (visible == false && handled == false) { handled = true; rejected(); @@ -72,7 +72,7 @@ Dialog { close(); } - contentItem: ColumnLayout { + ColumnLayout { id: rootLayout anchors.fill: parent anchors.margins: 4 @@ -82,17 +82,17 @@ Dialog { property int doubleMargins: anchors.margins * 2 SystemPalette { id: palette; colorGroup: SystemPalette.Active } - Text { + Label { id: message color: palette.windowText } GridLayout { columns: 2 - Controls.Label { + Label { text: qsTr("Username:") color: palette.windowText } - Controls.TextField { + TextField { id: userField focus: true Layout.fillWidth: true @@ -101,11 +101,11 @@ Dialog { acceptDialog(); } } - Controls.Label { + Label { text: qsTr("Password:") color: palette.windowText } - Controls.TextField { + TextField { id: passwordField Layout.fillWidth: true echoMode: TextInput.Password @@ -121,12 +121,12 @@ Dialog { RowLayout { Layout.alignment: Qt.AlignRight spacing: 8 - Controls.Button { + Button { id: cancelButton text: qsTr("Cancel") onClicked: rejectDialog() } - Controls.Button { + Button { text: qsTr("Log In") onClicked: acceptDialog() } diff --git a/src/webenginequick/ui2/CMakeLists.txt b/src/webenginequick/ui2/CMakeLists.txt new file mode 100644 index 000000000..b2ca73027 --- /dev/null +++ b/src/webenginequick/ui2/CMakeLists.txt @@ -0,0 +1,36 @@ +set(qml_files + "AlertDialog.qml" + "AuthenticationDialog.qml" + "ConfirmDialog.qml" + "Menu.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "PromptDialog.qml" + "ToolTip.qml" +) + +set(resource_files + "information.png" + "question.png" +) + +qt_internal_add_qml_module(WebEngineQuickDelegatesQml + URI "QtWebEngine.Controls2Delegates" + VERSION "${PROJECT_VERSION}" + QML_FILES ${qml_files} + PAST_MAJOR_VERSIONS 1 + NO_SYNC_QT + PLUGIN_TARGET qtwebenginequickdelegatesplugin + DEPENDENCIES QtQuickControls2 +) + +qt_internal_add_resource(qtwebenginequickdelegatesplugin "qtwebenginequickdelegatesplugin" + PREFIX + "/qt-project.org/imports/QtWebEngine/Controls2Delegates" + FILES + ${resource_files} +) + +make_install_only(WebEngineQuickDelegatesQml) +make_install_only(qtwebenginequickdelegatesplugin) + diff --git a/src/webenginequick/ui2/ConfirmDialog.qml b/src/webenginequick/ui2/ConfirmDialog.qml index 0649d3654..8e91feffc 100644 --- a/src/webenginequick/ui2/ConfirmDialog.qml +++ b/src/webenginequick/ui2/ConfirmDialog.qml @@ -37,10 +37,9 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Dialog { property alias text: message.text @@ -48,10 +47,11 @@ Dialog { signal accepted() signal rejected() title: qsTr("Alert Dialog") - modality: Qt.NonModal + modal: false + anchors.centerIn: parent //handle the case where users simply closes the dialog - onVisibilityChanged: { + onVisibleChanged: { if (visible == false && handled == false) { handled = true; rejected(); @@ -72,7 +72,7 @@ Dialog { close(); } - contentItem: ColumnLayout { + ColumnLayout { id: rootLayout anchors.fill: parent anchors.margins: 4 @@ -84,7 +84,7 @@ Dialog { Layout.alignment: Qt.AlignRight spacing: 8 Image { - source: "question.png" + source: "qrc:/qt-project.org/imports/QtWebEngine/Controls2Delegates/question.png" } Text { id: message @@ -98,11 +98,11 @@ Dialog { RowLayout { Layout.alignment: Qt.AlignRight spacing: 8 - Controls.Button { + Button { text: qsTr("OK") onClicked: acceptDialog() } - Controls.Button { + Button { text: qsTr("Cancel") onClicked: rejectDialog() } diff --git a/src/webenginequick/ui2/Menu.qml b/src/webenginequick/ui2/Menu.qml index 0e7b869f5..c34028b0a 100644 --- a/src/webenginequick/ui2/Menu.qml +++ b/src/webenginequick/ui2/Menu.qml @@ -37,10 +37,10 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls +import QtQuick +import QtQuick.Controls -Controls.Menu { +Menu { id: menu signal done() diff --git a/src/webenginequick/ui2/MenuItem.qml b/src/webenginequick/ui2/MenuItem.qml index 9bf8aac5e..fb01e0aec 100644 --- a/src/webenginequick/ui2/MenuItem.qml +++ b/src/webenginequick/ui2/MenuItem.qml @@ -37,8 +37,7 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls +import QtQuick.Controls -Controls.MenuItem { } +MenuItem { } diff --git a/src/webenginequick/ui2/MenuSeparator.qml b/src/webenginequick/ui2/MenuSeparator.qml index 0c664084a..3d73adf5e 100644 --- a/src/webenginequick/ui2/MenuSeparator.qml +++ b/src/webenginequick/ui2/MenuSeparator.qml @@ -37,6 +37,6 @@ ** ****************************************************************************/ -import QtQuick 2.5 +import QtQuick Item { id: dummy } diff --git a/src/webenginequick/ui2/PromptDialog.qml b/src/webenginequick/ui2/PromptDialog.qml index 880213e36..3c9596cec 100644 --- a/src/webenginequick/ui2/PromptDialog.qml +++ b/src/webenginequick/ui2/PromptDialog.qml @@ -37,10 +37,9 @@ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Layouts 1.0 -import QtQuick.Dialogs 1.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Dialog { property alias text: message.text @@ -50,10 +49,11 @@ Dialog { signal accepted() signal rejected() title: qsTr("Prompt Dialog") - modality: Qt.NonModal + modal: false + anchors.centerIn: parent //handle the case where users simply closes the dialog - onVisibilityChanged: { + onVisibleChanged: { if (visible == false && handled == false) { handled = true; rejected(); @@ -75,7 +75,7 @@ Dialog { close(); } - contentItem: ColumnLayout { + ColumnLayout { id: rootLayout anchors.fill: parent anchors.margins: 4 @@ -88,7 +88,7 @@ Dialog { Layout.fillWidth: true color: palette.windowText } - Controls.TextField { + TextField { id:field focus: true Layout.fillWidth: true @@ -100,11 +100,11 @@ Dialog { RowLayout { Layout.alignment: Qt.AlignRight spacing: 8 - Controls.Button { + Button { text: qsTr("OK") onClicked: acceptDialog() } - Controls.Button { + Button { text: qsTr("Cancel") onClicked: rejectDialog() } diff --git a/src/webenginequick/ui2/ToolTip.qml b/src/webenginequick/ui2/ToolTip.qml index 91645a0f4..7fb8145b4 100644 --- a/src/webenginequick/ui2/ToolTip.qml +++ b/src/webenginequick/ui2/ToolTip.qml @@ -37,7 +37,7 @@ ** ****************************************************************************/ -import QtQuick.Controls 2.0 +import QtQuick.Controls ToolTip { delay: 1000 diff --git a/src/webenginequick/ui2/qmldir b/src/webenginequick/ui2/qmldir deleted file mode 100644 index 8ab0d3671..000000000 --- a/src/webenginequick/ui2/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -# Internal module -module QtWebEngine/Controls2Delegates |