Actions
Bug #11875
openWBoxLayout incorrectly calculates the size of scrollable widgets
Start date:
08/15/2023
Due date:
% Done:
0%
Estimated time:
Description
I expect in my example that the widgets with the same scale factor get the same size. Unfortunately it isn't. The large content view gets more space than a short content view.
But if I set the preferred layout implementation globally to JavaScript and the preferred layout implementation of concrete layout to Flex then it works as expected. This surprised me because the BoxLayout has Flex implementation by default.
That would be a workaround but in one case it doesn't work. If the view with short content (v1 in my example) has a scale factor greater than 0 and the other has none, then the view v1 will not be displayed.
void showLayout()
{
auto m1 = std::make_shared<Wt::WStandardItemModel>(1, 1);
auto m2 = std::make_shared<Wt::WStandardItemModel>(10, 1); // The content takes up more than half of the space provided
auto layout = std::make_unique<Wt::WVBoxLayout>();
//layout->setPreferredImplementation(Wt::LayoutImplementation::Flex);
auto v1 = layout->addWidget(std::make_unique<Wt::WTreeView>()/*, 1*/);
v1->setModel(m1);
auto v2 = layout->addWidget(std::make_unique<Wt::WTreeView>()/*, 1*/);
v2->setModel(m2);
auto c = Wt::WApplication::instance()->root()->addWidget(std::make_unique<Wt::WContainerWidget>());
c->setLayout(std::move(layout));
c->resize(200, 200);
}
class Application : public Wt::WApplication
{
public:
Application(const Wt::WEnvironment& env);
};
Application::Application(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
showLayout();
}
int main(int argc, char **argv)
{
//Wt::WLayout::setDefaultImplementation(Wt::LayoutImplementation::JavaScript);
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
return std::make_unique<Application>(env);
});
}
Updated by Matthias Van Ceulebroeck about 1 year ago
- Target version set to 4.10.2
Updated by Matthias Van Ceulebroeck about 1 year ago
- Status changed from New to InProgress
- Assignee set to Matthias Van Ceulebroeck
Updated by Matthias Van Ceulebroeck about 1 year ago
- Target version changed from 4.10.2 to 4.10.3
Updated by Matthias Van Ceulebroeck 3 months ago
- Target version changed from 4.10.3 to 4.11.1
Updated by Matthias Van Ceulebroeck about 1 month ago
- Target version changed from 4.11.1 to 4.11.2
Actions