From 5efaa9ef8073bb216e3dcdbb4476f2fa7c672b76 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 11 Oct 2020 16:29:51 +0200 Subject: rbutil: Use globalPos() for getting mouse position. globalX() / globalY() are deprecated for Qt6. Use globalPos() instead, which gives the same result. Change-Id: Ie0b733b88107e971de9c3e8c42434d7d47a65b76 --- rbutil/rbutilqt/preview.cpp | 6 +++--- rbutil/rbutilqt/preview.h | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'rbutil') diff --git a/rbutil/rbutilqt/preview.cpp b/rbutil/rbutilqt/preview.cpp index 72af37deee..5006a03a09 100644 --- a/rbutil/rbutilqt/preview.cpp +++ b/rbutil/rbutilqt/preview.cpp @@ -79,8 +79,7 @@ PreviewLabel::PreviewLabel(QWidget * parent, Qt::WindowFlags f) void PreviewLabel::mouseMoveEvent(QMouseEvent * event) { hovertimer.start(); - mousex = event->globalX(); - mousey = event->globalY(); + mousepos = event->globalPos(); } void PreviewLabel::enterEvent(QEvent * event) { @@ -95,7 +94,8 @@ void PreviewLabel::leaveEvent(QEvent * event) void PreviewLabel::timeout() { - preview->move(mousex-(preview->width()/2) ,mousey-(preview->height()/2)); + preview->move(mousepos.x() - (preview->width() / 2), + mousepos.y() - (preview->height() / 2)); preview->setVisible(true); } diff --git a/rbutil/rbutilqt/preview.h b/rbutil/rbutilqt/preview.h index 4c51cb8031..5e43c2d9ac 100644 --- a/rbutil/rbutilqt/preview.h +++ b/rbutil/rbutilqt/preview.h @@ -66,8 +66,7 @@ private slots: private: QTimer hovertimer; - int mousex; - int mousey; + QPoint mousepos; PreviewDlg* preview; }; -- cgit v1.2.3