From 7f4102ff7dfbe2d0b0823a3c853d5000af7be9d3 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 14 Feb 2019 20:34:17 +0100 Subject: [PATCH] workaround for a QGridLayoutEngine bug added --- src/layouts/QskStackBox.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index ea861a2e..c7529035 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -107,6 +107,24 @@ void QskStackBox::layoutItemRemoved( QskLayoutItem*, int index ) m_data->currentIndex--; // currentIndexChanged ??? } + + auto& engine = this->engine(); + if ( engine.itemCount() > 0 && engine.itemAt( 0, 0 ) == nullptr ) + { + /* + Using QGridLayoutEngine for a stack layout is actually + not a good ideas. Until we have a new implementation, + we need to work around situations, where the layout does + not work properly with having several items in the + same cell. + In this particular situation we need to fix, that we lost + the item from engine.q_grid[0]. + Calling transpose has this side effect. + + */ + engine.transpose(); + engine.transpose(); // reverting the call before + } } void QskStackBox::setCurrentIndex( int index )