always update dropdown on split button press

This commit is contained in:
fourtf 2021-04-03 17:33:51 +02:00
parent 19d9791cba
commit c50b91d6e9
2 changed files with 4 additions and 1 deletions

View file

@ -113,6 +113,9 @@ const QColor &Button::getBorderColor() const
void Button::setMenu(std::unique_ptr<QMenu> menu) void Button::setMenu(std::unique_ptr<QMenu> menu)
{ {
if (this->menu_)
this->menu_.release()->deleteLater();
this->menu_ = std::move(menu); this->menu_ = std::move(menu);
this->menu_->installEventFilter( this->menu_->installEventFilter(

View file

@ -284,7 +284,7 @@ void SplitHeader::initializeLayout()
// dropdown // dropdown
this->dropdownButton_ = makeWidget<Button>([&](auto w) { this->dropdownButton_ = makeWidget<Button>([&](auto w) {
/// XXX: this never gets disconnected /// XXX: this never gets disconnected
this->split_->channelChanged.connect([this] { QObject::connect(w, &Button::leftMousePress, this, [this] {
this->dropdownButton_->setMenu(this->createMainMenu()); this->dropdownButton_->setMenu(this->createMainMenu());
}); });
}), }),