diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-22 22:28:32 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-22 22:28:33 +0200 |
commit | c0f7cc3a3cc3f06b09591f25277f8083b3a55581 (patch) | |
tree | ecf3d3f49d6dc85b55fbdbe999e386ceda31ef39 /src/gui/kernel | |
parent | 139240ac671953f0763308f235d8b868c1efe1b1 (diff) | |
parent | aa6d7dd7ee306c0adbcd42b013d1e749072205bb (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ic274a375d6fc1312ced2354e034dc0980dd47c51
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 24 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qevent_p.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 19 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.h | 1 |
7 files changed, 56 insertions, 3 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8e5945be41..5791432ba6 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -931,6 +931,30 @@ QWheelEvent::~QWheelEvent() \endlist */ +/*! + \fn QPoint QWheelEvent::position() const + + Returns the position of the mouse cursor relative to the widget + that received the event. + + If you move your widgets around in response to mouse events, + use globalPosition() instead of this function. + + \sa globalPosition() +*/ + +/*! + \fn QPoint QWheelEvent::globalPosition() const + + Returns the global position of the mouse pointer \e{at the time + of the event}. This is important on asynchronous window systems + such as X11; whenever you move your widgets around in response to + mouse events, globalPosition() can differ a lot from the current + cursor position returned by QCursor::pos(). + + \sa position() +*/ + #if QT_DEPRECATED_SINCE(5, 15) /*! \fn int QWheelEvent::delta() const diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 10ef01fa1d..e80920686f 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -960,6 +960,7 @@ public: friend class QGuiApplicationPrivate; friend class QApplication; friend class QApplicationPrivate; + friend class QQuickPointerTouchEvent; }; #if QT_DEPRECATED_SINCE(5, 0) diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index c2d8bd72b9..b7645496f8 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -67,7 +67,8 @@ public: state(Qt::TouchPointReleased), pressure(-1), rotation(0), - ellipseDiameters(0, 0) + ellipseDiameters(0, 0), + stationaryWithModifiedProperty(false) { } inline QTouchEventTouchPointPrivate *detach() @@ -91,6 +92,7 @@ public: QSizeF ellipseDiameters; QVector2D velocity; QTouchEvent::TouchPoint::InfoFlags flags; + bool stationaryWithModifiedProperty : 1; QVector<QPointF> rawScreenPositions; }; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3565c69399..4b3d94b97f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1040,7 +1040,9 @@ QList<QScreen *> QGuiApplication::screens() The \a point is in relation to the virtualGeometry() of each set of virtual siblings. If the point maps to more than one set of virtual siblings the first - match is returned. + match is returned. If you wish to search only the virtual desktop siblings + of a known screen (for example siblings of the screen of your application + window \c QWidget::windowHandle()->screen()), use QScreen::virtualSiblingAt(). \since 5.10 */ @@ -2847,10 +2849,12 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (touchPoint.state() == Qt::TouchPointStationary) { if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { touchInfo.touchPoint.setVelocity(touchPoint.velocity()); + touchPoint.d->stationaryWithModifiedProperty = true; stationaryTouchPointChangedProperty = true; } if (!qFuzzyCompare(touchInfo.touchPoint.pressure(), touchPoint.pressure())) { touchInfo.touchPoint.setPressure(touchPoint.pressure()); + touchPoint.d->stationaryWithModifiedProperty = true; stationaryTouchPointChangedProperty = true; } } else { diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index ee54fd4fa1..76548d5d86 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -715,8 +715,10 @@ QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QWindow *w { if (!m_active) return { qreal(1), QPoint() }; + QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen(); - return scaleAndOrigin(screen, nativePosition); + const bool searchScreen = !window || window->isTopLevel(); + return scaleAndOrigin(screen, searchScreen ? nativePosition : nullptr); } #endif //QT_NO_HIGHDPISCALING diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 7adf3db1b8..80de561297 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -700,6 +700,25 @@ void QScreenPrivate::updatePrimaryOrientation() } /*! + Returns the screen at \a point within the set of \l QScreen::virtualSiblings(), + or \c nullptr if outside of any screen. + + The \a point is in relation to the virtualGeometry() of each set of virtual + siblings. + + \since 5.15 +*/ +QScreen *QScreen::virtualSiblingAt(const QPoint &point) +{ + const auto &siblings = virtualSiblings(); + for (QScreen *sibling : siblings) { + if (sibling->geometry().contains(point)) + return sibling; + } + return nullptr; +} + +/*! Creates and returns a pixmap constructed by grabbing the contents of the given \a window restricted by QRect(\a x, \a y, \a width, \a height). diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index 14392d3036..88925ab731 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -125,6 +125,7 @@ public: QRect availableGeometry() const; QList<QScreen *> virtualSiblings() const; + QScreen *virtualSiblingAt(const QPoint &point); QSize virtualSize() const; QRect virtualGeometry() const; |