From 98f3500ab281f2574071fc2f90deb1261229c4df Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 24 Sep 2019 16:49:52 +0200 Subject: [PATCH] nasty layout bug fixed --- src/layouts/QskLayoutChain.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/layouts/QskLayoutChain.cpp b/src/layouts/QskLayoutChain.cpp index 6ea8ea90..8567a1f1 100644 --- a/src/layouts/QskLayoutChain.cpp +++ b/src/layouts/QskLayoutChain.cpp @@ -7,13 +7,10 @@ #include #include - -#ifdef QSK_LAYOUT_COMPAT -#include -#endif - #include +#include + QskLayoutChain::QskLayoutChain() { } @@ -300,14 +297,29 @@ QskLayoutChain::Segments QskLayoutChain::distributed( segment.start = offset; + qreal size = cell.hint.size( which ); + +#if 1 + if ( which == Qt::MaximumSize && size == QskLayoutHint::unlimited ) + { + /* + We have some special handling in QskLayoutChain::finish, + that adds the preferred instead of the maximum + size of a cell to the bounding maximum size. + No good way to have this here, TODO ... + */ + size = cell.hint.size( Qt::PreferredSize ); + } +#endif + if ( which == Qt::MaximumSize && cell.isShrunk ) { - segment.length = cell.hint.size( which ); + segment.length = size; offset += segment.length + extra; } else { - segment.length = cell.hint.size( which ) + extra; + segment.length = size + extra; offset += segment.length; } } @@ -334,7 +346,7 @@ QskLayoutChain::Segments QskLayoutChain::minimumExpanded( qreal size ) const - somehow using the stretch factors */ -#ifdef QSK_LAYOUT_COMPAT +#if 0 /* Code does not make much sense, but this is what QGridLayoutEngine does.