From fb5885b3d725d2a091cabc933b23d9427d66ae22 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Sat, 14 Sep 2019 15:31:48 +0200 Subject: [PATCH] mismatch warnigs added --- src/layouts/QskLayoutEngine2D.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/layouts/QskLayoutEngine2D.cpp b/src/layouts/QskLayoutEngine2D.cpp index 2001ed0f..56fe0c23 100644 --- a/src/layouts/QskLayoutEngine2D.cpp +++ b/src/layouts/QskLayoutEngine2D.cpp @@ -385,18 +385,32 @@ QSizeF QskLayoutEngine2D::sizeHint( auto& rowChain = m_data->rowChain; auto& columnChain = m_data->columnChain; + if ( constraint.width() >= 0.0 || constraint.height() >= 0.0 ) + { + const auto type = constraintType(); + + if ( constraint.width() >= 0 ) + { + if ( type == QskSizePolicy::WidthForHeight ) + qWarning( "QskLayoutEngine2D: WidthForHeight conflict." ); + } + else + { + if ( type == QskSizePolicy::HeightForWidth ) + qWarning( "QskLayoutEngine2D: HeightForWidth conflict." ); + } + } + m_data->blockInvalidate = true; - if ( ( constraint.width() >= 0 ) && - ( constraintType() == QskSizePolicy::HeightForWidth ) ) + if ( constraint.width() >= 0 ) { setupChain( Qt::Horizontal ); const auto constraints = columnChain.segments( constraint.width() ); setupChain( Qt::Vertical, constraints ); } - else if ( ( constraint.height() >= 0 ) && - ( constraintType() == QskSizePolicy::WidthForHeight ) ) + else if ( constraint.height() >= 0 ) { setupChain( Qt::Vertical );