Right-clicking split header now opens the same menu as the hamburger icon

Fixes #1131
This commit is contained in:
Rasmus Karlsson 2019-07-13 12:17:22 +02:00
parent fe69dfb5e0
commit c483a87605
2 changed files with 19 additions and 5 deletions

View file

@ -206,8 +206,11 @@ void SplitHeader::initializeLayout()
});
}),
// dropdown
this->dropdownButton_ = makeWidget<Button>(
[&](auto w) { w->setMenu(this->createMainMenu()); }),
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
auto menu = this->createMainMenu();
this->mainMenu_ = menu.get();
w->setMenu(std::move(menu));
}),
// add split
this->addButton_ = makeWidget<Button>([&](auto w) {
w->setPixmap(getApp()->resources->buttons.addSplitDark);
@ -526,11 +529,21 @@ void SplitHeader::paintEvent(QPaintEvent *)
void SplitHeader::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
switch (event->button())
{
this->dragging_ = true;
case Qt::LeftButton:
{
this->dragging_ = true;
this->dragStart_ = event->pos();
this->dragStart_ = event->pos();
}
break;
case Qt::RightButton:
{
this->mainMenu_->popup(this->mapToGlobal(event->pos()));
}
break;
}
this->doubleClicked_ = false;

View file

@ -55,6 +55,7 @@ private:
// ui
Button *dropdownButton_{};
QMenu *mainMenu_{};
Label *titleLabel_{};
EffectLabel *modeButton_{};
Button *moderationButton_{};