Project

General

Profile

Bug #9728

WSuggestionPopup may be truncated by parent widget if the parent has vertical scrollbar

Added by Andreas Frolov 5 months ago.

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

0%

Estimated time:

Description

The example presents the problem

class MyComboBox : public Wt::WLineEdit
{
public:
    MyComboBox()
    {
        Wt::WSuggestionPopup::Options simpleOptions;
        m_popup = std::make_unique<Wt::WSuggestionPopup>(simpleOptions);
        m_popup->setDropDownIconUnfiltered(true);
        m_popup->forEdit(this, Wt::PopupTrigger::Editing | Wt::PopupTrigger::DropDownIcon);

        for (int i = 0; i < 10; ++i)
        {
            m_popup->addSuggestion(std::string("Item ") + std::to_string(i));
        }

        setMinimumSize(minimumWidth(), 20);
    }

    std::unique_ptr<Wt::WSuggestionPopup> m_popup;
};

auto container = std::make_unique<Wt::WContainerWidget>();
auto containerLayout = std::make_unique<Wt::WVBoxLayout>();
for (int i = 0; i < 5; ++i)
{
    containerLayout->addWidget(std::make_unique<MyComboBox>());
}
container->setMaximumSize(container->maximumWidth(), 100);
container->setLayout(std::move(containerLayout));
container->setOverflow(Wt::Overflow::Auto);

auto layout = std::make_unique<Wt::WVBoxLayout>();
layout->addWidget(std::move(container));
layout->addWidget(std::make_unique<MyComboBox>());
layout->addStretch(1);
root()->setLayout(std::move(layout));

No data to display

Also available in: Atom PDF