QmlDesigner: Cleanup layout specifics

* Add missing drag range property to AnchorRow, MarginSection and
   PaddingSection SpinBoxes
 * Use MarginSection for LayoutProperties

Change-Id: I656fc0df353a16477a1ad0279af7186899f5f7e6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Henning Gruendl
2019-10-01 10:48:16 +02:00
committed by Henning Gründl
parent 15bf546ff9
commit cf6a88c3ae
6 changed files with 62 additions and 160 deletions

View File

@@ -100,6 +100,7 @@ RowLayout {
maximumValue: 0xffff
minimumValue: -0xffff
backendValue: anchorMargin
realDragRange: 5000
}
StudioControls.ButtonRow {

View File

@@ -27,6 +27,8 @@ import QtQuick 2.0
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
Rectangle {
id: itemPane
@@ -284,6 +286,15 @@ Rectangle {
tabView.layoutSectionHeight = childRectHeight + tabView.extraHeight
}
}
MarginSection {
visible: anchorBackend.isInLayout
backendValueTopMargin: backendValues.Layout_topMargin
backendValueBottomMargin: backendValues.Layout_bottomMargin
backendValueLeftMargin: backendValues.Layout_leftMargin
backendValueRightMargin: backendValues.Layout_rightMargin
backendValueMargins: backendValues.Layout_margins
}
}
}

View File

@@ -26,7 +26,6 @@
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 {
@@ -71,11 +70,9 @@ SectionLayout {
return 3;
return 0;
}
function indexOfHorizontalAlignment() {
if (backendValue.expression === undefined)
return 0;
@@ -89,11 +86,9 @@ SectionLayout {
return 2;
return 0;
}
function evaluateAlignment() {
blockAlignment = true
verticalAlignmentComboBox.currentIndex = indexOfVerticalAlignment();
@@ -119,17 +114,14 @@ SectionLayout {
backendValue.expression = expressionStr
backendValue.resetValue();
}
}
Label {
text: qsTr("Alignment")
tooltip: qsTr("Alignment of an item within the cells it occupies.")
}
SecondColumnLayout {
StudioControls.ComboBox {
ColorLogic {
id: colorLogic
@@ -139,7 +131,7 @@ SectionLayout {
ExtendedFunctionLogic {
id: extFuncLogic
backendValue: backendValues.Layout_alignment
onReseted: {
onReseted: {
horizontalAlignmentComboBox.currentIndex = 0
verticalAlignmentComboBox.currentIndex = 0
}
@@ -170,21 +162,13 @@ SectionLayout {
Component.onCompleted: {
horizontalAlignmentComboBox.__isCompleted = true;
}
}
ExpandingSpacer {
}
}
Label {
}
SecondColumnLayout {
StudioControls.ComboBox {
id: verticalAlignmentComboBox
Layout.fillWidth: true
@@ -199,7 +183,7 @@ SectionLayout {
property bool __isCompleted: false
model: ["AlignVCenter", "AlignTop","AlignBottom","AlignBaseline"]
model: ["AlignVCenter", "AlignTop", "AlignBottom", "AlignBaseline"]
onActivated: {
if (!verticalAlignmentComboBox.__isCompleted)
@@ -212,13 +196,7 @@ SectionLayout {
Component.onCompleted: {
verticalAlignmentComboBox.__isCompleted = true;
}
}
ExpandingSpacer {
}
}
Label {
@@ -230,21 +208,13 @@ SectionLayout {
CheckBox {
backendValue: backendValues.Layout_fillWidth
text: qsTr("Fill width")
}
Item {
width: 10
height: 10
Layout.fillWidth: true
}
CheckBox {
backendValue: backendValues.Layout_fillHeight
text: qsTr("Fill height")
}
ExpandingSpacer {
Layout.fillWidth: true
}
}
@@ -258,15 +228,15 @@ SectionLayout {
Label {
text: "W"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_preferredWidth
maximumValue: 0xffff
minimumValue: -1
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
Item {
@@ -276,18 +246,15 @@ SectionLayout {
Label {
text: "H"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_preferredHeight
maximumValue: 0xffff
minimumValue: -1
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
@@ -301,15 +268,15 @@ SectionLayout {
Label {
text: "W"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_minimumWidth
maximumValue: 0xffff
minimumValue: 0
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
Item {
@@ -319,18 +286,15 @@ SectionLayout {
Label {
text: "H"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_minimumHeight
maximumValue: 0xffff
minimumValue: 0
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
@@ -344,15 +308,15 @@ SectionLayout {
Label {
text: "W"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_maximumWidth
maximumValue: 0xffff
minimumValue: 0
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
Item {
@@ -362,102 +326,15 @@ SectionLayout {
Label {
text: "H"
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_maximumHeight
maximumValue: 0xffff
minimumValue: 0
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Margins")
}
SecondColumnLayout {
Layout.fillWidth: true
Label {
text: "Top"
width: 28
}
SpinBox {
backendValue: backendValues.Layout_topMargin
maximumValue: 0xffff
minimumValue: 0
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
Item {
width: 4
height: 4
}
Label {
text: "Bottom"
width: 28
}
SpinBox {
backendValue: backendValues.Layout_bottomMargin
maximumValue: 0xffff
minimumValue: 0
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
Label {
text: ("")
}
SecondColumnLayout {
Layout.fillWidth: true
Label {
text: "Left"
width: 28
}
SpinBox {
backendValue: backendValues.Layout_leftMargin
maximumValue: 0xffff
minimumValue: 0
decimals: 0
implicitWidth: root.spinBoxWidth
}
Item {
width: 4
height: 4
}
Label {
text: "Right"
width: 28
}
SpinBox {
backendValue: backendValues.Layout_rightMargin
maximumValue: 0xffff
minimumValue: 0
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
@@ -471,19 +348,15 @@ SectionLayout {
Item {
height: 4
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_rowSpan
maximumValue: 0xffff
minimumValue: 0
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
@@ -497,19 +370,15 @@ SectionLayout {
Item {
height: 4
width: 28
width: 12
}
SpinBox {
backendValue: backendValues.Layout_columnSpan
maximumValue: 0xffff
minimumValue: 0
maximumValue: 0xffff
realDragRange: 5000
decimals: 0
implicitWidth: root.spinBoxWidth
}
ExpandingSpacer {
}
}
}

View File

@@ -26,7 +26,8 @@
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
import StudioTheme 1.0 as StudioTheme
Section {
anchors.left: parent.left
@@ -167,6 +168,5 @@ Section {
verticalAnchor: true
buttonRow.visible: false
}
}
}

View File

@@ -34,6 +34,12 @@ Section {
anchors.left: parent.left
anchors.right: parent.right
property alias backendValueTopMargin: spinBoxTopMargin.backendValue
property alias backendValueBottomMargin: spinBoxBottomMargin.backendValue
property alias backendValueLeftMargin: spinBoxLeftMargin.backendValue
property alias backendValueRightMargin: spinBoxRightMargin.backendValue
property alias backendValueMargins: spinBoxMargins.backendValue
SectionLayout {
Label {
text: qsTr("Vertical")
@@ -45,8 +51,10 @@ Section {
width: 42
}
SpinBox {
id: spinBoxTopMargin
minimumValue: -10000
maximumValue: 10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.topMargin
Layout.fillWidth: true
@@ -62,8 +70,10 @@ Section {
width: 42
}
SpinBox {
id: spinBoxBottomMargin
minimumValue: -10000
maximumValue: 10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.bottomMargin
Layout.fillWidth: true
@@ -80,8 +90,10 @@ Section {
width: 42
}
SpinBox {
id: spinBoxLeftMargin
minimumValue: -10000
maximumValue: 10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.leftMargin
Layout.fillWidth: true
@@ -97,8 +109,10 @@ Section {
width: 42
}
SpinBox {
id: spinBoxRightMargin
minimumValue: -10000
maximumValue: 10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.rightMargin
Layout.fillWidth: true
@@ -111,8 +125,10 @@ Section {
}
SecondColumnLayout {
SpinBox {
id: spinBoxMargins
minimumValue: -10000
maximumValue: 10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.margins
Layout.fillWidth: true

View File

@@ -47,6 +47,7 @@ Section {
SpinBox {
maximumValue: 10000
minimumValue: -10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.topPadding
Layout.fillWidth: true
@@ -64,6 +65,7 @@ Section {
SpinBox {
maximumValue: 10000
minimumValue: -10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.bottomPadding
Layout.fillWidth: true
@@ -82,6 +84,7 @@ Section {
SpinBox {
maximumValue: 10000
minimumValue: -10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.leftPadding
Layout.fillWidth: true
@@ -99,6 +102,7 @@ Section {
SpinBox {
maximumValue: 10000
minimumValue: -10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.rightPadding
Layout.fillWidth: true
@@ -113,6 +117,7 @@ Section {
SpinBox {
maximumValue: 10000
minimumValue: -10000
realDragRange: 5000
decimals: 0
backendValue: backendValues.padding
Layout.fillWidth: true