From 3e4636151897d0022743aec73046182d89a5862a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 8 Feb 2016 12:44:01 -0800 Subject: 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 --- qt-mobile/qml/DiveDetailsView.qml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'qt-mobile') 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 { -- cgit v1.2.3-70-g09d2