QML UI: DiveDetailsView - set fixed column widths

In order for wrapping to work, the Text and TextEdit elements need to have
a defined width. Normally the GridLayout is supposed to be able to figure
out optimal widths for the different colums if you tell it which ones
should stretch, but that has repeatedly caused infinite loops and crashes
in the layout engine.

For now, in order to get both wrapping (and therefore no clipping of the
content) and avoid crashes, we hard code the width of the four columns by
setting Layout.maxWidth for each element in the first row of the grid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-02-08 12:44:01 -08:00
parent c6a844fbad
commit 3e46361518

View file

@ -139,28 +139,33 @@ Item {
Layout.columnSpan: 4
}
// first row - here we set up the column widths - total is 90% of width
MobileComponents.Label {
text: "Suit:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtSuit
text: dive.suit
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.36
}
MobileComponents.Label {
text: "Air Temp:"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
opacity: 0.6
Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
Layout.alignment: Qt.AlignRight
}
MobileComponents.Label {
id: txtAirTemp
text: dive.airTemp
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: subsurfaceTheme.columnWidth * 0.18
}
MobileComponents.Label {