From 588aad751b36178c3f5297b1badeac57562532d7 Mon Sep 17 00:00:00 2001 From: LajamerrMittesdine Date: Fri, 13 Jul 2018 05:56:46 -0400 Subject: [PATCH] Fix QMenus from going out of screen boundaries --- src/widgets/helper/ChannelView.cpp | 3 +-- src/widgets/splits/SplitHeader.cpp | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 926845d2c..e3b8fb847 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1093,8 +1093,7 @@ void ChannelView::addContextMenuItems(const MessageLayoutElement *hoveredElement // // insert into input // }); - menu->move(QCursor::pos()); - menu->show(); + menu->popup(QCursor::pos()); menu->raise(); return; diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 23bb78fa4..e37938302 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -56,9 +56,7 @@ SplitHeader::SplitHeader(Split *_split) QTimer::singleShot(80, this, [&, this] { ChannelPtr _channel = this->split_->getChannel(); if (_channel->hasModRights()) { - this->modeMenu_.move( - this->modeButton_->mapToGlobal(QPoint(0, this->modeButton_->height()))); - this->modeMenu_.show(); + this->modeMenu_.popup(QCursor::pos()); } }); }); @@ -83,9 +81,7 @@ SplitHeader::SplitHeader(Split *_split) this->addDropdownItems(dropdown.getElement()); QObject::connect(dropdown.getElement(), &RippleEffectButton::leftMousePress, this, [this] { QTimer::singleShot(80, [&, this] { - this->dropdownMenu_.move( - this->dropdownButton_->mapToGlobal(QPoint(0, this->dropdownButton_->height()))); - this->dropdownMenu_.show(); + this->dropdownMenu_.popup(QCursor::pos()); }); }); }