diff options
Diffstat (limited to 'src/gui/kernel')
91 files changed, 564 insertions, 151 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 73a5a7b6ab..0e224df1ff 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -6,6 +6,8 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h KERNEL_P= kernel HEADERS += \ + kernel/qtguiglobal.h \ + kernel/qtguiglobal_p.h \ kernel/qgenericpluginfactory.h \ kernel/qgenericplugin.h \ kernel/qwindowsysteminterface.h \ diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 21dbdadcf8..e9da36a42a 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -553,7 +553,7 @@ bool QClipboard::ownsFindBuffer() const bool QClipboard::supportsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->supportsMode(mode); + return clipboard && clipboard->supportsMode(mode); } /*! @@ -565,7 +565,7 @@ bool QClipboard::supportsMode(Mode mode) const bool QClipboard::ownsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->ownsMode(mode); + return clipboard && clipboard->ownsMode(mode); } /*! diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index 2588288880..e91444d3dc 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -40,6 +40,7 @@ #ifndef QCLIPBOARD_H #define QCLIPBOARD_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 814e8ab7bd..c7e9188e5b 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -40,6 +40,7 @@ #ifndef QCURSOR_H #define QCURSOR_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qpoint.h> #include <QtGui/qwindowdefs.h> diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index 8dcea7fdcc..37245a793f 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -51,8 +51,8 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qatomic.h" -#include "QtCore/qglobal.h" #include "QtCore/qnamespace.h" #include "QtGui/qpixmap.h" diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index af7aaf771a..6f2ec46252 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qobject.h" #include "QtCore/qmap.h" #include "QtCore/qmimedata.h" diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h index 6332899c39..a8288e1b53 100644 --- a/src/gui/kernel/qdrag.h +++ b/src/gui/kernel/qdrag.h @@ -40,6 +40,7 @@ #ifndef QDRAG_H #define QDRAG_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f4f07d555b..d574ba5cc6 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -289,7 +289,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0) + : QMouseEvent(type, localPos, localPos, screenPos, button, buttons, modifiers) {} /*! @@ -342,7 +342,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &wind QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source) - : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0) + : QMouseEvent(type, localPos, windowPos, screenPos, button, buttons, modifiers) { QGuiApplicationPrivate::setMouseEventSource(this, source); } @@ -405,6 +405,18 @@ Qt::MouseEventFlags QMouseEvent::flags() const */ /*! + \fn void QMouseEvent::setLocalPos(const QPointF &localPosition) + + \since 5.8 + + \internal + + Sets the local position in the mouse event to \a localPosition. This allows to re-use one event + when sending it to a series of receivers that expect the local pos in their + respective local coordinates. +*/ + +/*! \fn QPointF QMouseEvent::windowPos() const \since 5.0 @@ -829,9 +841,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), - angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), - src(Qt::MouseEventNotSynthesized), invertedScrolling(false) + : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, + buttons, modifiers, Qt::NoScrollPhase) {} /*! @@ -860,9 +871,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase) - : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), - angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), - src(Qt::MouseEventNotSynthesized), invertedScrolling(false) + : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, + buttons, modifiers, phase, Qt::MouseEventNotSynthesized) {} /*! @@ -896,9 +906,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source) - : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), - angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source), - invertedScrolling(false) + : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, + buttons, modifiers, phase, source, false) {} /*! @@ -1767,7 +1776,7 @@ QIconDragEvent::~QIconDragEvent() coordinates. */ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos) - : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason) + : QContextMenuEvent(reason, pos, globalPos, Qt::NoModifier) {} /*! @@ -2065,6 +2074,16 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) */ /*! + \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length) + \overload + \since 5.7 + + Constructs an input method attribute with no value. \a type + specifies the type of attribute, and \a start and \a length + the position of the attribute. +*/ + +/*! Constructs an event of type QEvent::InputMethod. The attributes(), preeditString(), commitString(), replacementStart(), and replacementLength() are initialized to default values. @@ -2440,19 +2459,8 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID) - : QInputEvent(type, keyState), - mPos(pos), - mGPos(globalPos), - mDev(device), - mPointerType(pointerType), - mXT(xTilt), - mYT(yTilt), - mZ(z), - mPress(pressure), - mTangential(tangentialPressure), - mRot(rotation), - mUnique(uniqueID), - mExtra(new QTabletEventPrivate(Qt::NoButton, Qt::NoButton)) + : QTabletEvent(type, pos, globalPos, device, pointerType, pressure, xTilt, yTilt, + tangentialPressure, rotation, z, keyState, uniqueID, Qt::NoButton, Qt::NoButton) { } @@ -4414,6 +4422,7 @@ QTouchEvent::~QTouchEvent() The values of this enum describe additional information about a touch point. \value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger. + \value Token Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger. */ /*! @@ -4460,6 +4469,22 @@ int QTouchEvent::TouchPoint::id() const } /*! + \since 5.8 + Returns the unique ID of this touch point or token, if any. + + It is normally invalid (with a \l {QPointerUniqueId::numeric()} {numeric()} value of -1), + because touchscreens cannot uniquely identify fingers. But when the + \l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely + identify a specific token (fiducial object). + + \sa flags +*/ +QPointerUniqueId QTouchEvent::TouchPoint::uniqueId() const +{ + return d->uniqueId; +} + +/*! Returns the current state of this touch point. */ Qt::TouchPointState QTouchEvent::TouchPoint::state() const @@ -4663,6 +4688,19 @@ qreal QTouchEvent::TouchPoint::pressure() const } /*! + \since 5.8 + Returns the angular orientation of this touch point. The return value is in degrees, + where zero (the default) indicates the finger or token is pointing upwards, + a negative angle means it's rotated to the left, and a positive angle means + it's rotated to the right. Most touchscreens do not detect rotation, so + zero is the most common value. +*/ +qreal QTouchEvent::TouchPoint::rotation() const +{ + return d->rotation; +} + +/*! Returns a velocity vector for this touch point. The vector is in the screen's coordinate system, using pixels per seconds for the magnitude. @@ -4713,6 +4751,14 @@ void QTouchEvent::TouchPoint::setId(int id) } /*! \internal */ +void QTouchEvent::TouchPoint::setUniqueId(qint64 uid) +{ + if (d->ref.load() != 1) + d = d->detach(); + d->uniqueId = QPointerUniqueId(uid); +} + +/*! \internal */ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) { if (d->ref.load() != 1) @@ -4849,6 +4895,14 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure) } /*! \internal */ +void QTouchEvent::TouchPoint::setRotation(qreal angle) +{ + if (d->ref.load() != 1) + d = d->detach(); + d->rotation = angle; +} + +/*! \internal */ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) { if (d->ref.load() != 1) @@ -5119,4 +5173,37 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const return m_applicationState; } +/*! + \class QPointerUniqueId + \since 5.8 + \ingroup events + \inmodule QtGui + + \brief QPointerUniqueId identifies a unique object, such as a tagged token + or stylus, which is used with a pointing device. + + \sa QTouchEvent::TouchPoint +*/ + +/*! + Constructs a unique pointer ID with a numeric \a id provided by the hardware. + The default is -1, which means an invalid pointer ID. +*/ +QPointerUniqueId::QPointerUniqueId(qint64 id) + : m_numericId(id) +{ +} + +/*! + \property QPointerUniqueId::numeric + \brief the numeric unique ID of the token represented by a touchpoint + + This is the numeric unique ID if the device provides that type of ID; + otherwise it is -1. +*/ +qint64 QPointerUniqueId::numeric() const +{ + return m_numericId; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 570212966f..93374b2299 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -40,6 +40,7 @@ #ifndef QEVENT_H #define QEVENT_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <QtGui/qregion.h> #include <QtCore/qnamespace.h> @@ -131,6 +132,8 @@ public: inline Qt::MouseButton button() const { return b; } inline Qt::MouseButtons buttons() const { return mouseState; } + inline void setLocalPos(const QPointF &localPosition) { l = localPosition; } + #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline QPointF posF() const { return l; } #endif @@ -535,8 +538,9 @@ public: class Attribute { public: Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {} - AttributeType type; + Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {} + AttributeType type; int start; int length; QVariant value; @@ -789,6 +793,22 @@ inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} #endif // QT_NO_SHORTCUT +class QPointerUniqueIdPrivate; +class Q_GUI_EXPORT QPointerUniqueId +{ + Q_GADGET + Q_PROPERTY(qint64 numeric READ numeric CONSTANT) +public: + explicit QPointerUniqueId(qint64 id = -1); + + qint64 numeric() const; + +private: + // TODO for TUIO 2, or any other type of complex token ID, a d-pointer can replace + // m_numericId without changing the size of this class. + qint64 m_numericId; +}; + class QTouchEventTouchPointPrivate; class Q_GUI_EXPORT QTouchEvent : public QInputEvent { @@ -797,7 +817,8 @@ public: { public: enum InfoFlag { - Pen = 0x0001 + Pen = 0x0001, + Token = 0x0002 }; #ifndef Q_MOC_RUN // otherwise moc gives @@ -823,6 +844,7 @@ public: { qSwap(d, other.d); } int id() const; + QPointerUniqueId uniqueId() const; Qt::TouchPointState state() const; @@ -847,12 +869,14 @@ public: QRectF screenRect() const; qreal pressure() const; + qreal rotation() const; QVector2D velocity() const; InfoFlags flags() const; QVector<QPointF> rawScreenPositions() const; // internal void setId(int id); + void setUniqueId(qint64 uid); void setState(Qt::TouchPointStates state); void setPos(const QPointF &pos); void setScenePos(const QPointF &scenePos); @@ -870,6 +894,7 @@ public: void setSceneRect(const QRectF &sceneRect); void setScreenRect(const QRectF &screenRect); void setPressure(qreal pressure); + void setRotation(qreal angle); void setVelocity(const QVector2D &v); void setFlags(InfoFlags flags); void setRawScreenPositions(const QVector<QPointF> &positions); diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 726aa05d36..7e82b9c654 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -40,7 +40,7 @@ #ifndef QEVENT_P_H #define QEVENT_P_H -#include <QtCore/qglobal.h> +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qurl.h> #include <QtGui/qevent.h> @@ -65,7 +65,8 @@ public: : ref(1), id(id), state(Qt::TouchPointReleased), - pressure(qreal(-1.)) + pressure(qreal(-1.)), + rotation(qreal(0.)) { } inline QTouchEventTouchPointPrivate *detach() @@ -79,12 +80,14 @@ public: QAtomicInt ref; int id; + QPointerUniqueId uniqueId; Qt::TouchPointStates state; QRectF rect, sceneRect, screenRect; QPointF normalizedPos, startPos, startScenePos, startScreenPos, startNormalizedPos, lastPos, lastScenePos, lastScreenPos, lastNormalizedPos; qreal pressure; + qreal rotation; QVector2D velocity; QTouchEvent::TouchPoint::InfoFlags flags; QVector<QPointF> rawScreenPositions; diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h index 7f1a493861..e8aa2e6f32 100644 --- a/src/gui/kernel/qgenericplugin.h +++ b/src/gui/kernel/qgenericplugin.h @@ -40,6 +40,7 @@ #ifndef QGENERICPLUGIN_H #define QGENERICPLUGIN_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/gui/kernel/qgenericpluginfactory.h b/src/gui/kernel/qgenericpluginfactory.h index 282f3fed6d..9cc77a0590 100644 --- a/src/gui/kernel/qgenericpluginfactory.h +++ b/src/gui/kernel/qgenericpluginfactory.h @@ -40,6 +40,7 @@ #ifndef QGENERICPLUGINFACTORY_H #define QGENERICPLUGINFACTORY_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 33b3d3f715..416c899270 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -104,13 +104,13 @@ #if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) # include <QtCore/qt_windows.h> # include <QtCore/QLibraryInfo> # if defined(Q_OS_WINPHONE) # include <Objbase.h> # endif -#endif // Q_OS_WIN && !Q_OS_WINCE +#endif // Q_OS_WIN #include <ctype.h> @@ -656,9 +656,20 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags */ void QGuiApplication::setApplicationDisplayName(const QString &name) { - if (!QGuiApplicationPrivate::displayName) - QGuiApplicationPrivate::displayName = new QString; - *QGuiApplicationPrivate::displayName = name; + if (!QGuiApplicationPrivate::displayName) { + QGuiApplicationPrivate::displayName = new QString(name); + if (qGuiApp) { + disconnect(qGuiApp, &QGuiApplication::applicationNameChanged, + qGuiApp, &QGuiApplication::applicationDisplayNameChanged); + + if (QGuiApplicationPrivate::displayName != applicationName()) + emit qGuiApp->applicationDisplayNameChanged(); + } + } else if (name != *QGuiApplicationPrivate::displayName) { + *QGuiApplicationPrivate::displayName = name; + if (qGuiApp) + emit qGuiApp->applicationDisplayNameChanged(); + } } QString QGuiApplication::applicationDisplayName() @@ -1054,7 +1065,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) \li \c eglfs is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 or Wayland). For more information, see \l{EGLFS}. - \li \c ios + \li \c ios (also used for tvOS) \li \c kms is an experimental platform plugin using kernel modesetting and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering Manager). @@ -1102,12 +1113,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform keys.join(QStringLiteral(", "))); } fatalMessage += QStringLiteral("Reinstalling the application may fix this problem."); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Windows: Display message box unless it is a console application // or debug build showing an assert box. if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT qFatal("%s", qPrintable(fatalMessage)); return; } @@ -1186,7 +1197,7 @@ static void init_plugins(const QList<QByteArray> &pluginList) if (plugin) QGuiApplicationPrivate::generic_plugin_list.append(plugin); else - qWarning() << "No such plugin for spec " << pluginSpec; + qWarning("No such plugin for spec \"%s\"", pluginSpec.constData()); } } @@ -1310,7 +1321,7 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; -# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# if defined(Q_OS_WIN) wchar_t guidstr[40]; GUID guid; CoCreateGuid(&guid); @@ -1424,9 +1435,8 @@ void QGuiApplicationPrivate::init() init_plugins(pluginList); QWindowSystemInterface::flushWindowSystemEvents(); -#ifndef QT_NO_SESSIONMANAGER Q_Q(QGuiApplication); - +#ifndef QT_NO_SESSIONMANAGER // connect to the session manager session_manager = new QSessionManager(q, session_id, session_key); #endif @@ -1455,6 +1465,10 @@ void QGuiApplicationPrivate::init() if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); + + if (!QGuiApplicationPrivate::displayName) + QObject::connect(q, &QGuiApplication::applicationNameChanged, + q, &QGuiApplication::applicationDisplayNameChanged); } extern void qt_cleanupFontDatabase(); @@ -2450,6 +2464,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QWindow *window = e->window.data(); typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents; + bool velocityOnly = false; for (int i = 0; i < e->points.count(); ++i) { QTouchEvent::TouchPoint touchPoint = e->points.at(i); @@ -2526,8 +2541,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // Stationary points might not be delivered down to the receiving item // and get their position transformed, keep the old values instead. - if (touchPoint.state() != Qt::TouchPointStationary) + if (touchPoint.state() == Qt::TouchPointStationary) { + if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { + touchInfo.touchPoint.setVelocity(touchPoint.velocity()); + velocityOnly = true; + } + } else { touchInfo.touchPoint = touchPoint; + } break; } @@ -2561,7 +2582,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; case Qt::TouchPointStationary: // don't send the event if nothing changed - continue; + if (velocityOnly) + eventType = QEvent::TouchUpdate; + else + continue; default: eventType = QEvent::TouchUpdate; break; diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 10057c5b7f..6721970222 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -40,6 +40,7 @@ #ifndef QGUIAPPLICATION_H #define QGUIAPPLICATION_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qcoreapplication.h> #include <QtGui/qwindowdefs.h> #include <QtGui/qinputmethod.h> @@ -72,7 +73,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication { Q_OBJECT Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) - Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName) + Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged) Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(QString platformName READ platformName STORED false) @@ -183,6 +184,7 @@ Q_SIGNALS: void saveStateRequest(QSessionManager &sessionManager); #endif void paletteChanged(const QPalette &pal); + void applicationDisplayNameChanged(); protected: bool event(QEvent *) Q_DECL_OVERRIDE; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index a028441a2f..e1a35e048c 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qguiapplication.h> #include <QtCore/QPointF> diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 4cc9e95e81..d6e467db59 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -68,10 +68,11 @@ static inline qreal initialGlobalScaleFactor() } } else { if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) { - qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:" << endl - << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors." << endl - << " " << screenFactorsEnvVar << "to set per-screen factors." << endl - << " " << scaleFactorEnvVar << "to set the application global scale factor."; + qWarning("Warning: %s is deprecated. Instead use:\n" + " %s to enable platform plugin controlled per-screen factors.\n" + " %s to set per-screen factors.\n" + " %s to set the application global scale factor.", + legacyDevicePixelEnvVar, autoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar); int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar); if (dpr > 0) diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index eb3a9d5545..32c8f07dc0 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qmargins.h> #include <QtCore/qmath.h> #include <QtCore/qrect.h> @@ -382,8 +382,7 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow * qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - const auto rects = pixelRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pixelRegion) { pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor), fromNative(rect.size(), scaleFactor)); } @@ -399,7 +398,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW const qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - foreach (const QRect &rect, pixelRegion.rects()) { + for (const QRect &rect : pixelRegion) { const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor; const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor; pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())), @@ -415,8 +414,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pixelRegon; - const auto rects = pointRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pointRegion) { pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor), toNative(rect.size(), scaleFactor)); } diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h index 1cf0443834..11bbaae592 100644 --- a/src/gui/kernel/qinputdevicemanager_p.h +++ b/src/gui/kernel/qinputdevicemanager_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h index 45d8b64172..ae91f3a2ab 100644 --- a/src/gui/kernel/qinputdevicemanager_p_p.h +++ b/src/gui/kernel/qinputdevicemanager_p_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qmap.h> #include <private/qobject_p.h> #include "qinputdevicemanager_p.h" diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h index 1a63d1314e..efdefb6e5a 100644 --- a/src/gui/kernel/qinputmethod.h +++ b/src/gui/kernel/qinputmethod.h @@ -40,6 +40,7 @@ #ifndef QINPUTMETHOD_H #define QINPUTMETHOD_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 3f7cd195ea..81723bbe30 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <qinputmethod.h> #include <private/qobject_p.h> #include <QtCore/QWeakPointer> diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 59977688e4..aeec7b7414 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <qobject.h> #include <private/qobject_p.h> #include <qkeysequence.h> diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index 3a660b063e..6bdfd84ca3 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -40,7 +40,7 @@ #ifndef QKEYSEQUENCE_H #define QKEYSEQUENCE_H -#include <QtCore/qnamespace.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> #include <QtCore/qobjectdefs.h> diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h index 116e91c0cd..8ba86c31b8 100644 --- a/src/gui/kernel/qkeysequence_p.h +++ b/src/gui/kernel/qkeysequence_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qkeysequence.h" #include <algorithm> diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h index d639407e1a..bacc9c851a 100644 --- a/src/gui/kernel/qoffscreensurface.h +++ b/src/gui/kernel/qoffscreensurface.h @@ -40,6 +40,7 @@ #ifndef QOFFSCREENSURFACE_H #define QOFFSCREENSURFACE_H +#include <QtGui/qtguiglobal.h> #include <QtCore/QObject> #include <QtGui/qsurface.h> diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 0f7bbfd2e1..7e5697e5d8 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -940,13 +940,20 @@ GLuint QOpenGLContext::defaultFramebufferObject() const If \a surface is 0 this is equivalent to calling doneCurrent(). - Do not call this function from a different thread than the one the + Avoid calling this function from a different thread than the one the QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a different thread you should first call make sure it's not current in the current thread, by calling doneCurrent() if necessary. Then call moveToThread(otherThread) before using it in the other thread. - \sa functions(), doneCurrent() + By default Qt employs a check that enforces the above condition on the + thread affinity. It is still possible to disable this check by setting the + \c{Qt::AA_DontCheckOpenGLContextThreadAffinity} application attribute. Be + sure to understand the consequences of using QObjects from outside + the thread they live in, as explained in the + \l{QObject#Thread Affinity}{QObject thread affinity} documentation. + + \sa functions(), doneCurrent(), Qt::AA_DontCheckOpenGLContextThreadAffinity */ bool QOpenGLContext::makeCurrent(QSurface *surface) { @@ -954,8 +961,10 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (!isValid()) return false; - if (Q_UNLIKELY(thread() != QThread::currentThread())) + if (Q_UNLIKELY(!qApp->testAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity) + && thread() != QThread::currentThread())) { qFatal("Cannot make QOpenGLContext current in a different thread"); + } if (!surface) { doneCurrent(); diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 33e3f1c3f6..3ec9ce3188 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -40,7 +40,7 @@ #ifndef QOPENGLCONTEXT_H #define QOPENGLCONTEXT_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #ifndef QT_NO_OPENGL diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 4a5fbab364..33e930eabe 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -51,6 +51,8 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> + #ifndef QT_NO_OPENGL #include "qopengl.h" diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index 8ab5c08442..e1bd3d11b2 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -42,7 +42,7 @@ #include <QtGui/QOpenGLFramebufferObject> #include <QtGui/QOpenGLPaintDevice> #include <QtGui/QOpenGLFunctions> -#include <QtGui/private/qopengltextureblitter_p.h> +#include <QtGui/QOpenGLTextureBlitter> #include <QtGui/private/qopenglextensions_p.h> #include <QtGui/private/qopenglcontext_p.h> #include <QtGui/QMatrix4x4> diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h index 6e2a8ab904..fe236f9538 100644 --- a/src/gui/kernel/qopenglwindow.h +++ b/src/gui/kernel/qopenglwindow.h @@ -40,7 +40,7 @@ #ifndef QOPENGLWINDOW_H #define QOPENGLWINDOW_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #ifndef QT_NO_OPENGL diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h index 1b66ed7c41..81b41dcdd5 100644 --- a/src/gui/kernel/qpaintdevicewindow.h +++ b/src/gui/kernel/qpaintdevicewindow.h @@ -40,6 +40,7 @@ #ifndef QPAINTDEVICEWINDOW_H #define QPAINTDEVICEWINDOW_H +#include <QtGui/qtguiglobal.h> #include <QtGui/QWindow> #include <QtGui/QPaintDevice> diff --git a/src/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h index 39cd1b3615..a16b83689e 100644 --- a/src/gui/kernel/qpaintdevicewindow_p.h +++ b/src/gui/kernel/qpaintdevicewindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/QPaintDeviceWindow> #include <QtCore/QCoreApplication> #include <QtGui/private/qwindow_p.h> diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index c130a1844b..d04fb1f0c5 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -40,6 +40,7 @@ #ifndef QPALETTE_H #define QPALETTE_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <QtGui/qcolor.h> #include <QtGui/qbrush.h> diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h index a78a3b5ad3..6b2d6a6ac7 100644 --- a/src/gui/kernel/qpixelformat.h +++ b/src/gui/kernel/qpixelformat.h @@ -40,7 +40,7 @@ #ifndef QPIXELFORMAT_H #define QPIXELFORMAT_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h index c30e085d00..60733b0a9f 100644 --- a/src/gui/kernel/qplatformclipboard.h +++ b/src/gui/kernel/qplatformclipboard.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #ifndef QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h index 52c93c87e3..f9c1607663 100644 --- a/src/gui/kernel/qplatformcursor.h +++ b/src/gui/kernel/qplatformcursor.h @@ -48,6 +48,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/QList> #include <QtGui/QImage> #include <QtGui/QMouseEvent> diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fe4d167078..c36186b815 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -156,23 +156,33 @@ public: QString windowTitle; }; -QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) +QFontDialogOptions::QFontDialogOptions(QFontDialogOptionsPrivate *dd) + : d(dd) { } -QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) +QFontDialogOptions::~QFontDialogOptions() { } -QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) +namespace { + struct FontDialogCombined : QFontDialogOptionsPrivate, QFontDialogOptions + { + FontDialogCombined() : QFontDialogOptionsPrivate(), QFontDialogOptions(this) {} + FontDialogCombined(const FontDialogCombined &other) + : QFontDialogOptionsPrivate(other), QFontDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFontDialogOptions> QFontDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FontDialogCombined>::create(); } -QFontDialogOptions::~QFontDialogOptions() +QSharedPointer<QFontDialogOptions> QFontDialogOptions::clone() const { + return QSharedPointer<FontDialogCombined>::create(*static_cast<const FontDialogCombined*>(this)); } QString QFontDialogOptions::windowTitle() const @@ -289,23 +299,33 @@ public: QString windowTitle; }; -QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) +QColorDialogOptions::QColorDialogOptions(QColorDialogOptionsPrivate *dd) + : d(dd) { } -QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) +QColorDialogOptions::~QColorDialogOptions() { } -QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) +namespace { + struct ColorDialogCombined : QColorDialogOptionsPrivate, QColorDialogOptions + { + ColorDialogCombined() : QColorDialogOptionsPrivate(), QColorDialogOptions(this) {} + ColorDialogCombined(const ColorDialogCombined &other) + : QColorDialogOptionsPrivate(other), QColorDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QColorDialogOptions> QColorDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<ColorDialogCombined>::create(); } -QColorDialogOptions::~QColorDialogOptions() +QSharedPointer<QColorDialogOptions> QColorDialogOptions::clone() const { + return QSharedPointer<ColorDialogCombined>::create(*static_cast<const ColorDialogCombined*>(this)); } QString QColorDialogOptions::windowTitle() const @@ -436,23 +456,32 @@ public: QStringList supportedSchemes; }; -QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) +QFileDialogOptions::QFileDialogOptions(QFileDialogOptionsPrivate *dd) + : d(dd) { } -QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) +QFileDialogOptions::~QFileDialogOptions() { } -QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) +namespace { + struct FileDialogCombined : QFileDialogOptionsPrivate, QFileDialogOptions + { + FileDialogCombined() : QFileDialogOptionsPrivate(), QFileDialogOptions(this) {} + FileDialogCombined(const FileDialogCombined &other) : QFileDialogOptionsPrivate(other), QFileDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFileDialogOptions> QFileDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FileDialogCombined>::create(); } -QFileDialogOptions::~QFileDialogOptions() +QSharedPointer<QFileDialogOptions> QFileDialogOptions::clone() const { + return QSharedPointer<FileDialogCombined>::create(*static_cast<const FileDialogCombined*>(this)); } QString QFileDialogOptions::windowTitle() const @@ -728,23 +757,33 @@ public: QPlatformDialogHelper::StandardButtons buttons; }; -QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate) +QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd) + : d(dd) { } -QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d) +QMessageDialogOptions::~QMessageDialogOptions() { } -QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs) +namespace { + struct MessageDialogCombined : QMessageDialogOptionsPrivate, QMessageDialogOptions + { + MessageDialogCombined() : QMessageDialogOptionsPrivate(), QMessageDialogOptions(this) {} + MessageDialogCombined(const MessageDialogCombined &other) + : QMessageDialogOptionsPrivate(other), QMessageDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<MessageDialogCombined>::create(); } -QMessageDialogOptions::~QMessageDialogOptions() +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::clone() const { + return QSharedPointer<MessageDialogCombined>::create(*static_cast<const MessageDialogCombined*>(this)); } QString QMessageDialogOptions::windowTitle() const diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 825dcf293d..6caef070e2 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/QtGlobal> #include <QtCore/QObject> #include <QtCore/QList> @@ -72,6 +73,8 @@ class QFontDialogOptionsPrivate; class QFileDialogOptionsPrivate; class QMessageDialogOptionsPrivate; +#define QPLATFORMDIALOGHELPERS_HAS_CREATE + class Q_GUI_EXPORT QPlatformDialogHelper : public QObject { Q_OBJECT @@ -176,6 +179,10 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QColorDialogOptions { Q_GADGET + Q_DISABLE_COPY(QColorDialogOptions) +protected: + explicit QColorDialogOptions(QColorDialogOptionsPrivate *dd); + ~QColorDialogOptions(); public: enum ColorDialogOption { ShowAlphaChannel = 0x00000001, @@ -186,12 +193,8 @@ public: Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) Q_FLAG(ColorDialogOptions) - QColorDialogOptions(); - QColorDialogOptions(const QColorDialogOptions &rhs); - QColorDialogOptions &operator=(const QColorDialogOptions &rhs); - ~QColorDialogOptions(); - - void swap(QColorDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QColorDialogOptions> create(); + QSharedPointer<QColorDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -211,11 +214,9 @@ public: static void setStandardColor(int index, QRgb color); private: - QSharedDataPointer<QColorDialogOptionsPrivate> d; + QColorDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QColorDialogOptions) - class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -237,6 +238,11 @@ private: class Q_GUI_EXPORT QFontDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFontDialogOptions) +protected: + explicit QFontDialogOptions(QFontDialogOptionsPrivate *dd); + ~QFontDialogOptions(); + public: enum FontDialogOption { NoButtons = 0x00000001, @@ -250,12 +256,8 @@ public: Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) Q_FLAG(FontDialogOptions) - QFontDialogOptions(); - QFontDialogOptions(const QFontDialogOptions &rhs); - QFontDialogOptions &operator=(const QFontDialogOptions &rhs); - ~QFontDialogOptions(); - - void swap(QFontDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFontDialogOptions> create(); + QSharedPointer<QFontDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -266,11 +268,9 @@ public: FontDialogOptions options() const; private: - QSharedDataPointer<QFontDialogOptionsPrivate> d; + QFontDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFontDialogOptions) - class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -292,6 +292,11 @@ private: class Q_GUI_EXPORT QFileDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFileDialogOptions) +protected: + QFileDialogOptions(QFileDialogOptionsPrivate *dd); + ~QFileDialogOptions(); + public: enum ViewMode { Detail, List }; Q_ENUM(ViewMode) @@ -319,12 +324,8 @@ public: Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption) Q_FLAG(FileDialogOptions) - QFileDialogOptions(); - QFileDialogOptions(const QFileDialogOptions &rhs); - QFileDialogOptions &operator=(const QFileDialogOptions &rhs); - ~QFileDialogOptions(); - - void swap(QFileDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFileDialogOptions> create(); + QSharedPointer<QFileDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -383,11 +384,9 @@ public: static QString defaultNameFilterString(); private: - QSharedDataPointer<QFileDialogOptionsPrivate> d; + QFileDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFileDialogOptions) - class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -423,17 +422,18 @@ private: class Q_GUI_EXPORT QMessageDialogOptions { Q_GADGET + Q_DISABLE_COPY(QMessageDialogOptions) +protected: + QMessageDialogOptions(QMessageDialogOptionsPrivate *dd); + ~QMessageDialogOptions(); + public: // Keep in sync with QMessageBox::Icon enum Icon { NoIcon, Information, Warning, Critical, Question }; Q_ENUM(Icon) - QMessageDialogOptions(); - QMessageDialogOptions(const QMessageDialogOptions &rhs); - QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs); - ~QMessageDialogOptions(); - - void swap(QMessageDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QMessageDialogOptions> create(); + QSharedPointer<QMessageDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -454,11 +454,9 @@ public: QPlatformDialogHelper::StandardButtons standardButtons() const; private: - QSharedDataPointer<QMessageDialogOptionsPrivate> d; + QMessageDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QMessageDialogOptions) - class Q_GUI_EXPORT QPlatformMessageDialogHelper : public QPlatformDialogHelper { Q_OBJECT diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h index a9744a17ac..560f984a5b 100644 --- a/src/gui/kernel/qplatformdrag.h +++ b/src/gui/kernel/qplatformdrag.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include <QtGui/QPixmap> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h index 53fc551ad2..0aeef946e6 100644 --- a/src/gui/kernel/qplatformgraphicsbuffer.h +++ b/src/gui/kernel/qplatformgraphicsbuffer.h @@ -50,6 +50,7 @@ // +#include <QtGui/qtguiglobal.h> #include <QtCore/QSize> #include <QtCore/QRect> #include <QtGui/QPixelFormat> diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h index 59fcd12fd0..5b7daff65a 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.h +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h @@ -40,6 +40,7 @@ #ifndef QPLATFORMGRAPHICSBUFFERHELPER_H #define QPLATFORMGRAPHICSBUFFERHELPER_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qpa/qplatformgraphicsbuffer.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h index 7afa6b82f2..26d40cd2c6 100644 --- a/src/gui/kernel/qplatforminputcontext.h +++ b/src/gui/kernel/qplatforminputcontext.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtGui/qinputmethod.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontext_p.h b/src/gui/kernel/qplatforminputcontext_p.h index 14e9dda072..c4f4b97d03 100644 --- a/src/gui/kernel/qplatforminputcontext_p.h +++ b/src/gui/kernel/qplatforminputcontext_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <private/qobject_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h index 4106b2fedc..881421ce49 100644 --- a/src/gui/kernel/qplatforminputcontextfactory_p.h +++ b/src/gui/kernel/qplatforminputcontextfactory_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h index 1bb0332ac7..3f45df922e 100644 --- a/src/gui/kernel/qplatforminputcontextplugin_p.h +++ b/src/gui/kernel/qplatforminputcontextplugin_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 3490e786a8..5bf0df67db 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -402,6 +402,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return true; case ItemViewActivateItemOnSingleClick: return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick); + case UiEffects: + return QPlatformTheme::defaultThemeHint(QPlatformTheme::UiEffects); } return 0; diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 6ac98c20ce..22a834f0e1 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <qpa/qplatformscreen.h> #include <QtGui/qsurfaceformat.h> @@ -155,7 +156,8 @@ public: MousePressAndHoldInterval, TabFocusBehavior, ReplayMousePressOutsidePopup, - ItemViewActivateItemOnSingleClick + ItemViewActivateItemOnSingleClick, + UiEffects }; virtual QVariant styleHint(StyleHint hint) const; diff --git a/src/gui/kernel/qplatformintegrationfactory_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h index ea8c846557..22c77ce8bd 100644 --- a/src/gui/kernel/qplatformintegrationfactory_p.h +++ b/src/gui/kernel/qplatformintegrationfactory_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h index 7d2a9b2a5f..f1136965b7 100644 --- a/src/gui/kernel/qplatformintegrationplugin.h +++ b/src/gui/kernel/qplatformintegrationplugin.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index bd4f4d9beb..6eaabd3e08 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/qpointer.h> #include <QtGui/QFont> #include <QtGui/QKeySequence> diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h index f830221c70..95d6a03dbb 100644 --- a/src/gui/kernel/qplatformnativeinterface.h +++ b/src/gui/kernel/qplatformnativeinterface.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <QtCore/QObject> #include <QtCore/QVariant> diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h index 77a8f63316..7f2e0d475b 100644 --- a/src/gui/kernel/qplatformoffscreensurface.h +++ b/src/gui/kernel/qplatformoffscreensurface.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include "qplatformsurface.h" #include <QtCore/qscopedpointer.h> diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h index 1a38a5fed3..f307cc14f9 100644 --- a/src/gui/kernel/qplatformopenglcontext.h +++ b/src/gui/kernel/qplatformopenglcontext.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qnamespace.h> #ifndef QT_NO_OPENGL diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h index cd300c34c8..030edea880 100644 --- a/src/gui/kernel/qplatformscreen.h +++ b/src/gui/kernel/qplatformscreen.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qmetatype.h> #include <QtCore/qnamespace.h> #include <QtCore/qcoreevent.h> diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h index aa31c4db25..d5dc7b471a 100644 --- a/src/gui/kernel/qplatformscreen_p.h +++ b/src/gui/kernel/qplatformscreen_p.h @@ -51,6 +51,8 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> + QT_BEGIN_NAMESPACE class QScreen; diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h index 52b8ce7854..339bbfde3f 100644 --- a/src/gui/kernel/qplatformservices.h +++ b/src/gui/kernel/qplatformservices.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/QtGlobal> +#include <QtGui/qtguiglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h index 98c364f7fe..ca7cab389b 100644 --- a/src/gui/kernel/qplatformsessionmanager.h +++ b/src/gui/kernel/qplatformsessionmanager.h @@ -51,6 +51,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qmetatype.h> #include <QtCore/qnamespace.h> diff --git a/src/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h index 6e0ba9151f..e11d2f41a9 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache.h +++ b/src/gui/kernel/qplatformsharedgraphicscache.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtGui/qimage.h> diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h index 0bbe811803..5a1e4fe82d 100644 --- a/src/gui/kernel/qplatformsurface.h +++ b/src/gui/kernel/qplatformsurface.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qnamespace.h> #include <QtGui/qsurface.h> #include <QtGui/qsurfaceformat.h> diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h index dcd7225180..c52dbfbd78 100644 --- a/src/gui/kernel/qplatformsystemtrayicon.h +++ b/src/gui/kernel/qplatformsystemtrayicon.h @@ -41,6 +41,7 @@ #ifndef QPLATFORMSYSTEMTRAYICON_H #define QPLATFORMSYSTEMTRAYICON_H +#include <QtGui/qtguiglobal.h> #include "QtCore/qobject.h" #ifndef QT_NO_SYSTEMTRAYICON diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 7f74959a60..32ad057452 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -444,6 +444,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); case QPlatformTheme::ItemViewActivateItemOnSingleClick: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); + case QPlatformTheme::UiEffects: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::UiEffects); default: return QPlatformTheme::defaultThemeHint(hint); } diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index c4c7482995..b16fdd7939 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/QtGlobal> +#include <QtGui/qtguiglobal.h> #include <QtCore/QScopedPointer> #include <QtGui/QKeySequence> @@ -270,7 +270,8 @@ public: AnimateComboUiEffect = 0x8, AnimateTooltipUiEffect = 0x10, FadeTooltipUiEffect = 0x20, - AnimateToolBoxUiEffect = 0x40 + AnimateToolBoxUiEffect = 0x40, + HoverEffect = 0x80 }; enum IconOption { diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h index 11f9e261ef..f2777c57b3 100644 --- a/src/gui/kernel/qplatformtheme_p.h +++ b/src/gui/kernel/qplatformtheme_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/QtGlobal> +#include <QtGui/private/qtguiglobal_p.h> #include "private/qkeysequence_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformthemefactory_p.h b/src/gui/kernel/qplatformthemefactory_p.h index abd78d544d..3f77f03485 100644 --- a/src/gui/kernel/qplatformthemefactory_p.h +++ b/src/gui/kernel/qplatformthemefactory_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformthemeplugin.h b/src/gui/kernel/qplatformthemeplugin.h index 52aa09d1d5..7b56879940 100644 --- a/src/gui/kernel/qplatformthemeplugin.h +++ b/src/gui/kernel/qplatformthemeplugin.h @@ -49,6 +49,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index b2a19dd3d9..dcee4d2d84 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -48,6 +48,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qrect.h> #include <QtCore/qmargins.h> diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h index dc76adca86..62ecd61d9e 100644 --- a/src/gui/kernel/qplatformwindow_p.h +++ b/src/gui/kernel/qplatformwindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qrect.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h index 915aea598f..76312bcda2 100644 --- a/src/gui/kernel/qrasterwindow.h +++ b/src/gui/kernel/qrasterwindow.h @@ -40,6 +40,7 @@ #ifndef QRASTERWINDOW_H #define QRASTERWINDOW_H +#include <QtGui/qtguiglobal.h> #include <QtGui/QPaintDeviceWindow> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index af4e8f4760..98e35aff43 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -40,6 +40,7 @@ #ifndef QSCREEN_H #define QSCREEN_H +#include <QtGui/qtguiglobal.h> #include <QtCore/QList> #include <QtCore/QObject> #include <QtCore/QRect> diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index 544c29a18f..f31658355b 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qscreen.h> #include <qpa/qplatformscreen.h> #include "qhighdpiscaling_p.h" diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h index 54c278afbf..21100b25d9 100644 --- a/src/gui/kernel/qsessionmanager.h +++ b/src/gui/kernel/qsessionmanager.h @@ -40,6 +40,7 @@ #ifndef QSESSIONMANAGER_H #define QSESSIONMANAGER_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtGui/qwindowdefs.h> #include <QtCore/qstring.h> diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h index 982fc801ff..954443430e 100644 --- a/src/gui/kernel/qsessionmanager_p.h +++ b/src/gui/kernel/qsessionmanager_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <private/qobject_p.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h index 21cecba9e8..2c25ca7c76 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow_p.h +++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/QRasterWindow> #include <QtGui/QPixmap> diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h index f513863e5b..8fc68229fb 100644 --- a/src/gui/kernel/qshortcutmap_p.h +++ b/src/gui/kernel/qshortcutmap_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qkeysequence.h" #include "QtCore/qvector.h" #include "QtCore/qscopedpointer.h" diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h index 8924b4d08f..0b8a0bc703 100644 --- a/src/gui/kernel/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <qpa/qplatformdrag.h> #include <QtCore/QObject> diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index ecc2886a04..7ccf1d86b0 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -77,6 +77,7 @@ public: , m_keyboardInputInterval(-1) , m_cursorFlashTime(-1) , m_tabFocusBehavior(-1) + , m_uiEffects(-1) {} int m_mouseDoubleClickInterval; @@ -86,6 +87,7 @@ public: int m_keyboardInputInterval; int m_cursorFlashTime; int m_tabFocusBehavior; + int m_uiEffects; }; /*! @@ -451,4 +453,34 @@ bool QStyleHints::singleClickActivation() const return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool(); } +/*! + \property QStyleHints::useHoverEffects + \brief \c true if UI elements should use hover effects. This is the + standard behavior on desktop platforms with a mouse pointer, whereas + on touch platforms the overhead of hover event delivery can be avoided. + + \since 5.8 +*/ +bool QStyleHints::useHoverEffects() const +{ + Q_D(const QStyleHints); + return (d->m_uiEffects >= 0 ? + d->m_uiEffects : + themeableHint(QPlatformTheme::UiEffects, QPlatformIntegration::UiEffects).toInt()) & QPlatformTheme::HoverEffect; +} + +void QStyleHints::setUseHoverEffects(bool useHoverEffects) +{ + Q_D(QStyleHints); + if (d->m_uiEffects >= 0 && useHoverEffects == bool(d->m_uiEffects & QPlatformTheme::HoverEffect)) + return; + if (d->m_uiEffects == -1) + d->m_uiEffects = 0; + if (useHoverEffects) + d->m_uiEffects |= QPlatformTheme::HoverEffect; + else + d->m_uiEffects &= ~QPlatformTheme::HoverEffect; + emit useHoverEffectsChanged(useHoverEffects); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h index 0b07e60579..fb55cc7ed6 100644 --- a/src/gui/kernel/qstylehints.h +++ b/src/gui/kernel/qstylehints.h @@ -40,6 +40,7 @@ #ifndef QSTYLEHINTS_H #define QSTYLEHINTS_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE @@ -69,6 +70,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL) Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL) Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL) + Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects NOTIFY useHoverEffectsChanged FINAL) public: void setMouseDoubleClickInterval(int mouseDoubleClickInterval); @@ -95,6 +97,8 @@ public: Qt::TabFocusBehavior tabFocusBehavior() const; void setTabFocusBehavior(Qt::TabFocusBehavior tabFocusBehavior); bool singleClickActivation() const; + bool useHoverEffects() const; + void setUseHoverEffects(bool useHoverEffects); Q_SIGNALS: void cursorFlashTimeChanged(int cursorFlashTime); @@ -104,6 +108,7 @@ Q_SIGNALS: void startDragDistanceChanged(int startDragDistance); void startDragTimeChanged(int startDragTime); void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior); + void useHoverEffectsChanged(bool useHoverEffects); private: friend class QGuiApplication; diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h index 86b800a6db..d9ccdc096d 100644 --- a/src/gui/kernel/qsurface.h +++ b/src/gui/kernel/qsurface.h @@ -40,6 +40,7 @@ #ifndef QSURFACE_H #define QSURFACE_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qnamespace.h> #include <QtGui/qsurfaceformat.h> #include <QtCore/qmetatype.h> diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h index 9e8bcc91a7..b4e3f68b97 100644 --- a/src/gui/kernel/qsurfaceformat.h +++ b/src/gui/kernel/qsurfaceformat.h @@ -39,7 +39,7 @@ #ifndef QSURFACEFORMAT_H #define QSURFACEFORMAT_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/qpair.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h index 8d1455f6c8..db12ba1078 100644 --- a/src/gui/kernel/qt_gui_pch.h +++ b/src/gui/kernel/qt_gui_pch.h @@ -47,7 +47,7 @@ // from corelib/global/qt_pch.h #if defined __cplusplus -#include <qglobal.h> +#include <qtguiglobal.h> #ifdef Q_OS_WIN diff --git a/src/gui/kernel/qtguiglobal.h b/src/gui/kernel/qtguiglobal.h new file mode 100644 index 0000000000..f0e64fbc53 --- /dev/null +++ b/src/gui/kernel/qtguiglobal.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTGUIGLOBAL_H +#define QTGUIGLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_GUI_LIB) +# define Q_GUI_EXPORT Q_DECL_EXPORT +# else +# define Q_GUI_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_GUI_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QTGUIGLOBAL_H diff --git a/src/gui/kernel/qtguiglobal_p.h b/src/gui/kernel/qtguiglobal_p.h new file mode 100644 index 0000000000..fd04b8ff95 --- /dev/null +++ b/src/gui/kernel/qtguiglobal_p.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTGUIGLOBAL_P_H +#define QTGUIGLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/qtguiglobal.h> +#include <QtCore/private/qglobal_p.h> + +#endif // QTGUIGLOBAL_P_H diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h index 243f53d4ca..0fb24e47bf 100644 --- a/src/gui/kernel/qtouchdevice.h +++ b/src/gui/kernel/qtouchdevice.h @@ -40,6 +40,7 @@ #ifndef QTOUCHDEVICE_H #define QTOUCHDEVICE_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h index b42b0507d9..203d9fca74 100644 --- a/src/gui/kernel/qtouchdevice_p.h +++ b/src/gui/kernel/qtouchdevice_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qtouchdevice.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 06bd788262..bf25cf64c9 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -40,6 +40,7 @@ #ifndef QWINDOW_H #define QWINDOW_H +#include <QtGui/qtguiglobal.h> #include <QtCore/QObject> #include <QtCore/QEvent> #include <QtCore/QMargins> diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index ccd14f66ae..6d6d5a22ee 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qscreen.h> #include <QtGui/qwindow.h> #include <qpa/qplatformwindow.h> diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index fb6b1831af..b4f3ed4712 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -40,7 +40,7 @@ #ifndef QWINDOWDEFS_H #define QWINDOWDEFS_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/qobjectdefs.h> #include <QtCore/qnamespace.h> diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h index d1000856bb..b546fe305e 100644 --- a/src/gui/kernel/qwindowdefs_win.h +++ b/src/gui/kernel/qwindowdefs_win.h @@ -40,7 +40,7 @@ #ifndef QWINDOWDEFS_WIN_H #define QWINDOWDEFS_WIN_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> QT_BEGIN_NAMESPACE @@ -111,13 +111,4 @@ typedef long HRESULT; typedef struct tagMSG MSG; -QT_BEGIN_NAMESPACE - -Q_CORE_EXPORT HINSTANCE qWinAppInst(); -Q_CORE_EXPORT HINSTANCE qWinAppPrevInst(); -Q_CORE_EXPORT int qWinAppCmdShow(); -Q_WIDGETS_EXPORT HDC qt_win_display_dc(); - -QT_END_NAMESPACE - #endif // QWINDOWDEFS_WIN_H diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 00b8e05f30..2cb9b8053f 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -469,7 +469,10 @@ QList<QTouchEvent::TouchPoint> QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd(); while (point != end) { p.setId(point->id); + if (point->uniqueId >= 0) + p.setUniqueId(point->uniqueId); p.setPressure(point->pressure); + p.setRotation(point->rotation); states |= point->state; p.setState(point->state); @@ -917,6 +920,17 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int #endif } +namespace QTest +{ + Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen) + { + QTouchDevice *ret = new QTouchDevice(); + ret->setType(devType); + QWindowSystemInterface::registerTouchDevice(ret); + return ret; + } +} + Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 00437e8341..3e2e9803b8 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -48,6 +48,7 @@ // source and binary incompatible with future versions of Qt. // +#include <QtGui/qtguiglobal.h> #include <QtCore/QTime> #include <QtGui/qwindowdefs.h> #include <QtCore/QEvent> @@ -117,11 +118,14 @@ public: static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); struct TouchPoint { - TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary) { } + TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { } int id; // for application use + qint64 uniqueId; // for TUIO: object/token ID; otherwise empty + // TODO for TUIO 2.0: add registerPointerUniqueID(QPointerUniqueId) QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) QRectF area; // the touched area, centered at position in screen coordinates qreal pressure; // 0 to 1 + qreal rotation; // 0 means pointing straight up; 0 if unknown (like QTabletEvent::rotation) Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} QVector2D velocity; // in screen coordinate system, pixels / seconds QTouchEvent::TouchPoint::InfoFlags flags; diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index b218c1c68c..bdbf191cbd 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qwindowsysteminterface.h" #include <QElapsedTimer> |