aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2022-03-22 16:01:10 +0100
committerHenning Gründl <henning.gruendl@qt.io>2022-03-22 16:40:44 +0000
commit0c7ec14c626ce6b5b33f49988e32b77848403920 (patch)
tree8471e0436b9bf3e6fd5d963e64ceaf90271de31a
parentfe711ebce43d389157cf68d0c42fb0ab06270533 (diff)
QmlDesigner: Fix WindowSpecifics for Qt6
* Duplicate WindowSpecifics.qml and move it to QtQuick referencing the original from QtQuick/Window as the import changed in Qt6 * Add missing properties to the original specifics: position, minimumWidth, minimumHeight, maximumWidth, maximumHeight, contentOrientation, flags, modality, visibility Change-Id: I542f94b153172d4c7b5a2c62ad0abdc53b8bd1fd Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Window/WindowSpecifics.qml432
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/WindowSpecifics.qml29
2 files changed, 461 insertions, 0 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Window/WindowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Window/WindowSpecifics.qml
index 0e2e086a81..a5b73b9e39 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Window/WindowSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Window/WindowSpecifics.qml
@@ -26,6 +26,7 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
+import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
Section {
@@ -47,6 +48,40 @@ Section {
ExpandingSpacer {}
}
+ PropertyLabel { text: qsTr("Position") }
+
+ SecondColumnLayout {
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.x
+ maximumValue: 0xffff
+ minimumValue: -0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel { text: "X" }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlGap }
+
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.y
+ maximumValue: 0xffff
+ minimumValue: -0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel { text: "Y" }
+
+ ExpandingSpacer {}
+ }
+
PropertyLabel { text: qsTr("Size") }
SecondColumnLayout {
@@ -87,6 +122,92 @@ Section {
ExpandingSpacer {}
}
+ PropertyLabel {
+ text: qsTr("Minimum size")
+ tooltip: qsTr("Minimum size of the window.")
+ }
+
+ SecondColumnLayout {
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.minimumWidth
+ minimumValue: 0
+ maximumValue: 0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel {
+ //: The width of the object
+ text: qsTr("W", "width")
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlGap }
+
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.minimumHeight
+ minimumValue: 0
+ maximumValue: 0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel {
+ //: The height of the object
+ text: qsTr("H", "height")
+ }
+
+ ExpandingSpacer {}
+ }
+
+ PropertyLabel {
+ text: qsTr("Maximum size")
+ tooltip: qsTr("Maximum size of the window.")
+ }
+
+ SecondColumnLayout {
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.maximumWidth
+ minimumValue: 0
+ maximumValue: 0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel {
+ //: The width of the object
+ text: qsTr("W", "width")
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlGap }
+
+ SpinBox {
+ implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ backendValue: backendValues.maximumHeight
+ minimumValue: 0
+ maximumValue: 0xffff
+ decimals: 0
+ }
+
+ Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
+
+ ControlLabel {
+ //: The height of the object
+ text: qsTr("H", "height")
+ }
+
+ ExpandingSpacer {}
+ }
+
PropertyLabel { text: qsTr("Color") }
ColorEditor {
@@ -122,5 +243,316 @@ Section {
ExpandingSpacer {}
}
+
+ PropertyLabel { text: qsTr("Content orientation") }
+
+ SecondColumnLayout {
+ StudioControls.ComboBox {
+ id: contentOrientationComboBox
+
+ property bool __isCompleted: false
+
+ property variant backendValue: backendValues.contentOrientation
+ property variant valueFromBackend: contentOrientationComboBox.backendValue?.value ?? 0
+ property bool isInModel: contentOrientationComboBox.backendValue?.isInModel ?? false
+ property bool isInSubState: contentOrientationComboBox.backendValue?.isInSubState ?? false
+ property bool block: false
+
+ onIsInModelChanged: contentOrientationComboBox.evaluateValue()
+ onIsInSubStateChanged: contentOrientationComboBox.evaluateValue()
+ onBackendValueChanged: contentOrientationComboBox.evaluateValue()
+ onValueFromBackendChanged: contentOrientationComboBox.evaluateValue()
+
+ Connections {
+ target: modelNodeBackend
+ function onSelectionChanged() { contentOrientationComboBox.evaluateValue() }
+ }
+
+ function indexOfContentOrientation() {
+ if (contentOrientationComboBox.backendValue === undefined
+ || contentOrientationComboBox.backendValue.expression === undefined)
+ return 0
+
+ let value = contentOrientationComboBox.backendValue.expression
+
+ if (value.indexOf("PrimaryOrientation") !== -1) return 0
+ if (value.indexOf("LandscapeOrientation") !== -1) return 1
+ if (value.indexOf("PortraitOrientation") !== -1) return 2
+ if (value.indexOf("InvertedLandscapeOrientation") !== -1) return 3
+ if (value.indexOf("InvertedPortraitOrientation") !== -1) return 4
+
+ return 0
+ }
+
+ function evaluateValue() {
+ contentOrientationComboBox.block = true
+ contentOrientationComboBox.currentIndex = indexOfContentOrientation()
+ contentOrientationComboBox.block = false
+ }
+
+ implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ width: implicitWidth
+ labelColor: contentOrientationComboBox.currentIndex === 0
+ ? contentOrientationColorLogic.__defaultTextColor
+ : contentOrientationColorLogic.__changedTextColor
+ model: ["PrimaryOrientation", "LandscapeOrientation", "PortraitOrientation",
+ "InvertedLandscapeOrientation", "InvertedPortraitOrientation"]
+
+ ColorLogic { id: contentOrientationColorLogic }
+
+ actionIndicator.icon.color: contentOrientationExtFuncLogic.color
+ actionIndicator.icon.text: contentOrientationExtFuncLogic.glyph
+ actionIndicator.onClicked: contentOrientationExtFuncLogic.show()
+ actionIndicator.forceVisible: contentOrientationExtFuncLogic.menuVisible
+ actionIndicator.visible: true
+
+ ExtendedFunctionLogic {
+ id: contentOrientationExtFuncLogic
+ backendValue: backendValues.contentOrientation
+ onReseted: contentOrientationComboBox.currentIndex = 0
+ }
+
+ onActivated: function(index) {
+ if (!contentOrientationComboBox.__isCompleted)
+ return
+
+ contentOrientationComboBox.currentIndex = index
+ contentOrientationComboBox.composeExpressionString()
+ }
+
+ function composeExpressionString() {
+ if (contentOrientationComboBox.block)
+ return
+
+ var expressionStr = ""
+ if (contentOrientationComboBox.currentIndex !== 0) {
+ expressionStr = "Qt." + contentOrientationComboBox.currentText
+ contentOrientationComboBox.backendValue.expression = expressionStr
+ }
+ }
+
+ Component.onCompleted: {
+ contentOrientationComboBox.evaluateValue()
+ contentOrientationComboBox.__isCompleted = true
+ }
+ }
+
+ ExpandingSpacer {}
+ }
+
+ PropertyLabel { text: qsTr("Flags") }
+
+ SecondColumnLayout {
+ StudioControls.ComboBox {
+ id: flagsComboBox
+
+ property bool __isCompleted: false
+
+ property variant backendValue: backendValues.flags
+ property variant valueFromBackend: flagsComboBox.backendValue?.value ?? 0
+ property bool isInModel: flagsComboBox.backendValue?.isInModel ?? false
+ property bool isInSubState: flagsComboBox.backendValue?.isInSubState ?? false
+ property bool block: false
+
+ onIsInModelChanged: flagsComboBox.evaluateValue()
+ onIsInSubStateChanged: flagsComboBox.evaluateValue()
+ onBackendValueChanged: flagsComboBox.evaluateValue()
+ onValueFromBackendChanged: flagsComboBox.evaluateValue()
+
+ Connections {
+ target: modelNodeBackend
+ function onSelectionChanged() { flagsComboBox.evaluateValue() }
+ }
+
+ function indexOfFlags() {
+ if (flagsComboBox.backendValue === undefined
+ || flagsComboBox.backendValue.expression === undefined)
+ return 0
+
+ let value = flagsComboBox.backendValue.expression
+
+ if (value.indexOf("Widget") !== -1) return 0
+ if (value.indexOf("Window") !== -1) return 1
+ if (value.indexOf("Dialog") !== -1) return 2
+ if (value.indexOf("Sheet") !== -1) return 3
+ if (value.indexOf("Drawer") !== -1) return 4
+ if (value.indexOf("Popup") !== -1) return 5
+ if (value.indexOf("Tool") !== -1) return 6
+ if (value.indexOf("ToolTip") !== -1) return 7
+ if (value.indexOf("SplashScreen") !== -1) return 8
+ if (value.indexOf("Desktop") !== -1) return 9
+ if (value.indexOf("SubWindow") !== -1) return 10
+ if (value.indexOf("ForeignWindow") !== -1) return 11
+ if (value.indexOf("CoverWindow") !== -1) return 12
+
+ return 0
+ }
+
+ function evaluateValue() {
+ flagsComboBox.block = true
+ flagsComboBox.currentIndex = indexOfFlags()
+ flagsComboBox.block = false
+ }
+
+ implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ width: implicitWidth
+ labelColor: flagsComboBox.currentIndex === 0 ? flagsColorLogic.__defaultTextColor
+ : flagsColorLogic.__changedTextColor
+ model: ["Widget", "Window", "Dialog", "Sheet", "Drawer", "Popup", "Tool", "ToolTip",
+ "SplashScreen", "Desktop", "SubWindow", "ForeignWindow", "CoverWindow"]
+
+ ColorLogic { id: flagsColorLogic }
+
+ actionIndicator.icon.color: flagsExtFuncLogic.color
+ actionIndicator.icon.text: flagsExtFuncLogic.glyph
+ actionIndicator.onClicked: flagsExtFuncLogic.show()
+ actionIndicator.forceVisible: flagsExtFuncLogic.menuVisible
+ actionIndicator.visible: true
+
+ ExtendedFunctionLogic {
+ id: flagsExtFuncLogic
+ backendValue: backendValues.flags
+ onReseted: flagsComboBox.currentIndex = 0
+ }
+
+ onActivated: function(index) {
+ if (!flagsComboBox.__isCompleted)
+ return
+
+ flagsComboBox.currentIndex = index
+ flagsComboBox.composeExpressionString()
+ }
+
+ function composeExpressionString() {
+ if (flagsComboBox.block)
+ return
+
+ var expressionStr = ""
+ if (flagsComboBox.currentIndex !== 0) {
+ expressionStr = "Qt." + flagsComboBox.currentText
+ flagsComboBox.backendValue.expression = expressionStr
+ }
+ }
+
+ Component.onCompleted: {
+ flagsComboBox.evaluateValue()
+ flagsComboBox.__isCompleted = true
+ }
+ }
+
+ ExpandingSpacer {}
+ }
+
+ PropertyLabel { text: qsTr("Modality") }
+
+ SecondColumnLayout {
+ StudioControls.ComboBox {
+ id: modalityComboBox
+
+ property bool __isCompleted: false
+
+ property variant backendValue: backendValues.modality
+ property variant valueFromBackend: modalityComboBox.backendValue?.value ?? 0
+ property bool isInModel: modalityComboBox.backendValue?.isInModel ?? false
+ property bool isInSubState: modalityComboBox.backendValue?.isInSubState ?? false
+ property bool block: false
+
+ onIsInModelChanged: modalityComboBox.evaluateValue()
+ onIsInSubStateChanged: modalityComboBox.evaluateValue()
+ onBackendValueChanged: modalityComboBox.evaluateValue()
+ onValueFromBackendChanged: modalityComboBox.evaluateValue()
+
+ Connections {
+ target: modelNodeBackend
+ function onSelectionChanged() { modalityComboBox.evaluateValue() }
+ }
+
+ function indexOfModality() {
+ if (modalityComboBox.backendValue === undefined
+ || modalityComboBox.backendValue.expression === undefined)
+ return 0
+
+ let value = modalityComboBox.backendValue.expression
+
+ if (value.indexOf("NonModal") !== -1) return 0
+ if (value.indexOf("WindowModal") !== -1) return 1
+ if (value.indexOf("ApplicationModal") !== -1) return 2
+
+ return 0
+ }
+
+ function evaluateValue() {
+ modalityComboBox.block = true
+ modalityComboBox.currentIndex = indexOfModality()
+ modalityComboBox.block = false
+ }
+
+ implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ width: implicitWidth
+ labelColor: modalityComboBox.currentIndex === 0
+ ? modalityColorLogic.__defaultTextColor
+ : modalityColorLogic.__changedTextColor
+ model: ["NonModal", "WindowModal", "ApplicationModal"]
+
+ ColorLogic { id: modalityColorLogic }
+
+ actionIndicator.icon.color: modalityExtFuncLogic.color
+ actionIndicator.icon.text: modalityExtFuncLogic.glyph
+ actionIndicator.onClicked: modalityExtFuncLogic.show()
+ actionIndicator.forceVisible: modalityExtFuncLogic.menuVisible
+ actionIndicator.visible: true
+
+ ExtendedFunctionLogic {
+ id: modalityExtFuncLogic
+ backendValue: backendValues.modality
+ onReseted: modalityComboBox.currentIndex = 0
+ }
+
+ onActivated: function(index) {
+ if (!modalityComboBox.__isCompleted)
+ return
+
+ modalityComboBox.currentIndex = index
+ modalityComboBox.composeExpressionString()
+ }
+
+ function composeExpressionString() {
+ if (modalityComboBox.block)
+ return
+
+ var expressionStr = ""
+ if (modalityComboBox.currentIndex !== 0) {
+ expressionStr = "Qt." + modalityComboBox.currentText
+ modalityComboBox.backendValue.expression = expressionStr
+ }
+ }
+
+ Component.onCompleted: {
+ modalityComboBox.evaluateValue()
+ modalityComboBox.__isCompleted = true
+ }
+ }
+
+ ExpandingSpacer {}
+ }
+
+ PropertyLabel { text: qsTr("Visibility") }
+
+ SecondColumnLayout {
+ ComboBox {
+ scope: "Window"
+ model: ["AutomaticVisibility", "Windowed", "Minimized", "Maximized", "FullScreen",
+ "Hidden"]
+ backendValue: backendValues.visibility
+ enabled: backendValues.visibility.isAvailable
+ implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ + StudioTheme.Values.actionIndicatorWidth
+ }
+
+ ExpandingSpacer {}
+ }
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/WindowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/WindowSpecifics.qml
new file mode 100644
index 0000000000..56c45ef14d
--- /dev/null
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/WindowSpecifics.qml
@@ -0,0 +1,29 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import "Window" as Original
+
+Original.WindowSpecifics {}