Bug #7396


WTreeView not working when hidden during construction

Added by Geert Verbruggen over 4 years ago. Updated over 4 years ago.

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


Estimated time:


When a WTreeView is hidden at construction (e.g. as child of

a WStackedWidget), resizing of the column widths is not working and data are

sometimes not displayed.

Using version 4.1.2

The attachment contains an test case, based on the WTreeView example.

Just replace TreeViewExample.C in the original example by the attached file

I added 3 lines:


< panel->hide();




< b = wc->addWidget(cpp14::make_unique("Show"));

< b->clicked().connect(panel, &WPanel::show);

The first line hides the panel containing the treeview at construction time.

Line 2 and 3 add a button to manually show the panel.

Start the application and press Show. Then try to resize the columns.

If you remove 'panel->hide()' everything works perfect again


TreeViewExample.C (7.62 KB) TreeViewExample.C Geert Verbruggen, 01/10/2020 02:33 PM
panel_resize_sensor.patch (804 Bytes) panel_resize_sensor.patch Roel Standaert, 01/27/2020 03:21 PM
forum_16637.cpp (1.15 KB) forum_16637.cpp Roel Standaert, 01/30/2020 04:33 PM
forum_16637_2.cpp (1.73 KB) forum_16637_2.cpp Roel Standaert, 01/30/2020 04:33 PM
Actions #1

Updated by Roel Standaert over 4 years ago

This issue was already partially fixed on the master and 4.2-release branches. The remaining issue seems to have to do with WPanel itself.

I attached a patch that should fix the remaining issue. Koen, what do you think of this?

Actions #2

Updated by Koen Deforche over 4 years ago


Seems reasonable to me if the same thing didn't work in Wt 3 neither? Otherwise I would be curious how Wt3 got to react to resize?



Actions #3

Updated by Roel Standaert over 4 years ago

It indeed did not work in Wt 3 either. I guess if a WPanel was placed in a layout, it would react to resizes. In this case it isn't, so wtResize isn't being triggered.

Actions #4

Updated by Roel Standaert over 4 years ago

  • Status changed from InProgress to Resolved
  • Assignee deleted (Koen Deforche)

I pushed panel_resize_sensor.patch too.

Updated by Roel Standaert over 4 years ago

I will have to revert that change. It's causing a regression in the attached files (related to issue #7404), where the panel shrinks.

Actions #6

Updated by Roel Standaert over 4 years ago

Turns out WPanel's wtResize code is a fairly naive implementation that only really works properly for the default and polished theme, but breaks down when using Bootstrap 2 or 3.


Also available in: Atom PDF