mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Right-clicking split header now opens the same menu as the hamburger icon
Fixes #1131
This commit is contained in:
parent
fe69dfb5e0
commit
c483a87605
2 changed files with 19 additions and 5 deletions
|
@ -206,8 +206,11 @@ void SplitHeader::initializeLayout()
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
// dropdown
|
// dropdown
|
||||||
this->dropdownButton_ = makeWidget<Button>(
|
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||||
[&](auto w) { w->setMenu(this->createMainMenu()); }),
|
auto menu = this->createMainMenu();
|
||||||
|
this->mainMenu_ = menu.get();
|
||||||
|
w->setMenu(std::move(menu));
|
||||||
|
}),
|
||||||
// add split
|
// add split
|
||||||
this->addButton_ = makeWidget<Button>([&](auto w) {
|
this->addButton_ = makeWidget<Button>([&](auto w) {
|
||||||
w->setPixmap(getApp()->resources->buttons.addSplitDark);
|
w->setPixmap(getApp()->resources->buttons.addSplitDark);
|
||||||
|
@ -526,11 +529,21 @@ void SplitHeader::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
void SplitHeader::mousePressEvent(QMouseEvent *event)
|
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;
|
this->doubleClicked_ = false;
|
||||||
|
|
|
@ -55,6 +55,7 @@ private:
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
Button *dropdownButton_{};
|
Button *dropdownButton_{};
|
||||||
|
QMenu *mainMenu_{};
|
||||||
Label *titleLabel_{};
|
Label *titleLabel_{};
|
||||||
EffectLabel *modeButton_{};
|
EffectLabel *modeButton_{};
|
||||||
Button *moderationButton_{};
|
Button *moderationButton_{};
|
||||||
|
|
Loading…
Reference in a new issue