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

View File

@@ -69,7 +69,7 @@ T.AbstractButton {
}, },
State { State {
name: "hovered" name: "hovered"
when: myButton.hovered && !myButton.pressed when: myButton.enabled && myButton.hovered && !myButton.pressed
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundHover color: StudioTheme.Values.themeControlBackgroundHover
@@ -77,7 +77,7 @@ T.AbstractButton {
}, },
State { State {
name: "pressed" name: "pressed"
when: myButton.hovered && myButton.pressed when: myButton.enabled && myButton.hovered && myButton.pressed
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundInteraction 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 QtQuick.Layouts 1.0
RowLayout { 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -23,22 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
Row { Row {
id: buttonRow id: buttonRow
property bool exclusive: false property bool exclusive: false
property int initalChecked: 0 property int initalChecked: 0
property int checkedIndex: 0 property int checkedIndex: 0
signal toggled (int index, bool checked) signal toggled (int index, bool checked)
Component.onCompleted: {
}
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -159,7 +159,7 @@ StudioControls.TextField {
onPressed: listView.model = null onPressed: listView.model = null
Keys.priority: Keys.BeforeItem Keys.priority: Keys.BeforeItem
Keys.onPressed: { Keys.onPressed: function(event) {
var text = textField.text var text = textField.text
var pos = textField.cursorPosition var pos = textField.cursorPosition
var explicitComplete = true var explicitComplete = true
@@ -220,7 +220,7 @@ StudioControls.TextField {
listView.model = list listView.model = list
} }
Keys.onSpacePressed: { Keys.onSpacePressed: function(event) {
if (event.modifiers & Qt.ControlModifier) { if (event.modifiers & Qt.ControlModifier) {
var list = autoComplete(textField.text, textField.cursorPosition, true, textField.completeOnlyTypes) var list = autoComplete(textField.text, textField.cursorPosition, true, textField.completeOnlyTypes)
textField.prefix = textField.text.substring(0, textField.cursorPosition) textField.prefix = textField.text.substring(0, textField.cursorPosition)
@@ -236,7 +236,7 @@ StudioControls.TextField {
} }
} }
Keys.onReturnPressed: { Keys.onReturnPressed: function(event) {
event.accepted = false event.accepted = false
if (textField.completionActive) { if (textField.completionActive) {
textField.commitCompletion() textField.commitCompletion()
@@ -244,7 +244,7 @@ StudioControls.TextField {
} }
} }
Keys.onEscapePressed: { Keys.onEscapePressed: function(event) {
event.accepted = true event.accepted = true
if (textField.completionActive) { if (textField.completionActive) {
listView.model = null listView.model = null
@@ -253,12 +253,12 @@ StudioControls.TextField {
} }
} }
Keys.onUpPressed: { Keys.onUpPressed: function(event) {
listView.decrementCurrentIndex() listView.decrementCurrentIndex()
event.accepted = false event.accepted = false
} }
Keys.onDownPressed: { Keys.onDownPressed: function(event) {
listView.incrementCurrentIndex() listView.incrementCurrentIndex()
event.accepted = false 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme import StudioTheme 1.0 as StudioTheme
import QtQuickDesignerTheme 1.0 import QtQuickDesignerTheme 1.0
@@ -70,17 +70,9 @@ Item {
} }
} }
onBackendValueChanged: { onBackendValueChanged: setIcon()
setIcon() onIsBoundBackendChanged: setIcon()
} onBackendExpressionChanged: setIcon()
onIsBoundBackendChanged: {
setIcon()
}
onBackendExpressionChanged: {
setIcon()
}
Loader { Loader {
id: menuLoader id: menuLoader
@@ -101,15 +93,11 @@ Item {
exportMenuItem.enabled = !backendValue.isAttachedProperty() exportMenuItem.enabled = !backendValue.isAttachedProperty()
extendedFunctionButton.menuVisible = true extendedFunctionButton.menuVisible = true
} }
onAboutToHide: { onAboutToHide: extendedFunctionButton.menuVisible = false
extendedFunctionButton.menuVisible = false
}
Connections { Connections {
target: modelNodeBackend target: modelNodeBackend
onSelectionChanged: { onSelectionChanged: menu.close()
menu.close()
}
} }
StudioControls.MenuItem { StudioControls.MenuItem {
@@ -121,20 +109,22 @@ Item {
extendedFunctionButton.reseted() extendedFunctionButton.reseted()
} }
} }
StudioControls.MenuItem { StudioControls.MenuItem {
text: qsTr("Set Binding") text: qsTr("Set Binding")
onTriggered: expressionDialogLoader.show() onTriggered: expressionDialogLoader.show()
} }
StudioControls.MenuItem { StudioControls.MenuItem {
id: exportMenuItem id: exportMenuItem
text: qsTr("Export Property as Alias") text: qsTr("Export Property as Alias")
checkable: true
onTriggered: { onTriggered: {
if (checked) if (checked)
backendValue.exportPopertyAsAlias() backendValue.exportPopertyAsAlias()
else else
backendValue.removeAliasExport() backendValue.removeAliasExport()
} }
checkable: true
} }
StudioControls.MenuItem { StudioControls.MenuItem {
@@ -150,13 +140,13 @@ Item {
id: expressionDialogLoader id: expressionDialogLoader
parent: itemPane parent: itemPane
anchors.fill: parent anchors.fill: parent
visible: false visible: false
active: visible active: visible
function show() { function show() {
expressionDialogLoader.visible = true expressionDialogLoader.visible = true
} }
sourceComponent: Item { sourceComponent: Item {
id: bindingEditorParent id: bindingEditorParent
@@ -176,6 +166,7 @@ Item {
hideWidget() hideWidget()
expressionDialogLoader.visible = false expressionDialogLoader.visible = false
} }
onAccepted: { onAccepted: {
backendValue.expression = bindingEditor.text.trim() backendValue.expression = bindingEditor.text.trim()
hideWidget() hideWidget()

View File

@@ -34,6 +34,7 @@ StudioControls.ComboBox {
property variant backendValue property variant backendValue
property color textColor: colorLogic.textColor property color textColor: colorLogic.textColor
property string fontFilter: "*.ttf *.otf" property string fontFilter: "*.ttf *.otf"
property bool showExtendedFunctionButton: true
labelColor: colorLogic.textColor labelColor: colorLogic.textColor
editable: true editable: true
@@ -63,9 +64,7 @@ StudioControls.ComboBox {
comboBox.model = familyNames comboBox.model = familyNames
} }
onModelChanged: { onModelChanged: editText = comboBox.backendValue.valueToString
editText = comboBox.backendValue.valueToString
}
ExtendedFunctionLogic { ExtendedFunctionLogic {
id: extFuncLogic id: extFuncLogic
@@ -76,18 +75,13 @@ StudioControls.ComboBox {
actionIndicator.icon.text: extFuncLogic.glyph actionIndicator.icon.text: extFuncLogic.glyph
actionIndicator.onClicked: extFuncLogic.show() actionIndicator.onClicked: extFuncLogic.show()
actionIndicator.forceVisible: extFuncLogic.menuVisible actionIndicator.forceVisible: extFuncLogic.menuVisible
actionIndicator.visible: comboBox.showExtendedFunctionButton
property bool showExtendedFunctionButton: true
actionIndicator.visible: showExtendedFunctionButton
ColorLogic { ColorLogic {
id: colorLogic id: colorLogic
backendValue: comboBox.backendValue
property string textValue: comboBox.backendValue.valueToString property string textValue: comboBox.backendValue.valueToString
onTextValueChanged: { backendValue: comboBox.backendValue
comboBox.editText = textValue onTextValueChanged: comboBox.editText = colorLogic.textValue
}
} }
onAccepted: { onAccepted: {
@@ -124,7 +118,7 @@ StudioControls.ComboBox {
Component.onCompleted: { Component.onCompleted: {
setupModel() setupModel()
//Hack to style the text input // Hack to style the text input
for (var i = 0; i < comboBox.children.length; i++) { for (var i = 0; i < comboBox.children.length; i++) {
if (comboBox.children[i].text !== undefined) { if (comboBox.children[i].text !== undefined) {
comboBox.children[i].color = comboBox.textColor comboBox.children[i].color = comboBox.textColor
@@ -135,7 +129,7 @@ StudioControls.ComboBox {
} }
function setColor() { function setColor() {
//Hack to style the text input // Hack to style the text input
for (var i = 0; i < comboBox.children.length; i++) { for (var i = 0; i < comboBox.children.length; i++) {
if (comboBox.children[i].text !== undefined) { if (comboBox.children[i].text !== undefined) {
comboBox.children[i].color = comboBox.textColor 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 QtQuick.Layouts 1.0
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -23,8 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.15
Image { Image {
id: root id: root

View File

@@ -81,12 +81,8 @@ HelperWindow {
Layout.fillWidth: true Layout.fillWidth: true
StudioControls.TabButton { StudioControls.TabButton { text: qsTr("System Presets") }
text: qsTr("System Presets") StudioControls.TabButton { text: qsTr("User Presets") }
}
StudioControls.TabButton {
text: qsTr("User Presets")
}
} }
StackLayout { StackLayout {
@@ -103,11 +99,13 @@ HelperWindow {
id: customTabContent id: customTabContent
viewModel: customPresetListModel viewModel: customPresetListModel
editableName: true editableName: true
onPresetNameChanged: customPresetListModel.changePresetName(id, name) onPresetNameChanged: function(id, name) {
customPresetListModel.changePresetName(id, name)
}
property int deleteId property int deleteId
onDeleteButtonClicked: { onDeleteButtonClicked: function(id) {
deleteId = id deleteId = id
deleteDialog.open() deleteDialog.open()
} }
@@ -116,7 +114,7 @@ HelperWindow {
id: deleteDialog id: deleteDialog
visible: false visible: false
modality: Qt.WindowModal modality: Qt.WindowModal
buttons: StandardButton.No | StandardButton.Yes buttons: StandardButton.No | StandardButton.Yes
title: qsTr("Delete preset?") title: qsTr("Delete preset?")
text: qsTr("Are you sure you want to delete this preset?") text: qsTr("Are you sure you want to delete this preset?")
onAccepted: customPresetListModel.deletePreset(customTabContent.deleteId) onAccepted: customPresetListModel.deletePreset(customTabContent.deleteId)

View File

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

View File

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

View File

@@ -68,7 +68,7 @@ Rectangle {
states: [ states: [
State { State {
name: "default" name: "default"
when: !toolTipArea.containsMouse when: !toolTipArea.containsMouse && root.enabled
PropertyChanges { PropertyChanges {
target: indicatorIcon target: indicatorIcon
color: StudioTheme.Values.themeLinkIndicatorColor color: StudioTheme.Values.themeLinkIndicatorColor
@@ -76,11 +76,19 @@ Rectangle {
}, },
State { State {
name: "hover" name: "hover"
when: toolTipArea.containsMouse when: toolTipArea.containsMouse && root.enabled
PropertyChanges { PropertyChanges {
target: indicatorIcon target: indicatorIcon
color: StudioTheme.Values.themeLinkIndicatorColorHover 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 HelperWidgets 2.0
import QtQuick.Layouts 1.0
MouseArea { MouseArea {
id: mouseArea id: mouseArea
@@ -35,7 +35,7 @@ MouseArea {
onExited: tooltipBackend.hideTooltip() onExited: tooltipBackend.hideTooltip()
onCanceled: tooltipBackend.hideTooltip() onCanceled: tooltipBackend.hideTooltip()
onPositionChanged: tooltipBackend.reposition() onPositionChanged: tooltipBackend.reposition()
onClicked: { onClicked: function(mouse) {
forceActiveFocus() forceActiveFocus()
if (mouse.button === Qt.RightButton) if (mouse.button === Qt.RightButton)
showContextMenu() 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Quick 3D. ** 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 HelperWidgets 2.0 as HelperWidgets
HelperWidgets.ComboBox { HelperWidgets.ComboBox {

View File

@@ -138,7 +138,7 @@ StudioControls.TextField {
var textValue = lineEdit.text var textValue = lineEdit.text
lineEdit.backendValue.value = textValue lineEdit.backendValue.value = textValue
} }
colorLogic.evaluate(); colorLogic.evaluate()
} }
property variant backendValueValueInternal: backendValue === undefined ? 0 : backendValue.value property variant backendValueValueInternal: backendValue === undefined ? 0 : backendValue.value
@@ -157,13 +157,13 @@ StudioControls.TextField {
} }
function escapeString(string) { function escapeString(string) {
var str = string; var str = string
str = str.replace(/\\/g, "\\\\"); str = str.replace(/\\/g, "\\\\")
str.replace(/\"/g, "\\\""); str.replace(/\"/g, "\\\"")
str = str.replace(/\t/g, "\\t"); str = str.replace(/\t/g, "\\t")
str = str.replace(/\r/g, "\\r"); str = str.replace(/\r/g, "\\r")
str = str.replace(/\n/g, '\\n'); str = str.replace(/\n/g, '\\n')
return str; 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Quick 3D. ** 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 HelperWidgets 2.0 as HelperWidgets
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls

View File

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

View File

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

View File

@@ -42,7 +42,7 @@ Rectangle {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: myControl.originSelectorClicked(value) onClicked: myControl.originSelectorClicked(root.value)
} }
states: [ 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -23,8 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0 import QtQuickDesignerTheme 1.0
import StudioTheme 1.0 as StudioTheme 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.

View File

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

View File

@@ -23,8 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.12 import QtQuick 2.15
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.15
Item { Item {
height: 4 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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 HelperWidgets 2.0
import QtQuick.Layouts 1.0
MouseArea { MouseArea {
id: mouseArea id: mouseArea
Tooltip { Tooltip { id: myTooltip }
id: myTooltip
}
onExited: myTooltip.hideText() onExited: myTooltip.hideText()
onCanceled: myTooltip.hideText() onCanceled: myTooltip.hideText()

View File

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

View File

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

View File

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

View File

@@ -33,7 +33,7 @@ T.CheckBox {
property alias actionIndicator: actionIndicator property alias actionIndicator: actionIndicator
// This property is used to indicate the global hover state // 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 bool edit: false
property alias actionIndicatorVisible: actionIndicator.visible property alias actionIndicatorVisible: actionIndicator.visible

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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