mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed split header menu opening in the wrong direction
This commit is contained in:
parent
0682214ba7
commit
f34063213c
1 changed files with 28 additions and 6 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include "widgets/splits/SplitContainer.hpp"
|
#include "widgets/splits/SplitContainer.hpp"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
@ -85,12 +86,33 @@ SplitHeader::SplitHeader(Split *_split)
|
||||||
// dropdown->setPixmap(*app->resources->splitHeaderContext->getPixmap());
|
// dropdown->setPixmap(*app->resources->splitHeaderContext->getPixmap());
|
||||||
// dropdown->setScaleIndependantSize(23, 23);
|
// dropdown->setScaleIndependantSize(23, 23);
|
||||||
this->addDropdownItems(dropdown.getElement());
|
this->addDropdownItems(dropdown.getElement());
|
||||||
QObject::connect(dropdown.getElement(),
|
QObject::connect(
|
||||||
&RippleEffectButton::leftMousePress, this, [this] {
|
dropdown.getElement(), &RippleEffectButton::leftMousePress, this,
|
||||||
QTimer::singleShot(80, [&, this] {
|
[this] {
|
||||||
this->dropdownMenu_.popup(QCursor::pos());
|
QTimer::singleShot(80, this, [this] {
|
||||||
});
|
auto point = [this] {
|
||||||
});
|
auto bounds =
|
||||||
|
QApplication::desktop()->availableGeometry(this);
|
||||||
|
|
||||||
|
auto point = this->dropdownButton_->mapToGlobal(
|
||||||
|
QPoint(this->dropdownButton_->width() -
|
||||||
|
this->dropdownMenu_.width(),
|
||||||
|
this->dropdownButton_->height()));
|
||||||
|
|
||||||
|
if (point.y() + this->dropdownMenu_.height() >
|
||||||
|
bounds.bottom()) {
|
||||||
|
point.setY(point.y() -
|
||||||
|
this->dropdownMenu_.height() -
|
||||||
|
this->dropdownButton_->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
return point;
|
||||||
|
};
|
||||||
|
|
||||||
|
this->dropdownMenu_.popup(point());
|
||||||
|
this->dropdownMenu_.move(point());
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- misc
|
// ---- misc
|
||||||
|
|
Loading…
Reference in a new issue