always update dropdown on split button press (#2590)

This commit is contained in:
fourtf 2021-04-04 15:24:12 +02:00 committed by GitHub
parent 80d52a37f6
commit 2db7a30ae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
{
if (this->menu_)
this->menu_.release()->deleteLater();
this->menu_ = std::move(menu);
this->menu_->installEventFilter(

View file

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