QmlDesigner: Use new combobox for layout properties

Change-Id: I52e353011b290a59c66003db8b2becd4cd160820
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2019-07-01 16:24:56 +02:00
committed by Tim Jenssen
parent a93e9d7a7a
commit 868b07853d

View File

@@ -27,6 +27,7 @@ import QtQuick 2.0
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0 as Controls
import StudioControls 1.0 as StudioControls
SectionLayout {
property bool isInModel: backendValue.isInModel;
@@ -40,7 +41,7 @@ SectionLayout {
onBackendValueChanged: evaluateAlignment()
onValueFromBackendChanged: evaluateAlignment()
property int spinBoxWidth: 62
property int spinBoxWidth: 82
Connections {
target: modelNodeBackend
@@ -129,40 +130,43 @@ SectionLayout {
SecondColumnLayout {
Controls.ComboBox {
StudioControls.ComboBox {
ColorLogic {
id: colorLogic
}
Layout.fillWidth: true
ExtendedFunctionButton {
x: 2
anchors.verticalCenter: parent.verticalCenter
ExtendedFunctionLogic {
id: extFuncLogic
backendValue: backendValues.Layout_alignment
visible: horizontalAlignmentComboBox.enabled
onReseted: {
horizontalAlignmentComboBox.currentIndex = 0
verticalAlignmentComboBox.currentIndex = 0
}
}
actionIndicator.icon.color: extFuncLogic.color
actionIndicator.icon.text: extFuncLogic.glyph
actionIndicator.onClicked: extFuncLogic.show()
actionIndicator.visible: true
labelColor: horizontalAlignmentComboBox.currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
id: horizontalAlignmentComboBox
property bool __isCompleted: false
property color textColor: currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
model: ["AlignLeft", "AlignHCenter", "AlignRight"]
onCurrentIndexChanged: {
onActivated: {
if (!horizontalAlignmentComboBox.__isCompleted)
return;
horizontalAlignmentComboBox.currentIndex = index
composeExpressionString();
}
style: CustomComboBoxStyle {
textColor: horizontalAlignmentComboBox.textColor
}
Component.onCompleted: {
horizontalAlignmentComboBox.__isCompleted = true;
}
@@ -181,36 +185,30 @@ SectionLayout {
SecondColumnLayout {
Controls.ComboBox {
StudioControls.ComboBox {
id: verticalAlignmentComboBox
Layout.fillWidth: true
ExtendedFunctionButton {
x: 2
anchors.verticalCenter: parent.verticalCenter
backendValue: backendValues.Layout_alignment
visible: verticalAlignmentComboBox.enabled
onReseted: {
horizontalAlignmentComboBox.currentIndex = 0
verticalAlignmentComboBox.currentIndex = 0
}
}
actionIndicator.icon.color: extFuncLogic.color
actionIndicator.icon.text: extFuncLogic.glyph
actionIndicator.onClicked: extFuncLogic.show()
actionIndicator.visible: true
labelColor: verticalAlignmentComboBox.currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
property bool __isCompleted: false
property color textColor: currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
model: ["AlignVCenter", "AlignTop","AlignBottom","AlignBaseline"]
onCurrentIndexChanged: {
onActivated: {
if (!verticalAlignmentComboBox.__isCompleted)
return;
verticalAlignmentComboBox.currentIndex = index
composeExpressionString();
}
style: CustomComboBoxStyle {
textColor: verticalAlignmentComboBox.textColor
}
Component.onCompleted: {
verticalAlignmentComboBox.__isCompleted = true;
}