Bug #7550


WGridLayout does not work inside of WStackedWidget

Added by Stefan Wegele almost 4 years ago. Updated almost 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


The vertical rescaling of GridLayout does not work if located inside of WStackedWidget.

In the attached example two things are strange:

  1. The size of "view"object is sometimes big, sometimes small. Press reload it is random.

2. The heights of the integrated TextItems are always small. In the same example without WStackedWidget, they share the window height 50:50.

Tested with 3.4.1 on Firefox and Chrome.


height2.png (19.5 KB) height2.png random height 1 Stefan Wegele, 05/01/2020 05:47 PM
height1.png (20.2 KB) height1.png random height 2 Stefan Wegele, 05/01/2020 05:47 PM
main.cpp (1.44 KB) main.cpp full example Stefan Wegele, 05/01/2020 05:47 PM
Actions #1

Updated by Roel Standaert almost 4 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche

Hm, so this seems to be the case if you're using a WGridLayout (which uses JavaScript) inside of a stacked widget inside of a WVBoxLayout (which uses CSS flex), and the issue isn't there when:

  • Wt::WLayout::setDefaultImplementation(Wt::LayoutImplementation::JavaScript) is used, making all layout implementations JavaScript based
  • You're using two WVBoxLayouts instead (both using flex)
  • You're giving the WContainerWidget named view 100% width and height.

Now, I'm not sure if those first two cases are by design, or it just happens like that. Normally, a WStackedWidget with a WContainerWidget in it is just a <div> in a <div>. There's no rule there that says the inside div is the same size as the outside div. You can see that if you're not using layouts, and you have a WContainerWidget inside of a WStackedWidget of a certain size, that widget does not automatically fill the WStackedWidget. I'm assigning this to Koen so he can shed some light on how this is actually supposed to work.


Also available in: Atom PDF