From 7d323397628e808f49ee9477515a35d743afd131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Sun, 15 Jan 2017 00:54:43 +0100 Subject: Pass m_drag_icon_window to getNativeMousePos instead of Event QObject The QWindow passed to eventFilter is static so it might be in a different screen when we call getNativeMousePos, resulting in negative position and all sorts of glitches. Change-Id: Ibc848c6d85d8b6932ee379aa77851094212a0db2 Reviewed-by: David Edmundson Reviewed-by: Friedemann Kleint --- src/gui/kernel/qsimpledrag.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index fc62273325..a1e25dc53c 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -117,9 +117,9 @@ void QBasicDrag::disableEventFilter() } -static inline QPoint getNativeMousePos(QEvent *e, QObject *o) +static inline QPoint getNativeMousePos(QEvent *e, QWindow *window) { - return QHighDpi::toNativePixels(static_cast(e)->globalPos(), qobject_cast(o)); + return QHighDpi::toNativePixels(static_cast(e)->globalPos(), window); } bool QBasicDrag::eventFilter(QObject *o, QEvent *e) @@ -156,14 +156,14 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) case QEvent::MouseMove: { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); move(nativePosition); return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: disableEventFilter(); if (canDrop()) { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); drop(nativePosition); } else { cancel(); -- cgit v1.2.3 From ad8a48e8f1b336099eab2a00c1c1e59abad8e717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 10 Sep 2017 14:58:49 +0200 Subject: Add QGuiApplication::screenAt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QtGui] It's now possible to retrieve the screen at a given point via QGuiApplication::screenAt(). Change-Id: Ic09514ec731d8cce5d453833e98fcd118a70600e Reviewed-by: Gatis Paeglis Reviewed-by: Błażej Szczygieł --- src/gui/kernel/qguiapplication.cpp | 63 +++++++++++++++++++------------------- src/gui/kernel/qguiapplication.h | 2 ++ 2 files changed, 34 insertions(+), 31 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a29ddbe44e..63539c0103 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -987,6 +987,34 @@ QList QGuiApplication::screens() return QGuiApplicationPrivate::screen_list; } +/*! + Returns the screen at \a point, or \c nullptr if outside of any screen. + + 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. + + \since 5.10 +*/ +QScreen *QGuiApplication::screenAt(const QPoint &point) +{ + QVarLengthArray visitedScreens; + for (const QScreen *screen : QGuiApplication::screens()) { + if (visitedScreens.contains(screen)) + continue; + + // The virtual siblings include the screen itself, so iterate directly + for (QScreen *sibling : screen->virtualSiblings()) { + if (sibling->geometry().contains(point)) + return sibling; + + visitedScreens.append(sibling); + } + } + + return nullptr; +} + /*! \fn void QGuiApplication::screenAdded(QScreen *screen) @@ -1050,38 +1078,11 @@ qreal QGuiApplication::devicePixelRatio() const */ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) { - const QList screens = QGuiApplication::screens(); - if (!screens.isEmpty()) { - const QList primaryScreens = screens.first()->virtualSiblings(); - QScreen *windowScreen = Q_NULLPTR; - - // Find the window on the primary virtual desktop first - for (QScreen *screen : primaryScreens) { - if (screen->geometry().contains(pos)) { - windowScreen = screen; - break; - } - } - - // If the window is not found on primary virtual desktop, find it on all screens - // except the first which was for sure in the previous loop. Some other screens - // may repeat. Find only when there is more than one virtual desktop. - if (!windowScreen && screens.count() != primaryScreens.count()) { - for (int i = 1; i < screens.size(); ++i) { - QScreen *screen = screens.at(i); - if (screen->geometry().contains(pos)) { - windowScreen = screen; - break; - } - } - } - - if (windowScreen) { - const QPoint devicePosition = QHighDpi::toNativePixels(pos, windowScreen); - return windowScreen->handle()->topLevelAt(devicePosition); - } + if (QScreen *windowScreen = screenAt(pos)) { + const QPoint devicePosition = QHighDpi::toNativePixels(pos, windowScreen); + return windowScreen->handle()->topLevelAt(devicePosition); } - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 6721970222..e130553b9d 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -110,6 +110,8 @@ public: static QScreen *primaryScreen(); static QList screens(); + static QScreen *screenAt(const QPoint &point); + qreal devicePixelRatio() const; #ifndef QT_NO_CURSOR -- cgit v1.2.3 From 590e71a69cc74b4e7da1ccb19a1304047dbaecb8 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Sep 2017 11:07:58 +0200 Subject: Fix convertToFormat with color-tables The function was only well defined from RGB32 and ARGB32PM formats, this patch fixes it so it behaves well from all formats. Task-number: QTBUG-63163 Change-Id: Id892531d9aaf997b707b430196c1166493792a2a Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index b2e5ac93b1..43b77a862d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2096,8 +2096,8 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format, Returns a copy of the image converted to the given \a format, using the specified \a colorTable. - Conversion from 32 bit to 8 bit indexed is a slow operation and - will use a straightforward nearest color approach, with no + Conversion from RGB formats to indexed formats is a slow operation + and will use a straightforward nearest color approach, with no dithering. */ QImage QImage::convertToFormat(Format format, const QVector &colorTable, Qt::ImageConversionFlags flags) const @@ -2105,23 +2105,12 @@ QImage QImage::convertToFormat(Format format, const QVector &colorTable, Q if (!d || d->format == format) return *this; - if (format <= QImage::Format_Indexed8 && depth() == 32) { - return convertWithPalette(*this, format, colorTable); - } - - const Image_Converter *converterPtr = &qimage_converter_map[d->format][format]; - Image_Converter converter = *converterPtr; - if (!converter) + if (format == QImage::Format_Invalid) return QImage(); + if (format <= QImage::Format_Indexed8) + return convertWithPalette(convertToFormat(QImage::Format_ARGB32, flags), format, colorTable); - QImage image(d->width, d->height, format); - QIMAGE_SANITYCHECK_MEMORY(image); - - image.d->offset = offset(); - copyMetadata(image.d, d); - - converter(image.d, d, flags); - return image; + return convertToFormat(format, flags); } /*! -- cgit v1.2.3 From 62ea3eaf05cf591155028e1e3c5684b25060184c Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Thu, 14 Sep 2017 10:14:48 +0200 Subject: Improve PDF/A-1b support in QPdfWriter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning of missing F key in Annot directory. The F key needs to have the printing flag (bit 3) enabled and all other bits disabled. (Clause 6.5.3 in ISO 19005-1:2005) Change-Id: Iddba6b71f516aca75cd573584aa184c1b808863d Reviewed-by: André Klitzing Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 2b892159c5..e421055ef3 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1063,7 +1063,12 @@ void QPdfEngine::drawHyperlink(const QRectF &r, const QUrl &url) char buf[256]; const QRectF rr = d->pageMatrix().mapRect(r); - d->xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); + d->xprintf("<<\n/Type /Annot\n/Subtype /Link\n"); + + if (d->pdfVersion == QPdfEngine::Version_A1b) + d->xprintf("/F 4\n"); // enable print flag, disable all other + + d->xprintf("/Rect ["); d->xprintf("%s ", qt_real_to_string(rr.left(), buf)); d->xprintf("%s ", qt_real_to_string(rr.top(), buf)); d->xprintf("%s ", qt_real_to_string(rr.right(), buf)); @@ -2831,7 +2836,12 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) x2s.setNum(static_cast(x2), 'f'); y2s.setNum(static_cast(y2), 'f'); QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s; - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); + xprintf("<<\n/Type /Annot\n/Subtype /Link\n"); + + if (pdfVersion == QPdfEngine::Version_A1b) + xprintf("/F 4\n"); // enable print flag, disable all other + + xprintf("/Rect ["); xprintf(rectData.constData()); #ifdef Q_DEBUG_PDF_LINKS xprintf("]\n/Border [16 16 1]\n/A <<\n"); -- cgit v1.2.3 From 83729ad7a1e2d9c75ddf7238ab7c91b514dcebcf Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Sep 2017 16:39:56 +0200 Subject: make the QTouchDevice available in each QNativeGestureEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtQuick is beginning to have a use for this, to distinguish native gestures which come from actual trackpad rather than from the "core pointer". It might as well use a real device ID instead of making one up, as it has to do for the core pointer. So far on macOS, the device ID isn't a real one; but that can be fixed, as the qCDebug lines demonstrate (different trackpads have different IDs). Change-Id: I5841deb1c4cc0b77a3b1df70904f70b3d2d71853 Reviewed-by: Shawn Rutledge Reviewed-by: Jan Arve Sæther --- src/gui/kernel/qevent.cpp | 9 ++++++++- src/gui/kernel/qevent.h | 6 +++++- src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/kernel/qtouchdevice.cpp | 9 +++++++++ src/gui/kernel/qtouchdevice_p.h | 1 + src/gui/kernel/qwindowsysteminterface.cpp | 12 ++++++------ src/gui/kernel/qwindowsysteminterface.h | 6 +++--- src/gui/kernel/qwindowsysteminterface_p.h | 5 +++-- 8 files changed, 36 insertions(+), 14 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 5000cc35dd..df093ddbf6 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -40,6 +40,7 @@ #include "qevent.h" #include "qcursor.h" #include "private/qguiapplication_p.h" +#include "private/qtouchdevice_p.h" #include "qpa/qplatformintegration.h" #include "qpa/qplatformdrag.h" #include "private/qevent_p.h" @@ -2765,13 +2766,19 @@ Qt::MouseButtons QTabletEvent::buttons() const \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters. */ -QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, +QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) : QInputEvent(QEvent::NativeGesture), mGestureType(type), + mTouchDeviceId(QTouchDevicePrivate::get(const_cast(dev))->id), mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), mSequenceId(sequenceId), mIntValue(intValue) { } +const QTouchDevice *QNativeGestureEvent::device() const +{ + return QTouchDevicePrivate::deviceById(mTouchDeviceId); +} + /*! \fn QNativeGestureEvent::gestureType() const \since 5.2 diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index b8f86acd75..e439b0ca54 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -301,7 +301,7 @@ protected: class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent { public: - QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, + QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); Qt::NativeGestureType gestureType() const { return mGestureType; } qreal value() const { return mRealValue; } @@ -314,8 +314,12 @@ public: const QPointF &windowPos() const { return mWindowPos; } const QPointF &screenPos() const { return mScreenPos; } + const QTouchDevice *device() const; + protected: Qt::NativeGestureType mGestureType; + quint8 mTouchDeviceId; // QTouchDevicePrivate::id + quint8 mReserved[3]; // if qreal == double clang will pad the QPointF below to a 8-byte boundary QPointF mLocalPos; QPointF mWindowPos; QPointF mScreenPos; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 63539c0103..b26567ad0c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2420,7 +2420,7 @@ void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate:: if (e->window.isNull()) return; - QNativeGestureEvent ev(e->type, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue); + QNativeGestureEvent ev(e->type, e->device, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(e->window, &ev); } diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp index 0f13412fb1..511e92566e 100644 --- a/src/gui/kernel/qtouchdevice.cpp +++ b/src/gui/kernel/qtouchdevice.cpp @@ -235,6 +235,15 @@ bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev) return deviceList()->contains(dev); } +const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id) +{ + QMutexLocker locker(&devicesMutex); + for (const QTouchDevice *dev : *deviceList()) + if (QTouchDevicePrivate::get(const_cast(dev))->id == id) + return dev; + return nullptr; +} + /*! \internal */ diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h index 18d2af46a7..fc45066c2d 100644 --- a/src/gui/kernel/qtouchdevice_p.h +++ b/src/gui/kernel/qtouchdevice_p.h @@ -78,6 +78,7 @@ public: static void registerDevice(const QTouchDevice *dev); static void unregisterDevice(const QTouchDevice *dev); static bool isRegistered(const QTouchDevice *dev); + static const QTouchDevice *deviceById(quint8 id); static QTouchDevicePrivate *get(QTouchDevice *q) { return q->d; } }; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 85b2aae7dd..f9580291bc 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -850,28 +850,28 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi } #ifndef QT_NO_GESTURES -void QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, Qt::NativeGestureType type, +void QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, QPointF &local, QPointF &global) { QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type, +void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, qreal value, QPointF &local, QPointF &global) { QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); e->realValue = value; QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type, +void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, ulong sequenceId, quint64 value, QPointF &local, QPointF &global) { QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); e->sequenceId = sequenceId; e->intValue = value; QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 7ea7b072f0..1ded12d88d 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -225,11 +225,11 @@ public: static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid); #ifndef QT_NO_GESTURES - static void handleGestureEvent(QWindow *window, ulong timestamp, Qt::NativeGestureType type, + static void handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, QPointF &local, QPointF &global); - static void handleGestureEventWithRealValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type, + static void handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, qreal value, QPointF &local, QPointF &global); - static void handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp,Qt::NativeGestureType type, + static void handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type, ulong sequenceId, quint64 value, QPointF &local, QPointF &global); #endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index ef993501f8..6a1360a26a 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -421,9 +421,9 @@ public: #ifndef QT_NO_GESTURES class GestureEvent : public InputEvent { public: - GestureEvent(QWindow *window, ulong time, Qt::NativeGestureType type, QPointF pos, QPointF globalPos) + GestureEvent(QWindow *window, ulong time, Qt::NativeGestureType type, QTouchDevice *dev, QPointF pos, QPointF globalPos) : InputEvent(window, time, Gesture, Qt::NoModifier), type(type), pos(pos), globalPos(globalPos), - realValue(0), sequenceId(0), intValue(0) { } + realValue(0), sequenceId(0), intValue(0), device(dev) { } Qt::NativeGestureType type; QPointF pos; QPointF globalPos; @@ -432,6 +432,7 @@ public: // Windows ulong sequenceId; quint64 intValue; + QTouchDevice *device; }; #endif -- cgit v1.2.3 From ce019efb5cfcc0bce516a761be4295c568994a31 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 22 Sep 2017 09:42:48 +0200 Subject: add back the device-less QNativeGestureEvent (deprecated) It was an oversight in 83729ad7a1e2d9c75ddf7238ab7c91b514dcebcf that this constructor is still in use in other modules. And in fact we cannot remove public constructors without deprecating them first. Task-number: QTBUG-63355 Change-Id: I64dbf9bc54c0bf6be7157f047b548d3b2c5bc2ed Reviewed-by: Simon Hausmann --- src/gui/kernel/qevent.cpp | 12 ++++++++++++ src/gui/kernel/qevent.h | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index df093ddbf6..7b1eb277b2 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2757,6 +2757,18 @@ Qt::MouseButtons QTabletEvent::buttons() const \sa Qt::NativeGestureType, QGestureEvent */ +/*! + \deprecated The QTouchDevice parameter is now required +*/ +#if QT_DEPRECATED_SINCE(5, 10) +QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, + const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) + : QInputEvent(QEvent::NativeGesture), mGestureType(type), mTouchDeviceId(255), + mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), + mSequenceId(sequenceId), mIntValue(intValue) +{ } +#endif + /*! Constructs a native gesture event of type \a type. diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index e439b0ca54..a6f97a21dc 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -301,6 +301,10 @@ protected: class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent { public: +#if QT_DEPRECATED_SINCE(5, 10) + QT_DEPRECATED QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, + const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); +#endif QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); Qt::NativeGestureType gestureType() const { return mGestureType; } -- cgit v1.2.3 From bde42ffb8b3de541b0ced5b5f46eac6dc441dda7 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Tue, 19 Sep 2017 08:47:03 +0200 Subject: Avoid window geometry jittering when changing geometry from JavaScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QML API allowed only separate setting of geometry parameters which causes flickering when all parameters need to be changed. By exposing the setGeometry function it is possible to set all of these at once using an imperative setGeometry call from JavaScript. Note that bindings for x/y/width/height are still evaluated sequentially, resulting in four calls to the platform window's setGeometry. This patch only introduces an imperative workaround for that issue. Change-Id: Ie9b0d3c39434740e50757ba7cff0385ae80f47f4 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindow.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 4a874caacb..44ff054fa3 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -218,8 +218,6 @@ public: void setBaseSize(const QSize &size); void setSizeIncrement(const QSize &size); - void setGeometry(int posx, int posy, int w, int h); - void setGeometry(const QRect &rect); QRect geometry() const; QMargins frameMargins() const; @@ -300,6 +298,8 @@ public Q_SLOTS: void setY(int arg); void setWidth(int arg); void setHeight(int arg); + void setGeometry(int posx, int posy, int w, int h); + void setGeometry(const QRect &rect); void setMinimumWidth(int w); void setMinimumHeight(int h); -- cgit v1.2.3 From 7896efdd9f51b7defa02e73303f8aa03cc7f3044 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 25 Sep 2017 14:38:15 +0200 Subject: QNativeGestureEvent: Fix documentation Fix qdoc-warnings: src/gui/kernel/qevent.cpp:2772: warning: Undocumented parameter 'dev' in QNativeGestureEvent::QNativeGestureEvent() src/gui/kernel/qevent.cpp:2794: warning: No documentation for 'QNativeGestureEvent::device()' Change-Id: I845b0925ad4f1d8602455444ebbd4ec6320ebae7 Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 7b1eb277b2..55339cac8c 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2770,22 +2770,29 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin #endif /*! - Constructs a native gesture event of type \a type. + Constructs a native gesture event of type \a type originating from \a device. The points \a localPos, \a windowPos and \a screenPos specify the gesture position relative to the receiving widget or item, window, and screen, respectively. \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters. + \since 5.10 */ -QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, +QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) : QInputEvent(QEvent::NativeGesture), mGestureType(type), - mTouchDeviceId(QTouchDevicePrivate::get(const_cast(dev))->id), + mTouchDeviceId(QTouchDevicePrivate::get(const_cast(device))->id), mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), mSequenceId(sequenceId), mIntValue(intValue) { } +/*! + \since 5.10 + + Returns the device. +*/ + const QTouchDevice *QNativeGestureEvent::device() const { return QTouchDevicePrivate::deviceById(mTouchDeviceId); -- cgit v1.2.3