QmlDesigner: Fix Qt6 property editor issues

* Fix hover state for disabled controls
* Fix deprecation warning about injection of parameters
* Code cleanup
* Update QtQuick import version
* Update copyright header

Task-number: QDS-4658
Task-number: QDS-4665
Change-Id: I756a0cdeb1bcdf0ea324d112fb9c5f88cadde6b3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Henning Gruendl
2021-07-01 18:03:09 +02:00
committed by Henning Gründl
parent 4d27740baf
commit c7ad1c31bd
49 changed files with 191 additions and 234 deletions

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import StudioControls 1.0 as StudioControls
StudioControls.ActionIndicator {

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
@@ -32,9 +32,9 @@ Row {
id: alignmentHorizontalButtons
property bool blueHighlight: false
property variant backendValue: backendValues.horizontalAlignment;
property variant backendValue: backendValues.horizontalAlignment
property variant value: backendValue.enumeration
property bool baseStateFlag: isBaseState;
property bool baseStateFlag: isBaseState
property color __currentColor: blueHighlight ? StudioTheme.Values.themeIconColorInteraction
: StudioTheme.Values.themeIconColor

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
@@ -32,13 +32,9 @@ Row {
id: alignmentVerticalButtons
property bool blueHighlight: false
property variant backendValue: backendValues.verticalAlignment;
property variant backendValue: backendValues.verticalAlignment
property variant value: backendValue.enumeration
property bool baseStateFlag: isBaseState;
property bool baseStateFlag: isBaseState
property color __currentColor: blueHighlight ? StudioTheme.Values.themeIconColorInteraction
: StudioTheme.Values.themeIconColor
@@ -48,37 +44,32 @@ Row {
buttonAlignBottom.checked = false
if (value !== undefined) {
if (value === "AlignTop") {
if (value === "AlignTop")
buttonAlignTop.checked = true
} else if (value === "AlignVCenter") {
else if (value === "AlignVCenter")
buttonAlignVCenter.checked = true
} else if (value === "AlignBottom") {
else if (value === "AlignBottom")
buttonAlignBottom.checked = true
}
}
evaluate()
}
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
}
property bool isInModel: backendValue.isInModel
onIsInModelChanged: evaluate()
property bool isInSubState: backendValue.isInSubState
onIsInSubStateChanged: evaluate()
function evaluate() {
if (baseStateFlag) {
if (backendValue !== null && backendValue.isInModel)
blueHighlight = true;
blueHighlight = true
else
blueHighlight = false;
blueHighlight = false
} else {
if (backendValue !== null && backendValue.isInSubState)
blueHighlight = true;
blueHighlight = true
else
blueHighlight = false;
blueHighlight = false
}
}

View File

@@ -69,7 +69,7 @@ T.AbstractButton {
},
State {
name: "hovered"
when: myButton.hovered && !myButton.pressed
when: myButton.enabled && myButton.hovered && !myButton.pressed
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundHover
@@ -77,7 +77,7 @@ T.AbstractButton {
},
State {
name: "pressed"
when: myButton.hovered && myButton.pressed
when: myButton.enabled && myButton.hovered && myButton.pressed
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundInteraction

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.0
RowLayout {

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,22 +23,15 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.0
Row {
id: buttonRow
property bool exclusive: false
property int initalChecked: 0
property int checkedIndex: 0
signal toggled (int index, bool checked)
Component.onCompleted: {
}
}

View File

@@ -30,44 +30,40 @@ import StudioTheme 1.0 as StudioTheme
Item {
id: buttonRowButton
property int leftPadding: 0
property bool checked: false
property bool roundLeftButton: true
property alias iconSource: image.source
property alias tooltip: toolTipArea.tooltip
signal clicked()
signal doubleClicked()
property alias tooltip: toolTipArea.tooltip
width: StudioTheme.Values.height + leftPadding
height: StudioTheme.Values.height
property int leftPadding: 0
function index() {
for (var i = 0; i < parent.children.length; i++) {
if (parent.children[i] === buttonRowButton)
return i;
return i
}
return -1;
return -1
}
function isFirst() {
return index() === 0;
return index() === 0
}
function isLast() {
return index() === (parent.children.length - 1);
return index() === (parent.children.length - 1)
}
Item {
anchors.fill: parent
RoundedPanel {
roundLeft: isFirst() && buttonRowButton.roundLeftButton
anchors.fill: parent
visible: checked
color: StudioTheme.Values.themeControlBackgroundInteraction
@@ -75,7 +71,6 @@ Item {
RoundedPanel {
roundLeft: isFirst()
anchors.fill: parent
visible: !checked
color: StudioTheme.Values.themeControlBackground

View File

@@ -635,7 +635,7 @@ SecondColumnLayout {
anchors.fill: parent
tooltip: originalColorRectangle.color
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.LeftButton)
colorEditor.color = colorEditor.originalColor
@@ -667,7 +667,7 @@ SecondColumnLayout {
anchors.fill: parent
tooltip: newColorRectangle.color
acceptedButtons: Qt.RightButton
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.RightButton) {
contextMenuFavorite.currentColor = colorEditor.color
contextMenuFavorite.popup()

View File

@@ -77,7 +77,7 @@ Column {
acceptedButtons: Qt.LeftButton | Qt.RightButton
tooltip: modelData
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.LeftButton)
root.selectedColor = colorRectangle.color

View File

@@ -206,7 +206,7 @@ Column {
preventStealing: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPositionChanged: {
onPositionChanged: function(mouse) {
if (pressed && mouse.buttons === Qt.LeftButton) {
var xx = Math.max(0, Math.min(mouse.x, parent.width))
var yy = Math.max(0, Math.min(mouse.y, parent.height))
@@ -215,15 +215,15 @@ Column {
root.saturation = xx / parent.width
}
}
onPressed: {
onPressed: function(mouse) {
if (mouse.button === Qt.LeftButton)
positionChanged(mouse)
}
onReleased: {
onReleased: function(mouse) {
if (mouse.button === Qt.LeftButton)
root.updateColor()
}
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.RightButton)
root.rightMouseButtonClicked()
}

View File

@@ -159,7 +159,7 @@ StudioControls.TextField {
onPressed: listView.model = null
Keys.priority: Keys.BeforeItem
Keys.onPressed: {
Keys.onPressed: function(event) {
var text = textField.text
var pos = textField.cursorPosition
var explicitComplete = true
@@ -220,7 +220,7 @@ StudioControls.TextField {
listView.model = list
}
Keys.onSpacePressed: {
Keys.onSpacePressed: function(event) {
if (event.modifiers & Qt.ControlModifier) {
var list = autoComplete(textField.text, textField.cursorPosition, true, textField.completeOnlyTypes)
textField.prefix = textField.text.substring(0, textField.cursorPosition)
@@ -236,7 +236,7 @@ StudioControls.TextField {
}
}
Keys.onReturnPressed: {
Keys.onReturnPressed: function(event) {
event.accepted = false
if (textField.completionActive) {
textField.commitCompletion()
@@ -244,7 +244,7 @@ StudioControls.TextField {
}
}
Keys.onEscapePressed: {
Keys.onEscapePressed: function(event) {
event.accepted = true
if (textField.completionActive) {
listView.model = null
@@ -253,12 +253,12 @@ StudioControls.TextField {
}
}
Keys.onUpPressed: {
Keys.onUpPressed: function(event) {
listView.decrementCurrentIndex()
event.accepted = false
}
Keys.onDownPressed: {
Keys.onDownPressed: function(event) {
listView.incrementCurrentIndex()
event.accepted = false
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
import QtQuickDesignerTheme 1.0
@@ -70,17 +70,9 @@ Item {
}
}
onBackendValueChanged: {
setIcon()
}
onIsBoundBackendChanged: {
setIcon()
}
onBackendExpressionChanged: {
setIcon()
}
onBackendValueChanged: setIcon()
onIsBoundBackendChanged: setIcon()
onBackendExpressionChanged: setIcon()
Loader {
id: menuLoader
@@ -101,15 +93,11 @@ Item {
exportMenuItem.enabled = !backendValue.isAttachedProperty()
extendedFunctionButton.menuVisible = true
}
onAboutToHide: {
extendedFunctionButton.menuVisible = false
}
onAboutToHide: extendedFunctionButton.menuVisible = false
Connections {
target: modelNodeBackend
onSelectionChanged: {
menu.close()
}
onSelectionChanged: menu.close()
}
StudioControls.MenuItem {
@@ -121,20 +109,22 @@ Item {
extendedFunctionButton.reseted()
}
}
StudioControls.MenuItem {
text: qsTr("Set Binding")
onTriggered: expressionDialogLoader.show()
}
StudioControls.MenuItem {
id: exportMenuItem
text: qsTr("Export Property as Alias")
checkable: true
onTriggered: {
if (checked)
backendValue.exportPopertyAsAlias()
else
backendValue.removeAliasExport()
}
checkable: true
}
StudioControls.MenuItem {
@@ -150,13 +140,13 @@ Item {
id: expressionDialogLoader
parent: itemPane
anchors.fill: parent
visible: false
active: visible
function show() {
expressionDialogLoader.visible = true
}
sourceComponent: Item {
id: bindingEditorParent
@@ -176,6 +166,7 @@ Item {
hideWidget()
expressionDialogLoader.visible = false
}
onAccepted: {
backendValue.expression = bindingEditor.text.trim()
hideWidget()

View File

@@ -34,6 +34,7 @@ StudioControls.ComboBox {
property variant backendValue
property color textColor: colorLogic.textColor
property string fontFilter: "*.ttf *.otf"
property bool showExtendedFunctionButton: true
labelColor: colorLogic.textColor
editable: true
@@ -63,9 +64,7 @@ StudioControls.ComboBox {
comboBox.model = familyNames
}
onModelChanged: {
editText = comboBox.backendValue.valueToString
}
onModelChanged: editText = comboBox.backendValue.valueToString
ExtendedFunctionLogic {
id: extFuncLogic
@@ -76,18 +75,13 @@ StudioControls.ComboBox {
actionIndicator.icon.text: extFuncLogic.glyph
actionIndicator.onClicked: extFuncLogic.show()
actionIndicator.forceVisible: extFuncLogic.menuVisible
property bool showExtendedFunctionButton: true
actionIndicator.visible: showExtendedFunctionButton
actionIndicator.visible: comboBox.showExtendedFunctionButton
ColorLogic {
id: colorLogic
backendValue: comboBox.backendValue
property string textValue: comboBox.backendValue.valueToString
onTextValueChanged: {
comboBox.editText = textValue
}
backendValue: comboBox.backendValue
onTextValueChanged: comboBox.editText = colorLogic.textValue
}
onAccepted: {
@@ -124,7 +118,7 @@ StudioControls.ComboBox {
Component.onCompleted: {
setupModel()
//Hack to style the text input
// Hack to style the text input
for (var i = 0; i < comboBox.children.length; i++) {
if (comboBox.children[i].text !== undefined) {
comboBox.children[i].color = comboBox.textColor
@@ -135,7 +129,7 @@ StudioControls.ComboBox {
}
function setColor() {
//Hack to style the text input
// Hack to style the text input
for (var i = 0; i < comboBox.children.length; i++) {
if (comboBox.children[i].text !== undefined) {
comboBox.children[i].color = comboBox.textColor

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,8 +23,8 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick 2.15
import QtQuick.Layouts 1.15
Image {
id: root

View File

@@ -81,12 +81,8 @@ HelperWindow {
Layout.fillWidth: true
StudioControls.TabButton {
text: qsTr("System Presets")
}
StudioControls.TabButton {
text: qsTr("User Presets")
}
StudioControls.TabButton { text: qsTr("System Presets") }
StudioControls.TabButton { text: qsTr("User Presets") }
}
StackLayout {
@@ -103,11 +99,13 @@ HelperWindow {
id: customTabContent
viewModel: customPresetListModel
editableName: true
onPresetNameChanged: customPresetListModel.changePresetName(id, name)
onPresetNameChanged: function(id, name) {
customPresetListModel.changePresetName(id, name)
}
property int deleteId
onDeleteButtonClicked: {
onDeleteButtonClicked: function(id) {
deleteId = id
deleteDialog.open()
}

View File

@@ -171,12 +171,12 @@ Rectangle {
}
Component.onCompleted: {
var stopsAmount = stopListSize;
var newStops = [];
for (var i = 0; i < stopsAmount; i++) {
newStops.push( stopComponent.createObject(showGr, { "position": stopsPosList[i], "color": stopsColorList[i] }) );
}
showGr.stops = newStops;
var stopsAmount = stopListSize
var newStops = []
for (var i = 0; i < stopsAmount; i++)
newStops.push( stopComponent.createObject(showGr, { "position": stopsPosList[i], "color": stopsColorList[i] }) )
showGr.stops = newStops
}
AbstractButton {
@@ -267,7 +267,7 @@ Rectangle {
presetNameBox.edit = false
}
Keys.onPressed: {
Keys.onPressed:function(event) {
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
event.accepted = true
nameInput.editingFinished()

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.12
import QtQuick 2.15
import StudioTheme 1.0 as StudioTheme
Item {
@@ -105,11 +105,10 @@ Item {
onPressed: calculateValue()
onReleased: root.clicked()
onPositionChanged: {
if (pressed) {
if (pressed)
calculateValue()
}
}
}
}
}

View File

@@ -68,7 +68,7 @@ Rectangle {
states: [
State {
name: "default"
when: !toolTipArea.containsMouse
when: !toolTipArea.containsMouse && root.enabled
PropertyChanges {
target: indicatorIcon
color: StudioTheme.Values.themeLinkIndicatorColor
@@ -76,11 +76,19 @@ Rectangle {
},
State {
name: "hover"
when: toolTipArea.containsMouse
when: toolTipArea.containsMouse && root.enabled
PropertyChanges {
target: indicatorIcon
color: StudioTheme.Values.themeLinkIndicatorColorHover
}
},
State {
name: "disable"
when: !root.enabled
PropertyChanges {
target: indicatorIcon
color: StudioTheme.Values.themeLinkIndicatorColorDisabled
}
}
]
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,9 +23,9 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
MouseArea {
id: mouseArea
@@ -35,7 +35,7 @@ MouseArea {
onExited: tooltipBackend.hideTooltip()
onCanceled: tooltipBackend.hideTooltip()
onPositionChanged: tooltipBackend.reposition()
onClicked: {
onClicked: function(mouse) {
forceActiveFocus()
if (mouse.button === Qt.RightButton)
showContextMenu()

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Quick 3D.
@@ -27,7 +27,7 @@
**
****************************************************************************/
import QtQuick 2.12
import QtQuick 2.15
import HelperWidgets 2.0 as HelperWidgets
HelperWidgets.ComboBox {

View File

@@ -138,7 +138,7 @@ StudioControls.TextField {
var textValue = lineEdit.text
lineEdit.backendValue.value = textValue
}
colorLogic.evaluate();
colorLogic.evaluate()
}
property variant backendValueValueInternal: backendValue === undefined ? 0 : backendValue.value
@@ -157,13 +157,13 @@ StudioControls.TextField {
}
function escapeString(string) {
var str = string;
str = str.replace(/\\/g, "\\\\");
str.replace(/\"/g, "\\\"");
str = str.replace(/\t/g, "\\t");
str = str.replace(/\r/g, "\\r");
str = str.replace(/\n/g, '\\n');
return str;
var str = string
str = str.replace(/\\/g, "\\\\")
str.replace(/\"/g, "\\\"")
str = str.replace(/\t/g, "\\t")
str = str.replace(/\r/g, "\\r")
str = str.replace(/\n/g, '\\n')
return str
}
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Quick 3D.
@@ -27,7 +27,7 @@
**
****************************************************************************/
import QtQuick 2.12
import QtQuick 2.15
import HelperWidgets 2.0 as HelperWidgets
import StudioControls 1.0 as StudioControls

View File

@@ -108,11 +108,10 @@ Item {
onPressed: calculateValue()
onReleased: root.clicked()
onPositionChanged: {
if (pressed) {
if (pressed)
calculateValue()
}
}
}
}
}

View File

@@ -34,7 +34,7 @@ Row {
property alias origin: myButton.origin
property variant backendValue
onOriginSelectorClicked: {
onOriginSelectorClicked: function(value) {
if (root.enabled)
root.backendValue.setEnumeration("Item", value)
}
@@ -78,7 +78,7 @@ Row {
property string origin: "Center"
// This property is used to indicate the global hover state
property bool hover: myButton.hovered
property bool hover: myButton.hovered && root.enabled
property alias backgroundVisible: buttonBackground.visible
property alias backgroundRadius: buttonBackground.radius
@@ -162,10 +162,8 @@ Row {
border.width: StudioTheme.Values.border
}
enter: Transition {
}
exit: Transition {
}
enter: Transition {}
exit: Transition {}
}
states: [
@@ -185,6 +183,7 @@ Row {
State {
name: "globalHover"
when: actionIndicator.hover && !myButton.pressed && !originPopup.opened
&& root.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundGlobalHover
@@ -194,7 +193,7 @@ Row {
State {
name: "hover"
when: myButton.hover && !actionIndicator.hover && !myButton.pressed
&& !originPopup.opened
&& !originPopup.opened && root.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundHover

View File

@@ -42,7 +42,7 @@ Rectangle {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: myControl.originSelectorClicked(value)
onClicked: myControl.originSelectorClicked(root.value)
}
states: [

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,8 +23,8 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0
import StudioTheme 1.0 as StudioTheme

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.

View File

@@ -69,7 +69,7 @@ Item {
height: StudioTheme.Values.sectionHeadHeight
anchors.left: parent.left
anchors.right: parent.right
color: Qt.lighter(StudioTheme.Values.themeSectionHeadBackground, 1.0 + (0.2 * level))
color: Qt.lighter(StudioTheme.Values.themeSectionHeadBackground, 1.0 + (0.2 * section.level))
Image {
id: arrow
@@ -77,7 +77,7 @@ Item {
height: 4
source: "image://icons/down-arrow"
anchors.left: parent.left
anchors.leftMargin: 4 + (level * levelShift)
anchors.leftMargin: 4 + (section.level * section.levelShift)
anchors.verticalCenter: parent.verticalCenter
}
@@ -85,7 +85,7 @@ Item {
id: label
anchors.verticalCenter: parent.verticalCenter
color: StudioTheme.Values.themeTextColor
x: 22 + (level * levelShift)
x: 22 + (section.level * section.levelShift)
font.pixelSize: StudioTheme.Values.myFontSize
font.capitalization: Font.AllUppercase
}
@@ -94,7 +94,7 @@ Item {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.LeftButton) {
trans.enabled = true
if (expandOnClick)

View File

@@ -23,8 +23,8 @@
**
****************************************************************************/
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick 2.15
import QtQuick.Layouts 1.15
Item {
height: 4

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,16 +23,14 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
MouseArea {
id: mouseArea
Tooltip {
id: myTooltip
}
Tooltip { id: myTooltip }
onExited: myTooltip.hideText()
onCanceled: myTooltip.hideText()

View File

@@ -24,12 +24,12 @@
****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
import QtQuickDesignerTheme 1.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.5
Row {
id: urlChooser

View File

@@ -52,7 +52,7 @@ T.AbstractButton {
activeFocusOnTab: false
onHoveredChanged: {
if (parent !== undefined && parent.hoverCallback !== undefined)
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
parent.hoverCallback()
}
@@ -132,7 +132,7 @@ T.AbstractButton {
},
State {
name: "globalHover"
when: myButton.globalHover && !myButton.hovered && !myButton.pressed
when: myButton.globalHover && !myButton.hovered && !myButton.pressed && myButton.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundGlobalHover
@@ -140,7 +140,7 @@ T.AbstractButton {
},
State {
name: "hover"
when: myButton.hovered && !myButton.pressed
when: myButton.hovered && !myButton.pressed && myButton.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundHover

View File

@@ -31,7 +31,7 @@ import StudioTheme 1.0 as StudioTheme
Row {
id: myButtonRow
property bool hover: actionIndicator.hover || myButtonRow.childHover
property bool hover: (actionIndicator.hover || myButtonRow.childHover) && myButtonRow.enabled
property bool childHover: false
property alias actionIndicator: actionIndicator

View File

@@ -33,7 +33,7 @@ T.CheckBox {
property alias actionIndicator: actionIndicator
// This property is used to indicate the global hover state
property bool hover: myCheckBox.hovered
property bool hover: myCheckBox.hovered && myCheckBox.enabled
property bool edit: false
property alias actionIndicatorVisible: actionIndicator.visible

View File

@@ -33,7 +33,7 @@ Rectangle {
property T.Control myControl
property T.Popup myPopup
property bool hover: checkIndicatorMouseArea.containsMouse
property bool hover: checkIndicatorMouseArea.containsMouse && checkIndicator.enabled
property bool pressed: checkIndicatorMouseArea.containsPress
property bool checked: false

View File

@@ -35,7 +35,8 @@ T.ComboBox {
property alias labelColor: comboBoxInput.color
// This property is used to indicate the global hover state
property bool hover: comboBoxInput.hover || actionIndicator.hover || popupIndicator.hover
property bool hover: (comboBoxInput.hover || actionIndicator.hover || popupIndicator.hover)
&& myComboBox.enabled
property bool edit: myComboBox.activeFocus && myComboBox.editable
property bool open: comboBoxPopup.opened
@@ -217,10 +218,8 @@ T.ComboBox {
border.width: 0
}
enter: Transition {
}
exit: Transition {
}
enter: Transition {}
exit: Transition {}
}
states: [
@@ -307,7 +306,7 @@ T.ComboBox {
}
]
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape)
myComboBox.focus = false
}

View File

@@ -33,7 +33,7 @@ TextInput {
property T.Control myControl
property bool edit: textInput.activeFocus
property bool hover: mouseArea.containsMouse
property bool hover: mouseArea.containsMouse && textInput.enabled
z: 2
font: myControl.font
@@ -91,7 +91,7 @@ TextInput {
propagateComposedEvents: true
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onPressed: mouse.accepted = false
onPressed: function(mouse) { mouse.accepted = false }
}
states: [

View File

@@ -51,7 +51,7 @@ T.SpinBox {
property bool edit: spinBoxInput.activeFocus
// This property is used to indicate the global hover state
property bool hover: mySpinBox.hovered || actionIndicator.hover
property bool hover: (mySpinBox.hovered || actionIndicator.hover) && mySpinBox.enabled
property bool drag: false
property bool sliderDrag: sliderPopup.drag
@@ -199,10 +199,8 @@ T.SpinBox {
width: mySpinBox.width - actionIndicator.width - (StudioTheme.Values.border * 2)
height: StudioTheme.Values.sliderHeight
enter: Transition {
}
exit: Transition {
}
enter: Transition {}
exit: Transition {}
}
textFromValue: function (value, locale) {
@@ -304,7 +302,7 @@ T.SpinBox {
spinBoxInput.selectAll()
}
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
event.accepted = true

View File

@@ -32,7 +32,7 @@ Rectangle {
property T.Control myControl
property bool hover: spinBoxIndicatorMouseArea.containsMouse
property bool hover: spinBoxIndicatorMouseArea.containsMouse && spinBoxIndicator.enabled
property bool pressed: spinBoxIndicatorMouseArea.containsPress
property bool released: false
property bool realEnabled: true
@@ -79,7 +79,7 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
pressAndHoldInterval: 500
onPressed: {
onPressed: function(mouse) {
if (myControl.activeFocus)
spinBoxIndicator.forceActiveFocus()
@@ -90,7 +90,7 @@ Rectangle {
pressAndHoldTimer.restart()
pressedAndHeld = true
}
onReleased: {
onReleased: function(mouse) {
// Only trigger real released when pressAndHold isn't active
if (!pressAndHoldTimer.running && containsMouse)
spinBoxIndicator.realReleased()
@@ -222,7 +222,7 @@ Rectangle {
}
PropertyChanges {
target: spinBoxIndicator
color: "#2aafd3" // TODO
color: StudioTheme.Values.themeInteraction
}
},
State {

View File

@@ -34,7 +34,7 @@ TextInput {
property bool edit: textInput.activeFocus
property bool drag: false
property bool hover: mouseArea.containsMouse
property bool hover: mouseArea.containsMouse && textInput.enabled
z: 2
font: myControl.font
@@ -57,7 +57,7 @@ TextInput {
// TextInput focus needs to be set to activeFocus whenever it changes,
// otherwise TextInput will get activeFocus whenever the parent SpinBox gets
// activeFocus. This will lead to weird side effects.
onActiveFocusChanged: textInput.focus = activeFocus
onActiveFocusChanged: textInput.focus = textInput.activeFocus
Rectangle {
id: textInputBackground
@@ -72,7 +72,7 @@ TextInput {
Item {
id: dragModifierWorkaround
Keys.onPressed: {
Keys.onPressed: function(event) {
event.accepted = true
if (event.modifiers & Qt.ControlModifier) {
@@ -85,7 +85,7 @@ TextInput {
mouseArea.calcValue(myControl.realValueModified)
}
}
Keys.onReleased: {
Keys.onReleased: function(event) {
event.accepted = true
mouseArea.stepSize = myControl.realStepSize
mouseArea.calcValue(myControl.realValueModified)
@@ -93,7 +93,7 @@ TextInput {
}
// Ensure that we get Up and Down key press events first
Keys.onShortcutOverride: {
Keys.onShortcutOverride: function(event) {
event.accepted = (event.key === Qt.Key_Up || event.key === Qt.Key_Down)
}
@@ -119,7 +119,7 @@ TextInput {
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onPositionChanged: {
onPositionChanged: function(mouse) {
if (!mouseArea.dragging
&& !myControl.edit
&& Math.abs(mouseArea.pressStartX - mouse.x) > StudioTheme.Values.dragThreshold
@@ -149,7 +149,7 @@ TextInput {
onCanceled: mouseArea.endDrag()
onClicked: {
onClicked: function(mouse) {
if (textInput.edit)
mouse.accepted = false
@@ -162,7 +162,7 @@ TextInput {
textInput.deselect() // QTBUG-75862
}
onPressed: {
onPressed: function(mouse) {
if (textInput.edit)
mouse.accepted = false
@@ -170,7 +170,7 @@ TextInput {
mouseArea.pressStartX = mouseArea.mouseX
}
onReleased: {
onReleased: function(mouse) {
if (textInput.edit)
mouse.accepted = false
@@ -213,7 +213,7 @@ TextInput {
callback()
}
onWheel: {
onWheel: function(wheel) {
if (!myControl.__wheelEnabled)
return

View File

@@ -33,20 +33,16 @@ Item {
property int leftPadding: 8
property int topPadding: 4
property int rightPadding: 0
property int animationDuration: 120
property bool expanded: true
clip: true
Rectangle {
id: header
height: StudioTheme.Values.sectionHeadHeight
anchors.left: parent.left
anchors.right: parent.right
height: StudioTheme.Values.sectionHeadHeight
color: StudioTheme.Values.themeSectionHeadBackground
SectionLabel {

View File

@@ -217,8 +217,8 @@ T.Slider {
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
// Sets the global hover
onContainsMouseChanged: slider.hover = containsMouse
onPressed: mouse.accepted = false
onContainsMouseChanged: slider.hover = mouseArea.containsMouse
onPressed: function(mouse) { mouse.accepted = false }
}
states: [

View File

@@ -41,7 +41,7 @@ T.SpinBox {
property bool edit: spinBoxInput.activeFocus
// This property is used to indicate the global hover state
property bool hover: mySpinBox.hovered || actionIndicator.hover
property bool hover: (mySpinBox.hovered || actionIndicator.hover) && mySpinBox.enabled
property bool drag: false
property bool sliderDrag: sliderPopup.drag
@@ -164,10 +164,8 @@ T.SpinBox {
width: mySpinBox.width - actionIndicator.width - (StudioTheme.Values.border * 2)
height: StudioTheme.Values.sliderHeight
enter: Transition {
}
exit: Transition {
}
enter: Transition {}
exit: Transition {}
}
textFromValue: function (value, locale) {
@@ -256,7 +254,7 @@ T.SpinBox {
sliderPopup.close()
}
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
event.accepted = true

View File

@@ -32,7 +32,7 @@ Rectangle {
property T.Control myControl
property bool hover: spinBoxIndicatorMouseArea.containsMouse
property bool hover: spinBoxIndicatorMouseArea.containsMouse && spinBoxIndicator.enabled
property bool pressed: spinBoxIndicatorMouseArea.containsPress
property alias iconFlip: spinBoxIndicatorIconScale.yScale
@@ -46,7 +46,7 @@ Rectangle {
id: spinBoxIndicatorMouseArea
anchors.fill: parent
hoverEnabled: true
onPressed: {
onPressed: function(mouse) {
if (myControl.activeFocus)
spinBoxIndicator.forceActiveFocus()

View File

@@ -34,7 +34,7 @@ TextInput {
property bool edit: textInput.activeFocus
property bool drag: false
property bool hover: mouseArea.containsMouse
property bool hover: mouseArea.containsMouse && textInput.enabled
z: 2
font: myControl.font
@@ -57,7 +57,7 @@ TextInput {
// TextInput focus needs to be set to activeFocus whenever it changes,
// otherwise TextInput will get activeFocus whenever the parent SpinBox gets
// activeFocus. This will lead to weird side effects.
onActiveFocusChanged: textInput.focus = activeFocus
onActiveFocusChanged: textInput.focus = textInput.activeFocus
Rectangle {
id: textInputBackground
@@ -115,8 +115,8 @@ TextInput {
propagateComposedEvents: true
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onPressed: mouse.accepted = false
onWheel: {
onPressed: function(mouse) { mouse.accepted = false }
onWheel: function(wheel) {
if (!myControl.__wheelEnabled)
return

View File

@@ -127,7 +127,7 @@ TextField {
myTextField.text = txtStorage.slice(0, sliceAt).padEnd(sliceAt + 3, '.')
}
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape)
popup.opened ? popup.close() : myTextField.focus = false

View File

@@ -34,8 +34,8 @@ T.TextField {
property alias translationIndicator: translationIndicator
// This property is used to indicate the global hover state
property bool hover: actionIndicator.hover || mouseArea.containsMouse
|| translationIndicator.hover
property bool hover: (actionIndicator.hover || mouseArea.containsMouse
|| translationIndicator.hover) && myTextField.enabled
property bool edit: myTextField.activeFocus
property alias actionIndicatorVisible: actionIndicator.visible
@@ -75,7 +75,7 @@ T.TextField {
propagateComposedEvents: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onPressed: {
onPressed: function(mouse) {
if (mouse.button === Qt.RightButton)
contextMenu.popup(myTextField)
@@ -147,6 +147,7 @@ T.TextField {
State {
name: "globalHover"
when: (actionIndicator.hover || translationIndicator.hover) && !myTextField.edit
&& myTextField.enabled
PropertyChanges {
target: textFieldBackground
color: StudioTheme.Values.themeControlBackgroundGlobalHover
@@ -160,7 +161,7 @@ T.TextField {
State {
name: "hover"
when: mouseArea.containsMouse && !actionIndicator.hover && !translationIndicator.hover
&& !myTextField.edit
&& !myTextField.edit && myTextField.enabled
PropertyChanges {
target: textFieldBackground
color: StudioTheme.Values.themeControlBackgroundHover
@@ -203,7 +204,7 @@ T.TextField {
}
]
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape)
myTextField.focus = false
}

View File

@@ -32,7 +32,7 @@ Item {
property Item myControl
property bool hover: translationIndicatorMouseArea.containsMouse
property bool hover: translationIndicatorMouseArea.containsMouse && translationIndicator.enabled
property bool pressed: translationIndicatorMouseArea.pressed
property bool checked: false
@@ -62,7 +62,7 @@ Item {
id: translationIndicatorMouseArea
anchors.fill: parent
hoverEnabled: true
onPressed: mouse.accepted = true // TODO
onPressed: function(mouse) { mouse.accepted = true }
onClicked: {
translationIndicator.checked = !translationIndicator.checked
translationIndicator.clicked()