aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/DiveDetailsView.qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 13:25:29 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 13:25:29 -0800
commit0f6b8a8f6f9b88a11dd1f4169bedde722479433c (patch)
treedab66c9e5f0772bc742aba80dfca558f84bf69af /qt-mobile/qml/DiveDetailsView.qml
parent3e4636151897d0022743aec73046182d89a5862a (diff)
downloadsubsurface-0f6b8a8f6f9b88a11dd1f4169bedde722479433c.tar.gz
QML UI: DiveDetailsView - calculate better width and set everywhere
Even setting things up in the first row isn't enough. Every field in the grid needs an explicit width. How dumb is that. To make this more manageable calculate the correct widths at the beginning and then just reference those properties. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml/DiveDetailsView.qml')
-rw-r--r--qt-mobile/qml/DiveDetailsView.qml24
1 files changed, 20 insertions, 4 deletions
diff --git a/qt-mobile/qml/DiveDetailsView.qml b/qt-mobile/qml/DiveDetailsView.qml
index b182a8424..7e678c5c3 100644
--- a/qt-mobile/qml/DiveDetailsView.qml
+++ b/qt-mobile/qml/DiveDetailsView.qml
@@ -12,6 +12,12 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
Item {
id: detailsView
property int labelWidth: MobileComponents.Units.gridUnit * 10
+ property real gridWidth: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
+ property real col1Width: gridWidth * 0.20
+ property real col2Width: gridWidth * 0.40
+ property real col3Width: gridWidth * 0.20
+ property real col4Width: gridWidth * 0.20
+
width: SubsurfaceTheme.columnWidth
height: mainLayout.implicitHeight + bottomLayout.implicitHeight + MobileComponents.Units.iconSizes.large
Rectangle {
@@ -144,82 +150,91 @@ Item {
text: "Suit:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
+ Layout.maximumWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtSuit
text: dive.suit
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.36
+ Layout.maximumWidth: detailsView.col2Width
}
MobileComponents.Label {
text: "Air Temp:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
- Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
+ Layout.maximumWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtAirTemp
text: dive.airTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
+ Layout.maximumWidth: detailsView.col4Width
}
MobileComponents.Label {
text: "Cylinder:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
+ Layout.maximumWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtCylinder
text: dive.getCylinder
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ Layout.maximumWidth: detailsView.col2Width
}
MobileComponents.Label {
text: "Water Temp:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
+ Layout.maximumWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtWaterTemp
text: dive.waterTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ Layout.maximumWidth: detailsView.col4Width
}
MobileComponents.Label {
text: "Dive Master:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
+ Layout.maximumWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtDiveMaster
text: dive.divemaster
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ Layout.maximumWidth: detailsView.col2Width
}
MobileComponents.Label {
text: "Weight:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
+ Layout.maximumWidth: detailsView.col3Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtWeight
text: dive.sumWeight
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ Layout.maximumWidth: detailsView.col4Width
}
MobileComponents.Label {
text: "Buddy:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
+ Layout.maximumWidth: detailsView.col1Width
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
@@ -227,6 +242,7 @@ Item {
text: dive.buddy
Layout.columnSpan: 3
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ Layout.maximumWidth: detailsView.col2Width + detailsView.col3Width + detailsView.col4Width
}
MobileComponents.Heading {