Project

General

Profile

Bug #7396

WTreeView not working when hidden during construction

Added by Geert Verbruggen almost 3 years ago. Updated almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/10/2020
Due date:
% Done:

0%

Estimated time:

Description

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:

43,44d42

< panel->hide();

<

96,98d93

<

< 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


Files

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
#1

Updated by Roel Standaert almost 3 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?

#2

Updated by Koen Deforche almost 3 years ago

Roel,

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?

Regards,

koen

#3

Updated by Roel Standaert almost 3 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.

#4

Updated by Roel Standaert almost 3 years ago

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

I pushed panel_resize_sensor.patch too.

#5

Updated by Roel Standaert almost 3 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.

#6

Updated by Roel Standaert almost 3 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