forked from qt-creator/qt-creator
Core: fix OptionsPopup positioning
Do not limit the popups coordinates to positive y coordinates, since Monitors above the main monitor have a negative y coordinate. Use the the available geometry of the parent widgets screen to check for sensible coordinates instead. Fixes: QTCREATORBUG-27341 Change-Id: I6e1572f7b2d3c83feafcf71392e265e14e6b457d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QScreen>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -64,7 +65,8 @@ OptionsPopup::OptionsPopup(QWidget *parent, const QVector<Id> &commands)
|
|||||||
layout->addWidget(checkBox);
|
layout->addWidget(checkBox);
|
||||||
}
|
}
|
||||||
const QPoint globalPos = parent->mapToGlobal(QPoint(0, -sizeHint().height()));
|
const QPoint globalPos = parent->mapToGlobal(QPoint(0, -sizeHint().height()));
|
||||||
move(globalPos.x(), std::max(globalPos.y(), 0));
|
const QRect screenGeometry = parent->screen()->availableGeometry();
|
||||||
|
move(globalPos.x(), std::max(globalPos.y(), screenGeometry.y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OptionsPopup::event(QEvent *ev)
|
bool OptionsPopup::event(QEvent *ev)
|
||||||
|
Reference in New Issue
Block a user