diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-02-08 12:44:01 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-08 12:44:01 -0800 |
commit | 3e4636151897d0022743aec73046182d89a5862a (patch) | |
tree | a031210e31537fbd78eca5c0d35317fa37b8bc1d | |
parent | c6a844fbad02680fd37bd6b5dbece95dd89f007a (diff) | |
download | subsurface-3e4636151897d0022743aec73046182d89a5862a.tar.gz |
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>
-rw-r--r-- | qt-mobile/qml/DiveDetailsView.qml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-mobile/qml/DiveDetailsView.qml b/qt-mobile/qml/DiveDetailsView.qml index 606bc2973..b182a8424 100644 --- a/qt-mobile/qml/DiveDetailsView.qml +++ b/qt-mobile/qml/DiveDetailsView.qml @@ -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 { |