Let Wayland to use QGuiApplication::screenAt
Looks like it works correctly nowadays
This commit is contained in:
parent
fa8de8b199
commit
476d751251
2 changed files with 7 additions and 6 deletions
|
|
@ -958,9 +958,7 @@ bool PopupMenu::prepareGeometryFor(const QPoint &p) {
|
|||
|
||||
bool PopupMenu::prepareGeometryFor(const QPoint &p, PopupMenu *parent) {
|
||||
const auto usingScreenGeometry = !::Platform::IsWayland();
|
||||
const auto screen = usingScreenGeometry
|
||||
? QGuiApplication::screenAt(p)
|
||||
: nullptr;
|
||||
const auto screen = QGuiApplication::screenAt(p);
|
||||
if ((usingScreenGeometry && !screen)
|
||||
|| (!parent
|
||||
&& ::Platform::IsMac()
|
||||
|
|
@ -1002,7 +1000,7 @@ bool PopupMenu::prepareGeometryFor(const QPoint &p, PopupMenu *parent) {
|
|||
_additionalMenuPadding.left() - _st.shadow.extend.left(),
|
||||
0),
|
||||
_padding.top() - _topShift);
|
||||
auto r = screen ? screen->availableGeometry() : QRect();
|
||||
auto r = usingScreenGeometry ? screen->availableGeometry() : QRect();
|
||||
const auto parentWidth = _parent ? _parent->inner().width() : 0;
|
||||
if (style::RightToLeft()) {
|
||||
const auto badLeft = !r.isNull() && w.x() - width() < r.x() - _margins.left();
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ Tooltip::~Tooltip() {
|
|||
|
||||
void Tooltip::popup(const QPoint &m, const QString &text, const style::Tooltip *st) {
|
||||
const auto usingScreenGeometry = !::Platform::IsWayland();
|
||||
const auto screen = usingScreenGeometry ? QGuiApplication::screenAt(m) : nullptr;
|
||||
const auto screen = QGuiApplication::screenAt(m);
|
||||
if (usingScreenGeometry && !screen) {
|
||||
Hide();
|
||||
return;
|
||||
|
|
@ -118,10 +118,13 @@ void Tooltip::popup(const QPoint &m, const QString &text, const style::Tooltip *
|
|||
p.setX(m.x() - (s.width() / 2));
|
||||
}
|
||||
|
||||
// adjust tooltip position
|
||||
if (screen) {
|
||||
createWinId();
|
||||
windowHandle()->setScreen(screen);
|
||||
}
|
||||
|
||||
// adjust tooltip position
|
||||
if (usingScreenGeometry) {
|
||||
const auto r = screen->availableGeometry();
|
||||
if (r.x() + r.width() - _st->skip < p.x() + s.width() && p.x() + s.width() > m.x()) {
|
||||
p.setX(qMax(r.x() + r.width() - int32(_st->skip) - s.width(), m.x() - s.width()));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue