nasty layout bug fixed

This commit is contained in:
Uwe Rathmann 2019-09-24 16:49:52 +02:00
parent c1e153f036
commit 98f3500ab2

View File

@ -7,13 +7,10 @@
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <qvector.h> #include <qvector.h>
#ifdef QSK_LAYOUT_COMPAT
#include <cmath>
#endif
#include <qdebug.h> #include <qdebug.h>
#include <cmath>
QskLayoutChain::QskLayoutChain() QskLayoutChain::QskLayoutChain()
{ {
} }
@ -300,14 +297,29 @@ QskLayoutChain::Segments QskLayoutChain::distributed(
segment.start = offset; 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 ) if ( which == Qt::MaximumSize && cell.isShrunk )
{ {
segment.length = cell.hint.size( which ); segment.length = size;
offset += segment.length + extra; offset += segment.length + extra;
} }
else else
{ {
segment.length = cell.hint.size( which ) + extra; segment.length = size + extra;
offset += segment.length; offset += segment.length;
} }
} }
@ -334,7 +346,7 @@ QskLayoutChain::Segments QskLayoutChain::minimumExpanded( qreal size ) const
- somehow using the stretch factors - somehow using the stretch factors
*/ */
#ifdef QSK_LAYOUT_COMPAT #if 0
/* /*
Code does not make much sense, but this is what QGridLayoutEngine does. Code does not make much sense, but this is what QGridLayoutEngine does.