Use QWindow::setScreen instead of QWidget::setScreen

This commit is contained in:
Ilya Fedin 2022-06-20 23:55:23 +04:00 committed by John Preston
parent 9ebfd80b29
commit 8de2eee8cc
2 changed files with 5 additions and 3 deletions

View file

@ -770,10 +770,11 @@ void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, TriggeredSource sou
} }
_parent = parent; _parent = parent;
createWinId();
if (_parent) { if (_parent) {
setScreen(_parent->screen()); windowHandle()->setScreen(_parent->screen());
} else if (screen) { } else if (screen) {
setScreen(screen); windowHandle()->setScreen(screen);
} }
using Origin = PanelAnimation::Origin; using Origin = PanelAnimation::Origin;

View file

@ -117,7 +117,8 @@ void Tooltip::popup(const QPoint &m, const QString &text, const style::Tooltip *
// adjust tooltip position // adjust tooltip position
if (screen) { if (screen) {
setScreen(screen); createWinId();
windowHandle()->setScreen(screen);
const auto r = screen->availableGeometry(); const auto r = screen->availableGeometry();
if (r.x() + r.width() - _st->skip < p.x() + s.width() && p.x() + s.width() > m.x()) { 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())); p.setX(qMax(r.x() + r.width() - int32(_st->skip) - s.width(), m.x() - s.width()));