Bug #10512
After the model is reset, elements in WTreeView no longer respect the disabled status of the view
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
06/20/2022
Due date:
% Done:
0%
Estimated time:
Description
Consider the example:
auto layout = std::make_unique<Wt::WVBoxLayout>();
auto model = std::make_shared<Wt::WStringListModel>();
std::vector<Wt::WString> data = { "aaa", "bbb", "ccc" };
model->setStringList(data);
auto view = layout->addWidget(std::make_unique<Wt::WTreeView>());
view->setSelectionMode(Wt::SelectionMode::Single);
view->setModel(model);
auto button1 = layout->addWidget(std::make_unique<Wt::WPushButton>("Disable view"));
button1->clicked().connect([view]() {
view->setDisabled(true);
});
auto button2 = layout->addWidget(std::make_unique<Wt::WPushButton>("Reset model"));
button2->clicked().connect([view, model]() {
view->setModel(model);
});
root()->setLayout(std::move(layout));
root()->setMaximumSize(200, 200);
After creation, the elements are selectable.
First we click the button "Disable view". Elements can no longer be selected.
Then we reset the model by clicking on the "Reset model" button. Elements can be selected again although the view is disabled.
Updated by Andreas Frolov 8 days ago
The same problem occurs when the model sends the signal layoutChanged.