diff options
Diffstat (limited to 'src/gui/kernel')
37 files changed, 283 insertions, 245 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 1f137fc46f..9c80f1e2cc 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -21,7 +21,7 @@ HEADERS += \ kernel/qplatforminputcontextplugin_p.h \ kernel/qplatformintegrationfactory_p.h \ kernel/qplatformintegrationplugin.h \ - kernel/qplatformtheme.h\ + kernel/qplatformtheme.h \ kernel/qplatformtheme_p.h \ kernel/qplatformthemefactory_p.h \ kernel/qplatformthemeplugin.h \ diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 9e4787589f..1ba8760a9d 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -494,7 +494,7 @@ QCursor::QCursor(Qt::CursorShape shape) \sa operator!=(const QCursor &lhs, const QCursor &rhs) */ -bool operator==(const QCursor &lhs, const QCursor &rhs) Q_DECL_NOTHROW +bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept { if (lhs.d == rhs.d) return true; // Copy or same shape diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index d62ee7a053..7966e35840 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -86,13 +86,11 @@ public: QCursor(const QCursor &cursor); ~QCursor(); QCursor &operator=(const QCursor &cursor); -#ifdef Q_COMPILER_RVALUE_REFS - QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } - inline QCursor &operator=(QCursor &&other) Q_DECL_NOTHROW + QCursor(QCursor &&other) noexcept : d(other.d) { other.d = nullptr; } + inline QCursor &operator=(QCursor &&other) noexcept { swap(other); return *this; } -#endif - void swap(QCursor &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QCursor &other) noexcept { qSwap(d, other.d); } operator QVariant() const; @@ -112,13 +110,13 @@ public: inline static void setPos(QScreen *screen, const QPoint &p) { setPos(screen, p.x(), p.y()); } private: - friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) Q_DECL_NOTHROW; + friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept; QCursorData *d; }; Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QCursor) -Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) Q_DECL_NOTHROW; -inline bool operator!=(const QCursor &lhs, const QCursor &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } +Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept; +inline bool operator!=(const QCursor &lhs, const QCursor &rhs) noexcept { return !(lhs == rhs); } /***************************************************************************** QCursor stream functions diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 8f8eb03f87..b1219c8658 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -73,9 +73,9 @@ class QDragPrivate : public QObjectPrivate { public: QDragPrivate() - : source(0) - , target(0) - , data(0) + : source(nullptr) + , target(nullptr) + , data(nullptr) { } QObject *source; QObject *target; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e7a320f3a4..e1d685b1b0 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3764,13 +3764,13 @@ static inline void formatTouchEvent(QDebug d, const QTouchEvent &t) static void formatUnicodeString(QDebug d, const QString &s) { - d << '"' << hex; + d << '"' << Qt::hex; for (int i = 0; i < s.size(); ++i) { if (i) d << ','; d << "U+" << s.at(i).unicode(); } - d << dec << '"'; + d << Qt::dec << '"'; } static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e) @@ -3807,8 +3807,8 @@ static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQuery QDebugStateSaver saver(d); d.noquote(); const Qt::InputMethodQueries queries = e->queries(); - d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries) - << noshowbase << dec << ", {"; + d << "QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex << int(queries) + << Qt::noshowbase << Qt::dec << ", {"; for (unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) { if (queries & mask) { const Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(mask); @@ -4001,7 +4001,7 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) { QDebugStateSaver saver(dbg); dbg.nospace(); - dbg << "TouchPoint(" << hex << tp.id() << dec << " ("; + dbg << "TouchPoint(" << Qt::hex << tp.id() << Qt::dec << " ("; QtDebugUtils::formatQPoint(dbg, tp.pos()); dbg << ") "; QtDebugUtils::formatQEnum(dbg, tp.state()); @@ -4921,7 +4921,7 @@ QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const /*! \internal */ void QTouchEvent::TouchPoint::setId(int id) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->id = id; } @@ -4929,7 +4929,7 @@ void QTouchEvent::TouchPoint::setId(int id) /*! \internal */ void QTouchEvent::TouchPoint::setUniqueId(qint64 uid) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->uniqueId = QPointingDeviceUniqueId::fromNumericId(uid); } @@ -4937,7 +4937,7 @@ void QTouchEvent::TouchPoint::setUniqueId(qint64 uid) /*! \internal */ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->state = state; } @@ -4945,7 +4945,7 @@ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) /*! \internal */ void QTouchEvent::TouchPoint::setPos(const QPointF &pos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->pos = pos; } @@ -4953,7 +4953,7 @@ void QTouchEvent::TouchPoint::setPos(const QPointF &pos) /*! \internal */ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->scenePos = scenePos; } @@ -4961,7 +4961,7 @@ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos) /*! \internal */ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->screenPos = screenPos; } @@ -4969,7 +4969,7 @@ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos) /*! \internal */ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->normalizedPos = normalizedPos; } @@ -4977,7 +4977,7 @@ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->startPos = startPos; } @@ -4985,7 +4985,7 @@ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->startScenePos = startScenePos; } @@ -4993,7 +4993,7 @@ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos) /*! \internal */ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->startScreenPos = startScreenPos; } @@ -5001,7 +5001,7 @@ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->startNormalizedPos = startNormalizedPos; } @@ -5009,7 +5009,7 @@ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormaliz /*! \internal */ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->lastPos = lastPos; } @@ -5017,7 +5017,7 @@ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos) /*! \internal */ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->lastScenePos = lastScenePos; } @@ -5025,7 +5025,7 @@ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos) /*! \internal */ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->lastScreenPos = lastScreenPos; } @@ -5033,7 +5033,7 @@ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos) /*! \internal */ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->lastNormalizedPos = lastNormalizedPos; } @@ -5044,7 +5044,7 @@ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalized */ void QTouchEvent::TouchPoint::setRect(const QRectF &rect) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->pos = rect.center(); d->ellipseDiameters = rect.size(); @@ -5055,7 +5055,7 @@ void QTouchEvent::TouchPoint::setRect(const QRectF &rect) */ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->scenePos = sceneRect.center(); d->ellipseDiameters = sceneRect.size(); @@ -5066,7 +5066,7 @@ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) */ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->screenPos = screenRect.center(); d->ellipseDiameters = screenRect.size(); @@ -5075,7 +5075,7 @@ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) /*! \internal */ void QTouchEvent::TouchPoint::setPressure(qreal pressure) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->pressure = pressure; } @@ -5083,7 +5083,7 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure) /*! \internal */ void QTouchEvent::TouchPoint::setRotation(qreal angle) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->rotation = angle; } @@ -5091,7 +5091,7 @@ void QTouchEvent::TouchPoint::setRotation(qreal angle) /*! \internal */ void QTouchEvent::TouchPoint::setEllipseDiameters(const QSizeF &dia) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->ellipseDiameters = dia; } @@ -5099,7 +5099,7 @@ void QTouchEvent::TouchPoint::setEllipseDiameters(const QSizeF &dia) /*! \internal */ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->velocity = v; } @@ -5107,7 +5107,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) /*! \internal */ void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->rawScreenPositions = positions; } @@ -5117,7 +5117,7 @@ void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &posi */ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags) { - if (d->ref.load() != 1) + if (d->ref.loadRelaxed() != 1) d = d->detach(); d->flags = flags; } @@ -5320,7 +5320,7 @@ QScrollEvent::ScrollState QScrollEvent::scrollState() const /*! Creates a new QScreenOrientationChangeEvent - \a orientation is the new orientation of the screen. + \a screenOrientation is the new orientation of the \a screen. */ QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation) : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation) @@ -5426,7 +5426,7 @@ QPointingDeviceUniqueId QPointingDeviceUniqueId::fromNumericId(qint64 id) \sa isValid() */ -qint64 QPointingDeviceUniqueId::numericId() const Q_DECL_NOTHROW +qint64 QPointingDeviceUniqueId::numericId() const noexcept { return m_numericId; } @@ -5438,7 +5438,7 @@ qint64 QPointingDeviceUniqueId::numericId() const Q_DECL_NOTHROW Returns whether the two unique pointer IDs \a lhs and \a rhs identify the same pointer (\c true) or not (\c false). */ -bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW +bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept { return lhs.numericId() == rhs.numericId(); } @@ -5458,7 +5458,7 @@ bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(QPointingDeviceUniqueId key, uint seed) Q_DECL_NOTHROW +uint qHash(QPointingDeviceUniqueId key, uint seed) noexcept { return qHash(key.numericId(), seed); } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 2b1c6a6e31..eb0a6208a9 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -549,7 +549,7 @@ public: }; class Attribute { public: - Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {} + Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(std::move(val)) {} Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {} AttributeType type; @@ -811,14 +811,14 @@ class Q_GUI_EXPORT QPointingDeviceUniqueId Q_PROPERTY(qint64 numericId READ numericId CONSTANT) public: Q_ALWAYS_INLINE - Q_DECL_CONSTEXPR QPointingDeviceUniqueId() Q_DECL_NOTHROW : m_numericId(-1) {} + Q_DECL_CONSTEXPR QPointingDeviceUniqueId() noexcept : m_numericId(-1) {} // compiler-generated copy/move ctor/assignment operators are ok! // compiler-generated dtor is ok! static QPointingDeviceUniqueId fromNumericId(qint64 id); - Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const Q_DECL_NOTHROW { return m_numericId != -1; } - qint64 numericId() const Q_DECL_NOTHROW; + Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const noexcept { return m_numericId != -1; } + qint64 numericId() const noexcept; private: // TODO: for TUIO 2, or any other type of complex token ID, an internal @@ -829,10 +829,10 @@ private: Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE); template <> class QList<QPointingDeviceUniqueId> {}; // to prevent instantiation: use QVector instead -Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW; -inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW +Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept; +inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept { return !operator==(lhs, rhs); } -Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) noexcept; @@ -855,19 +855,17 @@ public: explicit TouchPoint(int id = -1); TouchPoint(const TouchPoint &other); -#ifdef Q_COMPILER_RVALUE_REFS - TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT + TouchPoint(TouchPoint &&other) noexcept : d(nullptr) { qSwap(d, other.d); } - TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT + TouchPoint &operator=(TouchPoint &&other) noexcept { qSwap(d, other.d); return *this; } -#endif ~TouchPoint(); TouchPoint &operator=(const TouchPoint &other) { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; } - void swap(TouchPoint &other) Q_DECL_NOEXCEPT + void swap(TouchPoint &other) noexcept { qSwap(d, other.d); } int id() const; diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 7df4a1e25b..c2d8bd72b9 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -73,7 +73,7 @@ public: inline QTouchEventTouchPointPrivate *detach() { QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this); - d->ref.store(1); + d->ref.storeRelaxed(1); if (!this->ref.deref()) delete this; return d; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f6e67e05d0..b8bfad4f16 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -68,7 +68,7 @@ #include <qpalette.h> #include <qscreen.h> #include "qsessionmanager.h" -#include <private/qcolorprofile_p.h> +#include <private/qcolortrclut_p.h> #include <private/qscreen_p.h> #include <QtGui/qgenericpluginfactory.h> @@ -1306,6 +1306,58 @@ static void init_plugins(const QList<QByteArray> &pluginList) } } +void QGuiApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options) +{ + QCoreApplicationPrivate::addQtOptions(options); + +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) + const QByteArray sessionType = qgetenv("XDG_SESSION_TYPE"); + const bool x11 = sessionType == "x11"; + // Technically the x11 aliases are only available if platformName is "xcb", but we can't know that here. +#else + const bool x11 = false; +#endif + + options->append(QCommandLineOption(QStringLiteral("platform"), + QGuiApplication::tr("QPA plugin. See QGuiApplication documentation for available options for each plugin."), QStringLiteral("platformName[:options]"))); + options->append(QCommandLineOption(QStringLiteral("platformpluginpath"), + QGuiApplication::tr("Path to the platform plugins."), QStringLiteral("path"))); + options->append(QCommandLineOption(QStringLiteral("platformtheme"), + QGuiApplication::tr("Platform theme."), QStringLiteral("theme"))); + options->append(QCommandLineOption(QStringLiteral("plugin"), + QGuiApplication::tr("Additional plugins to load, can be specified multiple times."), QStringLiteral("plugin"))); + options->append(QCommandLineOption(QStringLiteral("qwindowgeometry"), + QGuiApplication::tr("Window geometry for the main window, using the X11-syntax, like 100x100+50+50."), QStringLiteral("geometry"))); + options->append(QCommandLineOption(QStringLiteral("qwindowicon"), + QGuiApplication::tr("Default window icon."), QStringLiteral("icon"))); + options->append(QCommandLineOption(QStringLiteral("qwindowtitle"), + QGuiApplication::tr("Title of the first window."), QStringLiteral("title"))); + options->append(QCommandLineOption(QStringLiteral("reverse"), + QGuiApplication::tr("Sets the application's layout direction to Qt::RightToLeft (debugging helper)."))); + options->append(QCommandLineOption(QStringLiteral("session"), + QGuiApplication::tr("Restores the application from an earlier session."), QStringLiteral("session"))); + + if (x11) { + options->append(QCommandLineOption(QStringLiteral("display"), + QGuiApplication::tr("Display name, overrides $DISPLAY."), QStringLiteral("display"))); + options->append(QCommandLineOption(QStringLiteral("name"), + QGuiApplication::tr("Instance name according to ICCCM 4.1.2.5."), QStringLiteral("name"))); + options->append(QCommandLineOption(QStringLiteral("nograb"), + QGuiApplication::tr("Disable mouse grabbing (useful in debuggers)."))); + options->append(QCommandLineOption(QStringLiteral("dograb"), + QGuiApplication::tr("Force mouse grabbing (even when running in a debugger)."))); + options->append(QCommandLineOption(QStringLiteral("visual"), + QGuiApplication::tr("ID of the X11 Visual to use."), QStringLiteral("id"))); + // Not using the "QStringList names" solution for those aliases, because it makes the first column too wide + options->append(QCommandLineOption(QStringLiteral("geometry"), + QGuiApplication::tr("Alias for --windowgeometry."), QStringLiteral("geometry"))); + options->append(QCommandLineOption(QStringLiteral("icon"), + QGuiApplication::tr("Alias for --windowicon."), QStringLiteral("icon"))); + options->append(QCommandLineOption(QStringLiteral("title"), + QGuiApplication::tr("Alias for --windowtitle."), QStringLiteral("title"))); + } +} + void QGuiApplicationPrivate::createPlatformIntegration() { QHighDpiScaling::initHighDpiScaling(); @@ -1648,8 +1700,6 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() platform_theme = 0; delete platform_integration; platform_integration = 0; - delete m_a8ColorProfile.load(); - delete m_a32ColorProfile.load(); window_list.clear(); screen_list.clear(); @@ -1832,7 +1882,11 @@ bool QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, return platformWindow->windowEvent(event); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result) +#else bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result) +#endif { return window->nativeEvent(eventType, message, result); } @@ -3993,32 +4047,26 @@ void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) } #endif -const QColorProfile *QGuiApplicationPrivate::colorProfileForA8Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text() { #ifdef Q_OS_WIN - QColorProfile *result = m_a8ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering - if (!m_a8ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a8ColorProfile.load(); + if (!m_a8ColorProfile){ + QColorTrcLut *cs = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering + m_a8ColorProfile.reset(cs); } - return result; + return m_a8ColorProfile.get(); #else return colorProfileForA32Text(); #endif } -const QColorProfile *QGuiApplicationPrivate::colorProfileForA32Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA32Text() { - QColorProfile *result = m_a32ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(fontSmoothingGamma); - if (!m_a32ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a32ColorProfile.load(); + if (!m_a32ColorProfile) { + QColorTrcLut *cs = QColorTrcLut::fromGamma(fontSmoothingGamma); + m_a32ColorProfile.reset(cs); } - return result; + return m_a32ColorProfile.get(); } void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 714c72ac08..2ecde0354a 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -55,6 +55,7 @@ #include <QtGui/qguiapplication.h> #include <QtCore/QPointF> +#include <QtCore/QSharedPointer> #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qthread_p.h> @@ -66,7 +67,7 @@ QT_BEGIN_NAMESPACE -class QColorProfile; +class QColorTrcLut; class QPlatformIntegration; class QPlatformTheme; class QPlatformDragQtResponse; @@ -91,6 +92,7 @@ public: virtual void notifyLayoutDirectionChange(); virtual void notifyActiveWindowChange(QWindow *previous); + void addQtOptions(QList<QCommandLineOption> *options) override; virtual bool shouldQuit() override; bool shouldQuitInternal(const QWindowList &processedWindows); @@ -112,9 +114,9 @@ public: static QAbstractEventDispatcher *qt_qpa_core_dispatcher() { if (QCoreApplication::instance()) - return QCoreApplication::instance()->d_func()->threadData->eventDispatcher.load(); + return QCoreApplication::instance()->d_func()->threadData->eventDispatcher.loadRelaxed(); else - return 0; + return nullptr; } static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e); @@ -171,7 +173,11 @@ public: Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); #endif +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result); +#else static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result); +#endif static bool sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event); @@ -204,7 +210,7 @@ public: static void showModalWindow(QWindow *window); static void hideModalWindow(QWindow *window); static void updateBlockedStatus(QWindow *window); - virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const; + virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const; virtual bool popupActive() { return false; } static ulong mousePressTime; @@ -298,8 +304,8 @@ public: static QInputDeviceManager *inputDeviceManager(); - const QColorProfile *colorProfileForA8Text(); - const QColorProfile *colorProfileForA32Text(); + const QColorTrcLut *colorProfileForA8Text(); + const QColorTrcLut *colorProfileForA32Text(); // hook reimplemented in QApplication to apply the QStyle function on the QIcon virtual QPixmap applyQIconStyleHelper(QIcon::Mode, const QPixmap &basePixmap) const { return basePixmap; } @@ -326,8 +332,8 @@ private: static QGuiApplicationPrivate *self; static QTouchDevice *m_fakeTouchDevice; static int m_fakeMouseSourcePointId; - QAtomicPointer<QColorProfile> m_a8ColorProfile; - QAtomicPointer<QColorProfile> m_a32ColorProfile; + QSharedPointer<QColorTrcLut> m_a8ColorProfile; + QSharedPointer<QColorTrcLut> m_a32ColorProfile; bool ownGlobalShareContext; diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 3410c1d345..50221926c6 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -278,6 +278,8 @@ public: static inline QPoint origin(const QPlatformScreen *) { return QPoint(); } static inline QPoint mapPositionFromNative(const QPoint &pos, const QPlatformScreen *) { return pos; } static inline QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *) { return pos; } + static inline QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; } + static inline QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; } static inline QDpi logicalDpi() { return QDpi(-1,-1); } }; diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp index 6e4e5a9c93..11442407e1 100644 --- a/src/gui/kernel/qinputdevicemanager.cpp +++ b/src/gui/kernel/qinputdevicemanager.cpp @@ -75,13 +75,13 @@ int QInputDeviceManager::deviceCount(DeviceType type) const int QInputDeviceManagerPrivate::deviceCount(QInputDeviceManager::DeviceType type) const { - return m_deviceCount.value(type); + return m_deviceCount[type]; } void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType type, int count) { Q_Q(QInputDeviceManager); - if (m_deviceCount.value(type) != count) { + if (m_deviceCount[type] != count) { m_deviceCount[type] = count; emit q->deviceListChanged(type); } diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h index 74494d712b..1d20b102e3 100644 --- a/src/gui/kernel/qinputdevicemanager_p.h +++ b/src/gui/kernel/qinputdevicemanager_p.h @@ -69,7 +69,9 @@ public: DeviceTypePointer, DeviceTypeKeyboard, DeviceTypeTouch, - DeviceTypeTablet + DeviceTypeTablet, + + NumDeviceTypes }; QInputDeviceManager(QObject *parent = nullptr); diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h index 0a91252fbc..871f9315c3 100644 --- a/src/gui/kernel/qinputdevicemanager_p_p.h +++ b/src/gui/kernel/qinputdevicemanager_p_p.h @@ -52,10 +52,11 @@ // #include <QtGui/private/qtguiglobal_p.h> -#include <QtCore/qmap.h> #include <private/qobject_p.h> #include "qinputdevicemanager_p.h" +#include <array> + QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QInputDeviceManagerPrivate : public QObjectPrivate @@ -68,7 +69,7 @@ public: int deviceCount(QInputDeviceManager::DeviceType type) const; void setDeviceCount(QInputDeviceManager::DeviceType type, int count); - QMap<QInputDeviceManager::DeviceType, int> m_deviceCount; + std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount; Qt::KeyboardModifiers keyboardModifiers; }; diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 0c2b739d92..5657edeb4e 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -67,7 +67,7 @@ class QInputMethodPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QInputMethod) public: - inline QInputMethodPrivate() : testContext(0) + inline QInputMethodPrivate() : testContext(nullptr) {} QPlatformInputContext *platformInputContext() const { diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 74bf6e6b47..2a86b340af 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -46,9 +46,6 @@ #include "qdebug.h" #include <QtCore/qhashfunctions.h> -#ifndef QT_NO_REGEXP -# include "qregexp.h" -#endif #ifndef QT_NO_DATASTREAM # include "qdatastream.h" #endif @@ -1466,7 +1463,7 @@ bool QKeySequence::operator==(const QKeySequence &other) const Calculates the hash value of \a key, using \a seed to seed the calculation. */ -uint qHash(const QKeySequence &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QKeySequence &key, uint seed) noexcept { return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed); } @@ -1521,7 +1518,7 @@ bool QKeySequence::operator< (const QKeySequence &other) const */ bool QKeySequence::isDetached() const { - return d->ref.load() == 1; + return d->ref.loadRelaxed() == 1; } /*! diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index 65f3a93d9c..3dcbbe5941 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -66,7 +66,7 @@ void qt_set_sequence_auto_mnemonic(bool b); class QVariant; class QKeySequencePrivate; -Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) noexcept; class Q_GUI_EXPORT QKeySequence { @@ -186,10 +186,8 @@ public: operator QVariant() const; int operator[](uint i) const; QKeySequence &operator=(const QKeySequence &other); -#ifdef Q_COMPILER_RVALUE_REFS - QKeySequence &operator=(QKeySequence &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif - void swap(QKeySequence &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + QKeySequence &operator=(QKeySequence &&other) noexcept { swap(other); return *this; } + void swap(QKeySequence &other) noexcept { qSwap(d, other.d); } bool operator==(const QKeySequence &other) const; inline bool operator!= (const QKeySequence &other) const @@ -214,7 +212,7 @@ private: friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks); friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks); - friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) Q_DECL_NOTHROW; + friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) noexcept; friend class QShortcutMap; friend class QShortcut; diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 5bc6e27eb2..a3b2ea5f86 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1634,7 +1634,7 @@ QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource() active.deref(); } #ifndef QT_NO_DEBUG - if (active.load() != 0) { + if (active.loadRelaxed() != 0) { qWarning("QtGui: Resources are still available at program shutdown.\n" " This is possibly caused by a leaked QOpenGLWidget, \n" " QOpenGLFramebufferObject or QOpenGLPixelBuffer."); diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 2849d0c58e..c6ad893ee6 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -131,7 +131,7 @@ class Q_GUI_EXPORT QOpenGLContextGroupPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QOpenGLContextGroup) public: QOpenGLContextGroupPrivate() - : m_context(0) + : m_context(nullptr) , m_mutex(QMutex::Recursive) , m_refs(0) { @@ -198,20 +198,20 @@ class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QOpenGLContext) public: QOpenGLContextPrivate() - : qGLContextHandle(0) - , qGLContextDeleteFunction(0) - , platformGLContext(0) - , shareContext(0) - , shareGroup(0) - , screen(0) - , surface(0) - , functions(0) - , textureFunctions(0) + : qGLContextHandle(nullptr) + , qGLContextDeleteFunction(nullptr) + , platformGLContext(nullptr) + , shareContext(nullptr) + , shareGroup(nullptr) + , screen(nullptr) + , surface(nullptr) + , functions(nullptr) + , textureFunctions(nullptr) , max_texture_size(-1) , workaround_brokenFBOReadBack(false) , workaround_brokenTexSubImage(false) , workaround_missingPrecisionQualifiers(false) - , active_engine(0) + , active_engine(nullptr) , qgl_current_fbo_invalid(false) , qgl_current_fbo(nullptr) , defaultFboRedirect(0) diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 193fd9590d..61dccd77ac 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -830,7 +830,7 @@ bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const */ void QPalette::detach() { - if (d->ref.load() != 1) { + if (d->ref.loadRelaxed() != 1) { QPalettePrivate *x = new QPalettePrivate; for(int grp = 0; grp < (int)NColorGroups; grp++) { for(int role = 0; role < (int)NColorRoles; role++) @@ -1209,7 +1209,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p) QDebugStateSaver saver(dbg); QDebug nospace = dbg.nospace(); const uint mask = p.resolve(); - nospace << "QPalette(resolve=" << hex << showbase << mask << ','; + nospace << "QPalette(resolve=" << Qt::hex << Qt::showbase << mask << ','; for (int role = 0; role < (int)QPalette::NColorRoles; ++role) { if (mask & (1<<role)) { if (role) @@ -1225,7 +1225,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p) nospace << ']'; } } - nospace << ')' << noshowbase << dec; + nospace << ')' << Qt::noshowbase << Qt::dec; return dbg; } #endif diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index e931e01480..d3a840d9ad 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -67,18 +67,16 @@ public: QPalette(const QPalette &palette); ~QPalette(); QPalette &operator=(const QPalette &palette); -#ifdef Q_COMPILER_RVALUE_REFS - QPalette(QPalette &&other) Q_DECL_NOTHROW + QPalette(QPalette &&other) noexcept : d(other.d), data(other.data) { other.d = nullptr; } - inline QPalette &operator=(QPalette &&other) Q_DECL_NOEXCEPT + inline QPalette &operator=(QPalette &&other) noexcept { for_faster_swapping_dont_use = other.for_faster_swapping_dont_use; qSwap(d, other.d); return *this; } -#endif - void swap(QPalette &other) Q_DECL_NOEXCEPT + void swap(QPalette &other) noexcept { qSwap(d, other.d); qSwap(for_faster_swapping_dont_use, other.for_faster_swapping_dont_use); diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h index 6b2d6a6ac7..a041a39fc1 100644 --- a/src/gui/kernel/qpixelformat.h +++ b/src/gui/kernel/qpixelformat.h @@ -95,7 +95,7 @@ class QPixelFormat Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets)); Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64)); - Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const Q_DECL_NOTHROW + Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const noexcept { return uchar((data >> uint(offset)) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))); } Q_DECL_CONSTEXPR static inline quint64 set(Field offset, FieldWidth width, uchar value) { return (quint64(value) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))) << uint(offset); } @@ -160,7 +160,7 @@ public: CurrentSystemEndian }; - Q_DECL_CONSTEXPR inline QPixelFormat() Q_DECL_NOTHROW : data(0) {} + Q_DECL_CONSTEXPR inline QPixelFormat() noexcept : data(0) {} Q_DECL_CONSTEXPR inline QPixelFormat(ColorModel colorModel, uchar firstSize, uchar secondSize, @@ -173,47 +173,47 @@ public: AlphaPremultiplied premultiplied, TypeInterpretation typeInterpretation, ByteOrder byteOrder = CurrentSystemEndian, - uchar subEnum = 0) Q_DECL_NOTHROW; + uchar subEnum = 0) noexcept; - Q_DECL_CONSTEXPR inline ColorModel colorModel() const Q_DECL_NOTHROW { return ColorModel(get(ModelField, ModelFieldWidth)); } - Q_DECL_CONSTEXPR inline uchar channelCount() const Q_DECL_NOTHROW { return (get(FirstField, FirstFieldWidth) > 0) + + Q_DECL_CONSTEXPR inline ColorModel colorModel() const noexcept { return ColorModel(get(ModelField, ModelFieldWidth)); } + Q_DECL_CONSTEXPR inline uchar channelCount() const noexcept { return (get(FirstField, FirstFieldWidth) > 0) + (get(SecondField, SecondFieldWidth) > 0) + (get(ThirdField, ThirdFieldWidth) > 0) + (get(FourthField, FourthFieldWidth) > 0) + (get(FifthField, FifthFieldWidth) > 0) + (get(AlphaField, AlphaFieldWidth) > 0); } - Q_DECL_CONSTEXPR inline uchar redSize() const Q_DECL_NOTHROW { return get(FirstField, FirstFieldWidth); } - Q_DECL_CONSTEXPR inline uchar greenSize() const Q_DECL_NOTHROW { return get(SecondField, SecondFieldWidth); } - Q_DECL_CONSTEXPR inline uchar blueSize() const Q_DECL_NOTHROW { return get(ThirdField, ThirdFieldWidth); } + Q_DECL_CONSTEXPR inline uchar redSize() const noexcept { return get(FirstField, FirstFieldWidth); } + Q_DECL_CONSTEXPR inline uchar greenSize() const noexcept { return get(SecondField, SecondFieldWidth); } + Q_DECL_CONSTEXPR inline uchar blueSize() const noexcept { return get(ThirdField, ThirdFieldWidth); } - Q_DECL_CONSTEXPR inline uchar cyanSize() const Q_DECL_NOTHROW { return get(FirstField, FirstFieldWidth); } - Q_DECL_CONSTEXPR inline uchar magentaSize() const Q_DECL_NOTHROW { return get(SecondField, SecondFieldWidth); } - Q_DECL_CONSTEXPR inline uchar yellowSize() const Q_DECL_NOTHROW { return get(ThirdField, ThirdFieldWidth); } - Q_DECL_CONSTEXPR inline uchar blackSize() const Q_DECL_NOTHROW { return get(FourthField, FourthFieldWidth); } + Q_DECL_CONSTEXPR inline uchar cyanSize() const noexcept { return get(FirstField, FirstFieldWidth); } + Q_DECL_CONSTEXPR inline uchar magentaSize() const noexcept { return get(SecondField, SecondFieldWidth); } + Q_DECL_CONSTEXPR inline uchar yellowSize() const noexcept { return get(ThirdField, ThirdFieldWidth); } + Q_DECL_CONSTEXPR inline uchar blackSize() const noexcept { return get(FourthField, FourthFieldWidth); } - Q_DECL_CONSTEXPR inline uchar hueSize() const Q_DECL_NOTHROW { return get(FirstField, FirstFieldWidth); } - Q_DECL_CONSTEXPR inline uchar saturationSize() const Q_DECL_NOTHROW { return get(SecondField, SecondFieldWidth); } - Q_DECL_CONSTEXPR inline uchar lightnessSize() const Q_DECL_NOTHROW { return get(ThirdField, ThirdFieldWidth); } - Q_DECL_CONSTEXPR inline uchar brightnessSize() const Q_DECL_NOTHROW { return get(ThirdField, ThirdFieldWidth); } + Q_DECL_CONSTEXPR inline uchar hueSize() const noexcept { return get(FirstField, FirstFieldWidth); } + Q_DECL_CONSTEXPR inline uchar saturationSize() const noexcept { return get(SecondField, SecondFieldWidth); } + Q_DECL_CONSTEXPR inline uchar lightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); } + Q_DECL_CONSTEXPR inline uchar brightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); } - Q_DECL_CONSTEXPR inline uchar alphaSize() const Q_DECL_NOTHROW { return get(AlphaField, AlphaFieldWidth); } + Q_DECL_CONSTEXPR inline uchar alphaSize() const noexcept { return get(AlphaField, AlphaFieldWidth); } - Q_DECL_CONSTEXPR inline uchar bitsPerPixel() const Q_DECL_NOTHROW { return get(FirstField, FirstFieldWidth) + + Q_DECL_CONSTEXPR inline uchar bitsPerPixel() const noexcept { return get(FirstField, FirstFieldWidth) + get(SecondField, SecondFieldWidth) + get(ThirdField, ThirdFieldWidth) + get(FourthField, FourthFieldWidth) + get(FifthField, FifthFieldWidth) + get(AlphaField, AlphaFieldWidth); } - Q_DECL_CONSTEXPR inline AlphaUsage alphaUsage() const Q_DECL_NOTHROW { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); } - Q_DECL_CONSTEXPR inline AlphaPosition alphaPosition() const Q_DECL_NOTHROW { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); } - Q_DECL_CONSTEXPR inline AlphaPremultiplied premultiplied() const Q_DECL_NOTHROW { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); } - Q_DECL_CONSTEXPR inline TypeInterpretation typeInterpretation() const Q_DECL_NOTHROW { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); } - Q_DECL_CONSTEXPR inline ByteOrder byteOrder() const Q_DECL_NOTHROW { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); } + Q_DECL_CONSTEXPR inline AlphaUsage alphaUsage() const noexcept { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); } + Q_DECL_CONSTEXPR inline AlphaPosition alphaPosition() const noexcept { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); } + Q_DECL_CONSTEXPR inline AlphaPremultiplied premultiplied() const noexcept { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); } + Q_DECL_CONSTEXPR inline TypeInterpretation typeInterpretation() const noexcept { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); } + Q_DECL_CONSTEXPR inline ByteOrder byteOrder() const noexcept { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); } - Q_DECL_CONSTEXPR inline YUVLayout yuvLayout() const Q_DECL_NOTHROW { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); } - Q_DECL_CONSTEXPR inline uchar subEnum() const Q_DECL_NOTHROW { return get(SubEnumField, SubEnumFieldWidth); } + Q_DECL_CONSTEXPR inline YUVLayout yuvLayout() const noexcept { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); } + Q_DECL_CONSTEXPR inline uchar subEnum() const noexcept { return get(SubEnumField, SubEnumFieldWidth); } private: Q_DECL_CONSTEXPR static inline ByteOrder resolveByteOrder(ByteOrder bo) @@ -255,7 +255,7 @@ QPixelFormat::QPixelFormat(ColorModel mdl, AlphaPremultiplied premult, TypeInterpretation typeInterp, ByteOrder b_order, - uchar s_enum) Q_DECL_NOTHROW + uchar s_enum) noexcept : data(set(ModelField, ModelFieldWidth, uchar(mdl)) | set(FirstField, FirstFieldWidth, firstSize) | set(SecondField, SecondFieldWidth, secondSize) | @@ -280,7 +280,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red, QPixelFormat::AlphaUsage usage, QPixelFormat::AlphaPosition position, QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept { return QPixelFormat(QPixelFormat::RGB, red, @@ -296,7 +296,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red, } Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept { return QPixelFormat(QPixelFormat::Grayscale, channelSize, @@ -312,7 +312,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize, } Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept { return QPixelFormat(QPixelFormat::Alpha, 0, @@ -331,7 +331,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize, uchar alfa=0, QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept { return QPixelFormat(QPixelFormat::CMYK, channelSize, @@ -350,7 +350,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize, uchar alfa=0, QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept { return QPixelFormat(QPixelFormat::HSL, channelSize, @@ -369,7 +369,7 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsv(uchar channelSize, uchar alfa=0, QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning, - QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) Q_DECL_NOTHROW + QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept { return QPixelFormat(QPixelFormat::HSV, channelSize, diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index d14d575056..4bee153489 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -41,7 +41,9 @@ #include <QtCore/QCoreApplication> #include <QtCore/QVariant> +#if QT_CONFIG(regularexpression) #include <QtCore/QRegularExpression> +#endif #include <QtCore/QSharedData> #if QT_CONFIG(settings) #include <QtCore/QSettings> @@ -786,6 +788,7 @@ const char QPlatformFileDialogHelper::filterRegExp[] = // Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)" QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) { +#if QT_CONFIG(regularexpression) QRegularExpression regexp(QString::fromLatin1(filterRegExp)); Q_ASSERT(regexp.isValid()); QString f = filter; @@ -794,6 +797,9 @@ QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) if (match.hasMatch()) f = match.captured(2); return f.split(QLatin1Char(' '), QString::SkipEmptyParts); +#else + return QStringList(); +#endif } // Message dialog diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index f09bec12da..ba800a696f 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -318,7 +318,9 @@ public: ShowDirsOnly = 0x00000001, DontResolveSymlinks = 0x00000002, DontConfirmOverwrite = 0x00000004, - DontUseSheet = 0x00000008, +#if QT_DEPRECATED_SINCE(5, 14) + DontUseSheet Q_DECL_ENUMERATOR_DEPRECATED = 0x00000008, +#endif DontUseNativeDialog = 0x00000010, ReadOnly = 0x00000020, HideNameFilterDetails = 0x00000040, diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 389b35dbc0..b764bd2617 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -114,7 +114,7 @@ public: virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0; - virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return 0; } + virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return nullptr; } virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0; #ifndef QT_NO_OPENGL virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 54c8c70025..356c4ea3ea 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -309,7 +309,7 @@ public: virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const; virtual QIcon fileIcon(const QFileInfo &fileInfo, - QPlatformTheme::IconOptions iconOptions = 0) const; + QPlatformTheme::IconOptions iconOptions = nullptr) const; virtual QIconEngine *createIconEngine(const QString &iconName) const; #ifndef QT_NO_SHORTCUT diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 952023dd1b..c79f597414 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -768,7 +768,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) static inline void formatRect(QDebug &debug, const QRect r) { debug << r.width() << 'x' << r.height() - << forcesign << r.x() << r.y() << noforcesign; + << Qt::forcesign << r.x() << r.y() << Qt::noforcesign; } Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen) diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index f31658355b..e5988ff829 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -64,12 +64,6 @@ class QScreenPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QScreen) public: - QScreenPrivate() - : platformScreen(0) - , orientationUpdateMask(0) - { - } - void setPlatformScreen(QPlatformScreen *screen); void updateHighDpi() { @@ -79,16 +73,16 @@ public: void updatePrimaryOrientation(); - QPlatformScreen *platformScreen; + QPlatformScreen *platformScreen = nullptr; Qt::ScreenOrientations orientationUpdateMask; - Qt::ScreenOrientation orientation; - Qt::ScreenOrientation filteredOrientation; - Qt::ScreenOrientation primaryOrientation; + Qt::ScreenOrientation orientation = Qt::PrimaryOrientation; + Qt::ScreenOrientation filteredOrientation = Qt::PrimaryOrientation; + Qt::ScreenOrientation primaryOrientation = Qt::LandscapeOrientation; QRect geometry; QRect availableGeometry; - QDpi logicalDpi; - qreal refreshRate; + QDpi logicalDpi = {96, 96}; + qreal refreshRate = 60; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index 493a321c74..e5e9c624b2 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -123,7 +123,11 @@ QSessionManagerPrivate::QSessionManagerPrivate(const QString &id, const QString &key) : QObjectPrivate() { - platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key); + if (qApp->testAttribute(Qt::AA_DisableSessionManager)) { + platformSessionManager = new QPlatformSessionManager(id, key); + } else { + platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key); + } Q_ASSERT_X(platformSessionManager, "Platform session management", "No platform session management, should use the default implementation"); } diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h index d9a6ea4888..5089be7284 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow_p.h +++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h @@ -63,7 +63,7 @@ class QShapedPixmapWindow : public QRasterWindow { Q_OBJECT public: - explicit QShapedPixmapWindow(QScreen *screen = 0); + explicit QShapedPixmapWindow(QScreen *screen = nullptr); ~QShapedPixmapWindow(); void setUseCompositing(bool on) { m_useCompositing = on; } diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index bd409c124f..d3070a3d1a 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -48,7 +48,6 @@ #include "qpoint.h" #include "qbuffer.h" #include "qimage.h" -#include "qregexp.h" #include "qdir.h" #include "qimagereader.h" #include "qimagewriter.h" diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 1a814ec21f..2e2738ec81 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -246,7 +246,7 @@ QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : */ void QSurfaceFormat::detach() { - if (d->ref.load() != 1) { + if (d->ref.loadRelaxed() != 1) { QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); if (!d->ref.deref()) delete d; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index ed516c0eed..b71a0c54aa 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2535,7 +2535,12 @@ void QWindow::tabletEvent(QTabletEvent *ev) Should return true only if the event was handled. */ + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) +#else bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) +#endif { Q_UNUSED(eventType); Q_UNUSED(message); @@ -2844,13 +2849,13 @@ QDebug operator<<(QDebug debug, const QWindow *window) if (window->isTopLevel()) debug << ", toplevel"; debug << ", " << geometry.width() << 'x' << geometry.height() - << forcesign << geometry.x() << geometry.y() << noforcesign; + << Qt::forcesign << geometry.x() << geometry.y() << Qt::noforcesign; const QMargins margins = window->frameMargins(); if (!margins.isNull()) debug << ", margins=" << margins; debug << ", devicePixelRatio=" << window->devicePixelRatio(); if (const QPlatformWindow *platformWindow = window->handle()) - debug << ", winId=0x" << hex << platformWindow->winId() << dec; + debug << ", winId=0x" << Qt::hex << platformWindow->winId() << Qt::dec; if (const QScreen *screen = window->screen()) debug << ", on " << screen->name(); } diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 1be3c845fe..5ee1d00f5b 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -364,7 +364,11 @@ protected: #if QT_CONFIG(tabletevent) virtual void tabletEvent(QTabletEvent *); #endif +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); +#else virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); +#endif QWindow(QWindowPrivate &dd, QWindow *parent); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 5367d93e84..5a7ec518fd 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -77,50 +77,15 @@ public: QWindowPrivate() : QObjectPrivate() - , surfaceType(QWindow::RasterSurface) - , windowFlags(Qt::Window) - , parentWindow(0) - , platformWindow(0) - , visible(false) - , visibilityOnDestroy(false) - , exposed(false) - , windowState(Qt::WindowNoState) - , visibility(QWindow::Hidden) - , resizeEventPending(true) - , receivedExpose(false) - , positionPolicy(WindowFrameExclusive) - , positionAutomatic(true) - , resizeAutomatic(true) - , contentOrientation(Qt::PrimaryOrientation) - , opacity(qreal(1.0)) - , minimumSize(0, 0) - , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) - , modality(Qt::NonModal) - , blockedByModalWindow(false) - , updateRequestPending(false) - , transientParent(0) - , topLevelScreen(0) -#ifndef QT_NO_CURSOR - , cursor(Qt::ArrowCursor) - , hasCursor(false) -#endif - , compositing(false) -#if QT_CONFIG(vulkan) - , vulkanInstance(nullptr) -#endif { isWindow = true; } - ~QWindowPrivate() - { - } - void init(QScreen *targetScreen = nullptr); void maybeQuitOnLastWindowClosed(); #ifndef QT_NO_CURSOR - void setCursor(const QCursor *c = 0); + void setCursor(const QCursor *c = nullptr); bool applyCursor(); #endif @@ -164,57 +129,60 @@ public: static Qt::WindowState effectiveState(Qt::WindowStates); - QWindow::SurfaceType surfaceType; - Qt::WindowFlags windowFlags; - QWindow *parentWindow; - QPlatformWindow *platformWindow; - bool visible; - bool visibilityOnDestroy; - bool exposed; + // ### Qt6: unused + virtual bool allowClickThrough(const QPoint &) const { return true; } + + QWindow::SurfaceType surfaceType = QWindow::RasterSurface; + Qt::WindowFlags windowFlags = Qt::Window; + QWindow *parentWindow = nullptr; + QPlatformWindow *platformWindow = nullptr; + bool visible= false; + bool visibilityOnDestroy = false; + bool exposed = false; QSurfaceFormat requestedFormat; QString windowTitle; QString windowFilePath; QIcon windowIcon; QRect geometry; - Qt::WindowStates windowState; - QWindow::Visibility visibility; - bool resizeEventPending; - bool receivedExpose; - PositionPolicy positionPolicy; - bool positionAutomatic; + Qt::WindowStates windowState = Qt::WindowNoState; + QWindow::Visibility visibility = QWindow::Hidden; + bool resizeEventPending = true; + bool receivedExpose = false; + PositionPolicy positionPolicy = WindowFrameExclusive; + bool positionAutomatic = true; // resizeAutomatic suppresses resizing by QPlatformWindow::initialGeometry(). // It also indicates that width/height=0 is acceptable (for example, for // the QRollEffect widget) and is thus not cleared in setGeometry(). // An alternative approach might be using -1,-1 as a default size. - bool resizeAutomatic; - Qt::ScreenOrientation contentOrientation; - qreal opacity; + bool resizeAutomatic = true; + Qt::ScreenOrientation contentOrientation = Qt::PrimaryOrientation; + qreal opacity= 1; QRegion mask; - QSize minimumSize; - QSize maximumSize; + QSize minimumSize = {0, 0}; + QSize maximumSize = {QWINDOWSIZE_MAX, QWINDOWSIZE_MAX}; QSize baseSize; QSize sizeIncrement; - Qt::WindowModality modality; - bool blockedByModalWindow; + Qt::WindowModality modality = Qt::NonModal; + bool blockedByModalWindow = false; - bool updateRequestPending; + bool updateRequestPending = false; bool transientParentPropertySet = false; QPointer<QWindow> transientParent; QPointer<QScreen> topLevelScreen; #ifndef QT_NO_CURSOR - QCursor cursor; - bool hasCursor; + QCursor cursor = {Qt::ArrowCursor}; + bool hasCursor = false; #endif - bool compositing; + bool compositing = false; QElapsedTimer lastComposeTime; #if QT_CONFIG(vulkan) - QVulkanInstance *vulkanInstance; + QVulkanInstance *vulkanInstance = nullptr; #endif }; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 759671fbd7..4b8cb3646a 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -924,7 +924,11 @@ QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, cons \note This function can only be called from the GUI thread. */ +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result) +#else bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result) +#endif { return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result); } @@ -1111,7 +1115,7 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl } else { sendWindowSystemEvents(flags); } - return QWindowSystemInterfacePrivate::eventAccepted.load() > 0; + return QWindowSystemInterfacePrivate::eventAccepted.loadRelaxed() > 0; } void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) @@ -1152,7 +1156,7 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFla // (excluding flush events). This state can then be // returned by flushWindowSystemEvents(). if (event->type != QWindowSystemInterfacePrivate::FlushEvents) - QWindowSystemInterfacePrivate::eventAccepted.store(event->eventAccepted); + QWindowSystemInterfacePrivate::eventAccepted.storeRelaxed(event->eventAccepted); delete event; } diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index bf98c33a1a..fd70eda9ff 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -230,7 +230,11 @@ public: Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); #endif // QT_CONFIG(draganddrop) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result); +#else static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result); +#endif // Changes to the screen static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary = false); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 6c818a9030..d6513f1836 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -123,7 +123,7 @@ public: class CloseEvent : public WindowSystemEvent { public: - explicit CloseEvent(QWindow *w, bool *a = 0) + explicit CloseEvent(QWindow *w, bool *a = nullptr) : WindowSystemEvent(Close), window(w), accepted(a) { } QPointer<QWindow> window; @@ -398,7 +398,7 @@ public: class TabletEnterProximityEvent : public InputEvent { public: TabletEnterProximityEvent(ulong time, int device, int pointerType, qint64 uid) - : InputEvent(0, time, TabletEnterProximity, Qt::NoModifier), + : InputEvent(nullptr, time, TabletEnterProximity, Qt::NoModifier), device(device), pointerType(pointerType), uid(uid) { } int device; int pointerType; @@ -408,7 +408,7 @@ public: class TabletLeaveProximityEvent : public InputEvent { public: TabletLeaveProximityEvent(ulong time, int device, int pointerType, qint64 uid) - : InputEvent(0, time, TabletLeaveProximity, Qt::NoModifier), + : InputEvent(nullptr, time, TabletLeaveProximity, Qt::NoModifier), device(device), pointerType(pointerType), uid(uid) { } int device; int pointerType; @@ -474,7 +474,7 @@ public: for (int i = 0; i < impl.size(); ++i) if (!(impl.at(i)->type & QWindowSystemInterfacePrivate::UserInputEvent)) return impl.takeAt(i); - return 0; + return nullptr; } bool nonUserInputEventsQueued() { @@ -495,7 +495,7 @@ public: if (impl.at(i)->type == t) return impl.at(i); } - return 0; + return nullptr; } void remove(const WindowSystemEvent *e) { |