summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri4
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qclipboard.h1
-rw-r--r--src/gui/kernel/qcursor.h1
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qdnd.cpp35
-rw-r--r--src/gui/kernel/qdnd_p.h1
-rw-r--r--src/gui/kernel/qdrag.h1
-rw-r--r--src/gui/kernel/qevent.cpp139
-rw-r--r--src/gui/kernel/qevent.h31
-rw-r--r--src/gui/kernel/qevent_p.h7
-rw-r--r--src/gui/kernel/qgenericplugin.h1
-rw-r--r--src/gui/kernel/qgenericpluginfactory.h1
-rw-r--r--src/gui/kernel/qguiapplication.cpp52
-rw-r--r--src/gui/kernel/qguiapplication.h4
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp9
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h10
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h1
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h1
-rw-r--r--src/gui/kernel/qinputmethod.h1
-rw-r--r--src/gui/kernel/qinputmethod_p.h1
-rw-r--r--src/gui/kernel/qkeymapper_p.h1
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qoffscreensurface.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp15
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qopenglwindow.cpp2
-rw-r--r--src/gui/kernel/qopenglwindow.h2
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h1
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h1
-rw-r--r--src/gui/kernel/qpalette.h1
-rw-r--r--src/gui/kernel/qpixelformat.h2
-rw-r--r--src/gui/kernel/qplatformclipboard.h2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp10
-rw-r--r--src/gui/kernel/qplatformcursor.h9
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp95
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h70
-rw-r--r--src/gui/kernel/qplatformdrag.h2
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h1
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.h4
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_p.h1
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h1
-rw-r--r--src/gui/kernel/qplatformmenu.h4
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h1
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h1
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h1
-rw-r--r--src/gui/kernel/qplatformscreen.h1
-rw-r--r--src/gui/kernel/qplatformscreen_p.h2
-rw-r--r--src/gui/kernel/qplatformservices.h2
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h1
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h1
-rw-r--r--src/gui/kernel/qplatformsurface.h1
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.h1
-rw-r--r--src/gui/kernel/qplatformtheme.cpp25
-rw-r--r--src/gui/kernel/qplatformtheme.h13
-rw-r--r--src/gui/kernel/qplatformtheme_p.h4
-rw-r--r--src/gui/kernel/qplatformthemefactory_p.h1
-rw-r--r--src/gui/kernel/qplatformthemeplugin.h1
-rw-r--r--src/gui/kernel/qplatformwindow.h1
-rw-r--r--src/gui/kernel/qplatformwindow_p.h1
-rw-r--r--src/gui/kernel/qrasterwindow.h1
-rw-r--r--src/gui/kernel/qscreen.cpp4
-rw-r--r--src/gui/kernel/qscreen.h1
-rw-r--r--src/gui/kernel/qscreen_p.h1
-rw-r--r--src/gui/kernel/qsessionmanager.h1
-rw-r--r--src/gui/kernel/qsessionmanager_p.h1
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h1
-rw-r--r--src/gui/kernel/qshortcutmap_p.h1
-rw-r--r--src/gui/kernel/qsimpledrag_p.h1
-rw-r--r--src/gui/kernel/qstylehints.cpp32
-rw-r--r--src/gui/kernel/qstylehints.h5
-rw-r--r--src/gui/kernel/qsurface.h1
-rw-r--r--src/gui/kernel/qsurfaceformat.h8
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtguiglobal.h60
-rw-r--r--src/gui/kernel/qtguiglobal_p.h58
-rw-r--r--src/gui/kernel/qtouchdevice.h1
-rw-r--r--src/gui/kernel/qtouchdevice_p.h1
-rw-r--r--src/gui/kernel/qwindow.h1
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h11
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h1
96 files changed, 628 insertions, 209 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 73a5a7b6ab..3b7e03a0ff 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 \
@@ -137,7 +139,7 @@ SOURCES += \
kernel/qhighdpiscaling.cpp
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += \
kernel/qplatformopenglcontext.h \
kernel/qopenglcontext.h \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index bb3895c2f5..ec6c0bcc36 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.cpp b/src/gui/kernel/qdnd.cpp
index 21f9b46654..a59612474b 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -149,17 +149,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
-static QStringList imageReadMimeFormats()
+static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
- QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ formats.reserve(imageFormats.size());
+ for (const auto &format : imageFormats)
+ formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
@@ -169,25 +164,15 @@ static QStringList imageReadMimeFormats()
return formats;
}
-
-static QStringList imageWriteMimeFormats()
+static inline QStringList imageReadMimeFormats()
{
- QStringList formats;
- QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ return imageMimeFormats(QImageReader::supportedImageFormats());
+}
- //put png at the front because it is best
- int pngIndex = formats.indexOf(QLatin1String("image/png"));
- if (pngIndex != -1 && pngIndex != 0)
- formats.move(pngIndex, 0);
- return formats;
+static inline QStringList imageWriteMimeFormats()
+{
+ return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
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 19220b5492..affc4c2526 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)
{
}
@@ -3967,6 +3975,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
@@ -3975,6 +3984,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#endif
case QEvent::FocusAboutToChange:
case QEvent::FocusIn:
case QEvent::FocusOut:
@@ -4414,6 +4424,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 +4471,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 +4690,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 +4753,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 +4897,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 +5175,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..a062331bd8 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>
@@ -51,7 +52,7 @@
#include <QtCore/qvector.h>
#include <QtCore/qset.h> // ### Qt 6: Remove
#include <QtCore/qurl.h>
-#include <QtCore/qfile.h> // ### Qt 6: Replace by <qiodevice.h> and forward declare QFile
+#include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile
#include <QtGui/qvector2d.h>
#include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration
@@ -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 f60cfd8af3..2ed7eb2cfb 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 fccd81f8e8..1085b546a7 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.cpp b/src/gui/kernel/qkeysequence.cpp
index 9a75f4bc83..d59bd63caf 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1211,9 +1211,13 @@ QString QKeySequence::encodeString(int key)
static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
{
- if (!str.isEmpty())
- str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+")
- : QString::fromLatin1("+");
+ if (!str.isEmpty()) {
+ if (format == QKeySequence::NativeText)
+ str += QCoreApplication::translate("QShortcut", "+");
+ else
+ str += QLatin1Char('+');
+ }
+
str += theKey;
}
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 2fe8446c65..57f70356b8 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.cpp b/src/gui/kernel/qplatformcursor.cpp
index c644d4769a..af0214e016 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -49,16 +49,6 @@
QT_BEGIN_NAMESPACE
-QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
-{
- QList<QPlatformCursor *> result;
- for (const QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)) {
- if (QPlatformCursor *cursor = screen->handle()->cursor())
- result.push_back(cursor);
- }
- return result;
-}
-
/*!
\class QPlatformCursor
\since 5.0
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index 52c93c87e3..dddd9e5831 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>
@@ -75,13 +76,6 @@ private:
QPoint hot;
};
-class QPlatformCursor;
-
-class Q_GUI_EXPORT QPlatformCursorPrivate {
-public:
- static QList<QPlatformCursor *> getInstances();
-};
-
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
QPlatformCursor();
@@ -95,7 +89,6 @@ public:
virtual void setPos(const QPoint &pos);
private:
- Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
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.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 82a88eca04..2afb5e6ba5 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
switch (imageformat) {
case QImage::Format_ARGB32_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
swizzle = true;
break;
case QImage::Format_RGBA8888_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
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..f08f0ef494 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>
@@ -83,7 +83,9 @@ public:
virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0;
+#ifndef QT_NO_SHORTCUT
virtual void setShortcut(const QKeySequence& shortcut) = 0;
+#endif
virtual void setEnabled(bool enabled) = 0;
virtual void setIconSize(int size) = 0;
virtual void setNativeContents(WId item) { Q_UNUSED(item); }
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..9c140f1d68 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QVariant>
#include <QtCore/QStringList>
#include <QtCore/qfileinfo.h>
+#include <qicon.h>
#include <qpalette.h>
#include <qtextformat.h>
#include <private/qiconloader_p.h>
@@ -152,6 +153,7 @@ QT_BEGIN_NAMESPACE
*/
+#ifndef QT_NO_SHORTCUT
// Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined.
@@ -335,6 +337,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
+#endif
QPlatformThemePrivate::QPlatformThemePrivate()
: systemPalette(0)
@@ -405,14 +408,22 @@ QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) co
return QPixmap();
}
-QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions) const
+/*!
+ \brief Return an icon for \a fileInfo, observing \a iconOptions.
+
+ This function is queried by QFileIconProvider and similar classes to obtain
+ an icon for a file. If it does not return a non-null icon, fileIconPixmap()
+ is queried for a specific size.
+
+ \since 5.8
+*/
+
+QIcon QPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
{
Q_UNUSED(fileInfo);
- Q_UNUSED(size);
Q_UNUSED(iconOptions);
// TODO Should return QCommonStyle pixmaps?
- return QPixmap();
+ return QIcon();
}
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
@@ -444,6 +455,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);
}
@@ -580,6 +593,7 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
+#ifndef QT_NO_SHORTCUT
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
typedef bool result_type;
@@ -630,6 +644,7 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
return list;
}
+#endif
/*!
Returns the text of a standard \a button.
@@ -727,10 +742,12 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme;
+#ifndef QT_NO_SHORTCUT
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
result |= KB_X11;
+#endif
return result;
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index c4c7482995..686dbed4b1 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -49,12 +49,13 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QScopedPointer>
#include <QtGui/QKeySequence>
QT_BEGIN_NAMESPACE
+class QIcon;
class QIconEngine;
class QMenu;
class QMenuBar;
@@ -270,7 +271,8 @@ public:
AnimateComboUiEffect = 0x8,
AnimateTooltipUiEffect = 0x10,
FadeTooltipUiEffect = 0x20,
- AnimateToolBoxUiEffect = 0x40
+ AnimateToolBoxUiEffect = 0x40,
+ HoverEffect = 0x80
};
enum IconOption {
@@ -300,12 +302,13 @@ public:
virtual QVariant themeHint(ThemeHint hint) const;
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
- virtual QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const;
-
+ virtual QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = 0) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
+#ifndef QT_NO_SHORTCUT
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
+#endif
virtual QString standardButtonText(int button) const;
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index 11f9e261ef..73deb890bb 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
@@ -67,8 +67,10 @@ public:
void initializeSystemPalette();
+#ifndef QT_NO_SHORTCUT
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
+#endif
static unsigned currentKeyPlatforms();
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.cpp b/src/gui/kernel/qscreen.cpp
index bc4a25a65f..1dd8fb5e67 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -667,6 +667,10 @@ void QScreenPrivate::updatePrimaryOrientation()
that are not part of the application, window system frames, and so
on.
+ \warning Grabbing windows that are not part of the application is
+ not supported on systems such as iOS, where sandboxing/security
+ prevents reading pixels of windows not owned by the application.
+
The grabWindow() function grabs pixels from the screen, not from
the window, i.e. if there is another window partially or entirely
over the one you grab, you get pixels from the overlying window,
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..246163609e 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -39,8 +39,9 @@
#ifndef QSURFACEFORMAT_H
#define QSURFACEFORMAT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -50,6 +51,7 @@ class QSurfaceFormatPrivate;
class Q_GUI_EXPORT QSurfaceFormat
{
+ Q_GADGET
public:
enum FormatOption {
StereoBuffers = 0x0001,
@@ -57,6 +59,7 @@ public:
DeprecatedFunctions = 0x0004,
ResetNotification = 0x0008
};
+ Q_ENUM(FormatOption)
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
enum SwapBehavior {
@@ -65,6 +68,7 @@ public:
DoubleBuffer,
TripleBuffer
};
+ Q_ENUM(SwapBehavior)
enum RenderableType {
DefaultRenderableType = 0x0,
@@ -72,12 +76,14 @@ public:
OpenGLES = 0x2,
OpenVG = 0x4
};
+ Q_ENUM(RenderableType)
enum OpenGLContextProfile {
NoProfile,
CoreProfile,
CompatibilityProfile
};
+ Q_ENUM(OpenGLContextProfile)
QSurfaceFormat();
/*implicit*/ QSurfaceFormat(FormatOptions options);
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..8a7409e3d9
--- /dev/null
+++ b/src/gui/kernel/qtguiglobal.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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>
+#include <QtGui/qtgui-config.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..d2c0b3c5d1
--- /dev/null
+++ b/src/gui/kernel/qtguiglobal_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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>
+#include <QtGui/private/qtgui-config_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 4020376feb..b8a9f5d3de 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 1b7edb1278..7c6bbc26c8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -236,7 +236,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#else
Q_UNUSED(window)
Q_UNUSED(timestamp)
- Q_UNUSED(key)
+ Q_UNUSED(keyCode)
Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey)
@@ -474,7 +474,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);
@@ -922,6 +925,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 6bf87439b9..e7e47ac6d9 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>