fixed split header menu opening in the wrong direction
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user