aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2016-05-04 07:30:55 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-05-03 15:21:55 -0700
commit9aa95dc233d91bf2f10ea1cf79dec0ff13379c2d (patch)
tree3ac7fcf0668fa855e8b2d6cf1432f26216d7456a
parentd8699110d3cb85c19616b077daba7953243dac05 (diff)
downloadsubsurface-9aa95dc233d91bf2f10ea1cf79dec0ff13379c2d.tar.gz
QML Set width instead of minimumWidth equal to maximumWidth
The QML manual advises against setting width property of gridLayout children directly, and recommends setting preferred, min and/or max width instead, letting QML do the work to determine the optimum width. But we've found letting QML determine gridLayout widths leads to infinite loops in too many situations, so we're forcing a width. It's better to force a width by setting it directly, rather than setting minimum = maximum. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DiveDetailsView.qml36
1 files changed, 12 insertions, 24 deletions
diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml
index 6a4dd902e..6a514acea 100644
--- a/mobile-widgets/qml/DiveDetailsView.qml
+++ b/mobile-widgets/qml/DiveDetailsView.qml
@@ -144,8 +144,7 @@ Item {
text: qsTr("Suit:")
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: detailsView.col1Width
- Layout.minimumWidth: detailsView.col1Width
+ width: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
@@ -159,23 +158,20 @@ Item {
text: qsTr("Air Temp:")
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: detailsView.col3Width
- Layout.minimumWidth: detailsView.col3Width
+ width: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
id: txtAirTemp
text: dive.airTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: detailsView.col4Width
- Layout.minimumWidth: detailsView.col4Width
+ width: detailsView.col4Width
}
Kirigami.Label {
text: qsTr("Cylinder:")
opacity: 0.6
- Layout.maximumWidth: detailsView.col1Width
- Layout.minimumWidth: detailsView.col1Width
+ width: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
@@ -189,24 +185,21 @@ Item {
text: qsTr("Water Temp:")
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: detailsView.col3Width
- Layout.minimumWidth: detailsView.col3Width
+ width: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
id: txtWaterTemp
text: dive.waterTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: detailsView.col4Width
- Layout.minimumWidth: detailsView.col4Width
+ width: detailsView.col4Width
}
Kirigami.Label {
text: qsTr("Dive Master:")
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: detailsView.col1Width
- Layout.minimumWidth: detailsView.col1Width
+ width: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
@@ -219,16 +212,14 @@ Item {
Kirigami.Label {
text: qsTr("Weight:")
opacity: 0.6
- Layout.maximumWidth: detailsView.col3Width
- Layout.minimumWidth: detailsView.col3Width
+ width: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
id: txtWeight
text: dive.sumWeight
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: detailsView.col4Width
- Layout.minimumWidth: detailsView.col4Width
+ width: detailsView.col4Width
}
}
// clearly, Qt 5.6.0 is buggy as having this as one GridLayout
@@ -248,8 +239,7 @@ Item {
Kirigami.Label {
text: qsTr("Buddy:")
opacity: 0.6
- Layout.maximumWidth: detailsView.col1Width
- Layout.minimumWidth: detailsView.col1Width
+ width: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
@@ -262,16 +252,14 @@ Item {
Kirigami.Label {
text: qsTr("SAC:")
opacity: 0.6
- Layout.maximumWidth: detailsView.col3Width
- Layout.minimumWidth: detailsView.col3Width
+ width: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
Kirigami.Label {
id: txtSAC
text: dive.sac
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: detailsView.col4Width
- Layout.minimumWidth: detailsView.col4Width
+ width: detailsView.col4Width
}
Kirigami.Heading {