diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 1059ead210..dfac850716 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -76,8 +76,8 @@ QWidget *qt_button_down = 0; // widget got last button-down static bool app_do_modal = false; extern QWidgetList *qt_modal_stack; // stack of modal widgets -int qt_last_x = 0; -int qt_last_y = 0; +qreal qt_last_x = 0; +qreal qt_last_y = 0; QPointer qt_last_mouse_receiver = 0; static Qt::MouseButtons buttons = Qt::NoButton; @@ -621,7 +621,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse QEvent::Type type; // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; - if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { + if (e->globalPos != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop @@ -630,8 +630,8 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse QWidget * tlw = e->widget.data(); - QPoint localPoint = e->localPos; - QPoint globalPoint = e->globalPos; + QPointF localPoint = e->localPos; + QPointF globalPoint = e->globalPos; QWidget *mouseWindow = tlw; Qt::MouseButton button = Qt::NoButton; @@ -694,7 +694,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse // find the tlw if we didn't get it from the plugin if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); + mouseWindow = QApplication::topLevelAt(globalPoint.toPoint()); } if (!mouseWindow && !implicit_mouse_grabber) @@ -702,13 +702,13 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse if (mouseWindow && mouseWindow != tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it - localPoint = mouseWindow->mapFromGlobal(globalPoint); + localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint()); } // which child should have it? QWidget *mouseWidget = mouseWindow; if (mouseWindow) { - QWidget *w = mouseWindow->childAt(localPoint); + QWidget *w = mouseWindow->childAt(localPoint.toPoint()); if (w) { mouseWidget = w; } @@ -724,13 +724,13 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse mouseWidget = implicit_mouse_grabber.data(); mouseWindow = mouseWidget->window(); if (mouseWindow != tlw) - localPoint = mouseWindow->mapFromGlobal(globalPoint); + localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint()); } Q_ASSERT(mouseWidget); //localPoint is local to mouseWindow, but it needs to be local to mouseWidget - localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); + localPoint = mouseWidget->mapFrom(mouseWindow, localPoint.toPoint()); if (buttons == Qt::NoButton) { //qDebug() << "resetting mouse grabber"; @@ -760,7 +760,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse #ifndef QT_NO_CONTEXTMENU if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QApplication::keyboardModifiers()); + QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint.toPoint(), globalPoint.toPoint(), QApplication::keyboardModifiers()); QApplication::sendSpontaneousEvent(mouseWidget, &e); } #endif // QT_NO_CONTEXTMENU @@ -772,7 +772,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { // QPoint localPoint = ev.pos(); - QPoint globalPoint = e->globalPos; + QPointF globalPoint = e->globalPos; // bool trustLocalPoint = !!tlw; //is there something the local point can be local to? QWidget *mouseWidget; @@ -783,7 +783,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wheel // find the tlw if we didn't get it from the plugin if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); + mouseWindow = QApplication::topLevelAt(globalPoint.toPoint()); } if (!mouseWindow) @@ -795,11 +795,11 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wheel qDebug() << "modal blocked wheel event" << mouseWindow; return; } - QPoint p = mouseWindow->mapFromGlobal(globalPoint); - QWidget *w = mouseWindow->childAt(p); + QPointF p = mouseWindow->mapFromGlobal(globalPoint.toPoint()); + QWidget *w = mouseWindow->childAt(p.toPoint()); if (w) { mouseWidget = w; - p = mouseWidget->mapFromGlobal(globalPoint); + p = mouseWidget->mapFromGlobal(globalPoint.toPoint()); } QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(), diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp index c0b27bebd8..d4cf6f4995 100644 --- a/src/gui/kernel/qcursor_qpa.cpp +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -107,11 +107,11 @@ void QCursorData::update() #endif //QT_NO_CURSOR -extern int qt_last_x,qt_last_y; +extern qreal qt_last_x,qt_last_y; QPoint QCursor::pos() { - return QPoint(qt_last_x, qt_last_y); + return QPointF(qt_last_x, qt_last_y).toPoint(); } void QCursor::setPos(int x, int y) diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 0ae18d5a48..5ae30148d3 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -115,12 +115,12 @@ void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) */ -void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { +void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleMouseEvent(w, time, local, global, b); } -void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) +void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { if (tlw) { QWidgetData *data = qt_qwidget_data(tlw); @@ -180,12 +180,12 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestam QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } -void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { +void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleWheelEvent(w, time, local, global, d, o); } -void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) +void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { if (tlw) { QWidgetData *data = qt_qwidget_data(tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 585d79f56a..5a811b90c1 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -58,8 +58,8 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QWindowSystemInterface { public: - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b); - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + static void handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b); + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b); static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); @@ -75,8 +75,8 @@ public: const QString& text = QString(), bool autorep = false, ushort count = 1); - static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); struct TouchPoint { int id; // for application use diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 7be64e620d..385175cc60 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -121,20 +121,20 @@ public: class MouseEvent : public UserEvent { public: - MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + MouseEvent(QWidget * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b) : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { } - QPoint localPos; - QPoint globalPos; + QPointF localPos; + QPointF globalPos; Qt::MouseButtons buttons; }; class WheelEvent : public UserEvent { public: - WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + WheelEvent(QWidget *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { } int delta; - QPoint localPos; - QPoint globalPos; + QPointF localPos; + QPointF globalPos; Qt::Orientation orient; };