On Mon, May 2, 2016 at 3:19 PM, Rick Walsh <[email protected]> wrote: > > > On 2 May 2016 at 22:33, Marco Martin <[email protected]> wrote: >> >> On Mon, May 2, 2016 at 5:14 AM, Thiago Macieira <[email protected]> >> wrote: >> > That means the layout is unstable. When asked for what its preferred >> > size is >> > on qquicklinearlayout.cpp:414 >> > const QSizeF pref = sizeHint(Qt::PreferredSize); >> > the answer does not stabilise. >> > >> > I have absolutely no idea how the layout engine works. The only hint I >> > have is >> > to check whether the constraints (the anchors) in whatever page is >> > causing >> > this issue make sense. >> >> I have a patch that even if is a bit a work around, I think it makes >> things more reliable anyways (so would be good even if the bug wasn't >> there). >> >> Can somebody hitting the crash on iOS or on the devel machine try to >> rebuild with attached patch? >> >> putting some debug around, I seen that the things that were actually >> returning a non stable size hint were some Label elements (so in the >> end the primitive Text element) >> those with "Buddy:" "Cylinder:" and so on. >> >> One thing I seen is that every single text element in that grid layout >> had wrap anywhere set. Regardless of the upstream bug that probably is >> indeed there, this can cause problems, as we have a grid of two >> columns, with each column having its width that depends from the width >> of the other. Since the implicit width depends from text layouting, if >> the text can wrap anywhere, if i resize the label, making it wrapping >> to two lines, its implicit width will change as well, so it seems this >> infinite recursion was due to the label answering once that it wanted >> its size as one line, the time after as wrapped in two lines, then as >> one line again etc. >> >> I think disabling wrapping for those small labels helps. it solves the >> crash for me. >> if as the attached patch disabling the wrapping altogether is deemed >> too much, using WordWrap as wrapmode would be already better (trying >> hard to wrap at word boundaries before splitting words). >> > I don't have an idevice, and my android build isn't working at the moment. > But I did test with subsurface-mobile on the desktop (Linux). The patch > appeared to make it less fragile, but I did still run into an infinite loop. > I think maybe you haven't gone far enough. I haven't tracked it down, but > I'm suspicious of anywhere we wrap AND set the preferred width (numerous > places in divedetailsview.qml).
Here is a different approach, thinking about it i like it a bit more. The fact that the numbers of the column sizes didn't add up when one considered the column spacing as well made me suspicious, (in general, setting a column of like one quarter of the layout size is to be avoided if the spacing in the layout is not 0) so i tried to make the last column just "take all the remaining space" rather than trying to have an exact size, and this seems to completely fix it for me. see attached patch. -- Marco Martin
From 477a6443fe7a6d07c26f90923965153cc669b470 Mon Sep 17 00:00:00 2001 From: Marco Martin <[email protected]> Date: Mon, 2 May 2016 16:48:03 +0200 Subject: [PATCH] Make the last column take all the available size The grid layout had each column fixed to a width taken as a portion of the grid width, but since the grid has a columnSpacing defined as well, the computation doesn't add up, helping in causing an infinite recursion problem in the attempt of sizing and positioning all the children of the layout Signed-off-by: Marco Martin <[email protected]> --- CMakeLists.txt | 2 +- mobile-widgets/qml/DiveDetailsView.qml | 39 +++++++++++++++------------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc7db13..b681473 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,5 +435,5 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if (MAKE_TESTS) - add_subdirectory(tests) +# add_subdirectory(tests) endif() diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml index f7b2980..efbf2bd 100644 --- a/mobile-widgets/qml/DiveDetailsView.qml +++ b/mobile-widgets/qml/DiveDetailsView.qml @@ -18,7 +18,7 @@ Item { property real col4Width: gridWidth * 0.20 width: diveDetailsPage.width - diveDetailsPage.leftPadding - diveDetailsPage.rightPadding - height: mainLayout.implicitHeight + bottomLayout.implicitHeight + Kirigami.Units.iconSizes.large + height: mainLayout.implicitHeight + bottomLayout.implicitHeight + bottomLayout2.implicitHeight + Kirigami.Units.iconSizes.large Rectangle { z: 99 color: Kirigami.Theme.textColor @@ -145,7 +145,7 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width - Layout.preferredWidth: detailsView.col1Width + Layout.minimumWidth: detailsView.col1Width Layout.alignment: Qt.AlignRight } Kirigami.Label { @@ -153,7 +153,7 @@ Item { text: dive.suit wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere Layout.maximumWidth: detailsView.col2Width - Layout.preferredWidth: detailsView.col2Width + Layout.minimumWidth: detailsView.col2Width } Kirigami.Label { @@ -161,15 +161,14 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width - Layout.preferredWidth: detailsView.col3Width + Layout.minimumWidth: detailsView.col3Width Layout.alignment: Qt.AlignRight } Kirigami.Label { id: txtAirTemp text: dive.airTemp wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere - Layout.maximumWidth: detailsView.col4Width - Layout.preferredWidth: detailsView.col4Width + Layout.fillWidth: true } Kirigami.Label { @@ -177,7 +176,7 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width - Layout.preferredWidth: detailsView.col1Width + Layout.minimumWidth: detailsView.col1Width Layout.alignment: Qt.AlignRight } Kirigami.Label { @@ -185,7 +184,7 @@ Item { text: dive.getCylinder wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere Layout.maximumWidth: detailsView.col2Width - Layout.preferredWidth: detailsView.col2Width + Layout.minimumWidth: detailsView.col2Width } Kirigami.Label { @@ -193,15 +192,14 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width - Layout.preferredWidth: detailsView.col3Width + Layout.minimumWidth: detailsView.col3Width Layout.alignment: Qt.AlignRight } Kirigami.Label { id: txtWaterTemp text: dive.waterTemp wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere - Layout.maximumWidth: detailsView.col4Width - Layout.preferredWidth: detailsView.col4Width + Layout.fillWidth: true } Kirigami.Label { @@ -209,7 +207,7 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width - Layout.preferredWidth: detailsView.col1Width + Layout.minimumWidth: detailsView.col1Width Layout.alignment: Qt.AlignRight } Kirigami.Label { @@ -217,7 +215,7 @@ Item { text: dive.divemaster wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere Layout.maximumWidth: detailsView.col2Width - Layout.preferredWidth: detailsView.col2Width + Layout.minimumWidth: detailsView.col2Width } Kirigami.Label { @@ -225,15 +223,14 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width - Layout.preferredWidth: detailsView.col3Width + Layout.minimumWidth: detailsView.col3Width Layout.alignment: Qt.AlignRight } Kirigami.Label { id: txtWeight text: dive.sumWeight wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere - Layout.maximumWidth: detailsView.col4Width - Layout.preferredWidth: detailsView.col4Width + Layout.fillWidth: true } } // clearly, Qt 5.6.0 is buggy as having this as one GridLayout @@ -255,7 +252,7 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width - Layout.preferredWidth: detailsView.col1Width + Layout.minimumWidth: detailsView.col1Width Layout.alignment: Qt.AlignRight } Kirigami.Label { @@ -263,7 +260,7 @@ Item { text: dive.buddy wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere Layout.maximumWidth: detailsView.col2Width - Layout.preferredWidth: detailsView.col2Width + Layout.minimumWidth: detailsView.col2Width } Kirigami.Label { @@ -271,15 +268,14 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width - Layout.preferredWidth: detailsView.col3Width + Layout.minimumWidth: detailsView.col3Width Layout.alignment: Qt.AlignRight } Kirigami.Label { id: txtSAC text: dive.sac wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere - Layout.maximumWidth: detailsView.col4Width - Layout.preferredWidth: detailsView.col4Width + Layout.fillWidth: true } Kirigami.Heading { @@ -296,7 +292,6 @@ Item { focus: true Layout.columnSpan: 4 Layout.fillWidth: true - Layout.fillHeight: true //selectByMouse: true wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere } -- 2.1.4
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
