Project

General

Profile

Layout of subcontainer in stacked widget with menu

Added by Egor Pugin over 4 years ago

I'm seeing strange behavior of the following example.

Is it me or an issue?

https://imgur.com/a/FlsUynX

pic1 - expected

pic2 - line edit moved on top of first menu entry

Code:

auto main_layout = setLayout(std::make_unique<Wt::WHBoxLayout>());
auto mleft = main_layout->addWidget(std::make_unique<Wt::WContainerWidget>(), 1);
auto mright = main_layout->addWidget(std::make_unique<Wt::WContainerWidget>(), 8);

auto contents = std::make_unique<Wt::WStackedWidget>();
contents->setAttributeValue("style", "border: solid black 2px;");

mm = mleft->addNew<Wt::WMenu>(contents.get());
auto c = mright->addNew<Wt::WContainerWidget>();
c->addWidget(std::move(contents));

mm->setStyleClass("nav nav-pills nav-stacked");
mm->setWidth(150);

auto graphics = mm->addItem("Main", std::make_unique<Wt::WContainerWidget>());
mm->addItem("Reports", std::make_unique<Wt::WContainerWidget>());
mm->addItem("X", std::make_unique<Wt::WContainerWidget>());
mm->addItem("Y", std::make_unique<LineEditWithResolvableItems>());
mm->addItem("Z", std::make_unique<LineEditWithResolvableItems>());

auto hbox = graphics->setLayout(std::make_unique<Wt::WHBoxLayout>());
auto left = hbox->addWidget(std::make_unique<Wt::WContainerWidget>(), 1);
auto right = hbox->addWidget(std::make_unique<Wt::WContainerWidget>(), 8);

left->addWidget(std::make_unique<Wt::WLineEdit>());