Project

General

Profile

Bug #11108

WTreeView don't send "expanded" signal before rendering

Added by Andreas Frolov 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
11/28/2022
Due date:
% Done:

0%

Estimated time:

Description

The example shows the problem

auto layout = std::make_unique<Wt::WVBoxLayout>();

auto view1 = layout->addWidget(std::make_unique<Wt::WTreeView>());
auto view2 = layout->addWidget(std::make_unique<Wt::WTreeView>());

auto item = std::make_unique<Wt::WStandardItem>("parent");
item->appendRow(std::make_unique<Wt::WStandardItem>("child"));

auto model = std::make_shared<Wt::WStandardItemModel>();
model->appendRow(std::move(item));

view1->setModel(model);
view2->setModel(model);

view1->expanded().connect([](Wt::WModelIndex) {
  // not hit
});
view2->expanded().connect([](Wt::WModelIndex) {
  // it is executed
});

view1->expand(view1->model()->index(0, 0));
Wt::WTimer::singleShot(std::chrono::milliseconds(0), [=]() { view2->expand(view2->model()->index(0, 0)); });

auto dialog = std::make_unique<Wt::WDialog>("Dialog");
dialog->contents()->setLayout(std::move(layout));
dialog->exec();

No data to display

Also available in: Atom PDF