diff options
Diffstat (limited to 'src/gui')
150 files changed, 1060 insertions, 772 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 2db4d46874..3004110e67 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1761,7 +1761,6 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent() /*! Returns the QAccessibleInterface associated with the event. - The caller of this function takes ownership of the returned interface. */ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const { diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 27756d764d..1309f17efd 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -511,7 +511,7 @@ public: virtual void virtual_hook(int id, void *data); virtual void *interface_cast(QAccessible::InterfaceType) - { return Q_NULLPTR; } + { return nullptr; } protected: friend class QAccessibleCache; @@ -682,7 +682,7 @@ public: } inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ) - : m_type(typ), m_object(Q_NULLPTR) + : m_type(typ), m_object(nullptr) { Q_ASSERT(iface); Q_ASSERT(m_type != QAccessible::ValueChanged); diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h index 7429716e65..168889135b 100644 --- a/src/gui/accessible/qaccessiblebridge.h +++ b/src/gui/accessible/qaccessiblebridge.h @@ -66,7 +66,7 @@ class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject { Q_OBJECT public: - explicit QAccessibleBridgePlugin(QObject *parent = Q_NULLPTR); + explicit QAccessibleBridgePlugin(QObject *parent = nullptr); ~QAccessibleBridgePlugin(); virtual QAccessibleBridge *create(const QString &key) = 0; diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp index 097634c0a3..f4242036ce 100644 --- a/src/gui/accessible/qaccessiblecache.cpp +++ b/src/gui/accessible/qaccessiblecache.cpp @@ -54,7 +54,7 @@ static QAccessibleCache *accessibleCache = nullptr; static void cleanupAccessibleCache() { delete accessibleCache; - accessibleCache = Q_NULLPTR; + accessibleCache = nullptr; } QAccessibleCache *QAccessibleCache::instance() diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h index dd69dcb081..81479c32ab 100644 --- a/src/gui/accessible/qaccessibleobject.h +++ b/src/gui/accessible/qaccessibleobject.h @@ -56,13 +56,13 @@ class Q_GUI_EXPORT QAccessibleObject : public QAccessibleInterface public: explicit QAccessibleObject(QObject *object); - bool isValid() const Q_DECL_OVERRIDE; - QObject *object() const Q_DECL_OVERRIDE; + bool isValid() const override; + QObject *object() const override; // properties - QRect rect() const Q_DECL_OVERRIDE; - void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE; - QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE; + QRect rect() const override; + void setText(QAccessible::Text t, const QString &text) override; + QAccessibleInterface *childAt(int x, int y) const override; protected: virtual ~QAccessibleObject(); @@ -77,20 +77,20 @@ class Q_GUI_EXPORT QAccessibleApplication : public QAccessibleObject public: QAccessibleApplication(); - QWindow *window() const Q_DECL_OVERRIDE; + QWindow *window() const override; // relations - int childCount() const Q_DECL_OVERRIDE; - int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE; - QAccessibleInterface *focusChild() const Q_DECL_OVERRIDE; + int childCount() const override; + int indexOfChild(const QAccessibleInterface*) const override; + QAccessibleInterface *focusChild() const override; // navigation - QAccessibleInterface *parent() const Q_DECL_OVERRIDE; - QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE; + QAccessibleInterface *parent() const override; + QAccessibleInterface *child(int index) const override; // properties and state - QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; - QAccessible::Role role() const Q_DECL_OVERRIDE; - QAccessible::State state() const Q_DECL_OVERRIDE; + QString text(QAccessible::Text t) const override; + QAccessible::Role role() const override; + QAccessible::State state() const override; }; #endif // QT_NO_ACCESSIBILITY diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h index 09d4c542d3..68e6a839d8 100644 --- a/src/gui/accessible/qaccessibleplugin.h +++ b/src/gui/accessible/qaccessibleplugin.h @@ -60,7 +60,7 @@ class Q_GUI_EXPORT QAccessiblePlugin : public QObject { Q_OBJECT public: - explicit QAccessiblePlugin(QObject *parent = Q_NULLPTR); + explicit QAccessiblePlugin(QObject *parent = nullptr); ~QAccessiblePlugin(); virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0; diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index def59b3f89..6a8c8b3457 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -55,7 +55,7 @@ public: QBitmap(const QPixmap &); QBitmap(int w, int h); explicit QBitmap(const QSize &); - explicit QBitmap(const QString &fileName, const char *format = Q_NULLPTR); + explicit QBitmap(const QString &fileName, const char *format = nullptr); // ### Qt 6: don't inherit QPixmap #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QBitmap(const QBitmap &other) : QPixmap(other) {} diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index 40d3e92af9..4832455c9f 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -63,7 +63,7 @@ public: #ifdef Q_COMPILER_RVALUE_REFS QIcon(QIcon &&other) Q_DECL_NOEXCEPT : d(other.d) - { other.d = Q_NULLPTR; } + { other.d = nullptr; } #endif explicit QIcon(const QString &fileName); // file or resource name explicit QIcon(QIconEngine *engine); @@ -147,7 +147,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &); #endif Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio, - qreal *sourceDevicePixelRatio = Q_NULLPTR); + qreal *sourceDevicePixelRatio = nullptr); QT_END_NAMESPACE diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h index aa358e88af..e384ff9e49 100644 --- a/src/gui/image/qicon_p.h +++ b/src/gui/image/qicon_p.h @@ -112,18 +112,18 @@ public: QPixmapIconEngine(); QPixmapIconEngine(const QPixmapIconEngine &); ~QPixmapIconEngine(); - void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; + void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override; + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override; QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly); - QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - - QString key() const Q_DECL_OVERRIDE; - QIconEngine *clone() const Q_DECL_OVERRIDE; - bool read(QDataStream &in) Q_DECL_OVERRIDE; - bool write(QDataStream &out) const Q_DECL_OVERRIDE; - void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; + QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override; + void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) override; + void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override; + + QString key() const override; + QIconEngine *clone() const override; + bool read(QDataStream &in) override; + bool write(QDataStream &out) const override; + void virtual_hook(int id, void *data) override; private: QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state); diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h index 7a01d3731c..f2a1c0107a 100644 --- a/src/gui/image/qiconengineplugin.h +++ b/src/gui/image/qiconengineplugin.h @@ -55,7 +55,7 @@ class Q_GUI_EXPORT QIconEnginePlugin : public QObject { Q_OBJECT public: - QIconEnginePlugin(QObject *parent = Q_NULLPTR); + QIconEnginePlugin(QObject *parent = nullptr); ~QIconEnginePlugin(); virtual QIconEngine *create(const QString &filename = QString()) = 0; diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h index 9398bca585..0007437ee9 100644 --- a/src/gui/image/qiconloader_p.h +++ b/src/gui/image/qiconloader_p.h @@ -101,13 +101,13 @@ public: struct ScalableEntry : public QIconLoaderEngineEntry { - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override; QIcon svgIcon; }; struct PixmapEntry : public QIconLoaderEngineEntry { - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override; QPixmap basePixmap; }; @@ -125,20 +125,20 @@ public: QIconLoaderEngine(const QString& iconName = QString()); ~QIconLoaderEngine(); - void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - QIconEngine *clone() const Q_DECL_OVERRIDE; - bool read(QDataStream &in) Q_DECL_OVERRIDE; - bool write(QDataStream &out) const Q_DECL_OVERRIDE; + void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override; + QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override; + QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override; + QIconEngine *clone() const override; + bool read(QDataStream &in) override; + bool write(QDataStream &out) const override; Q_GUI_EXPORT static QIconLoaderEngineEntry *entryForSize(const QThemeIconInfo &info, const QSize &size, int scale = 1); private: - QString key() const Q_DECL_OVERRIDE; + QString key() const override; bool hasIcon() const; void ensureLoaded(); - void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; + void virtual_hook(int id, void *data) override; QIconLoaderEngine(const QIconLoaderEngine &other); QThemeIconInfo m_info; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 097033280a..96a1b38d48 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3261,14 +3261,31 @@ QImage QImage::rgbSwapped_helper() const res.d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00)); } break; - case Format_RGB32: - case Format_ARGB32: - case Format_ARGB32_Premultiplied: -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN case Format_RGBX8888: case Format_RGBA8888: case Format_RGBA8888_Premultiplied: +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + res = QImage(d->width, d->height, d->format); + QIMAGE_SANITYCHECK_MEMORY(res); + for (int i = 0; i < d->height; i++) { + uint *q = (uint*)res.scanLine(i); + const uint *p = (const uint*)constScanLine(i); + const uint *end = p + d->width; + while (p < end) { + uint c = *p; + *q = ((c << 16) & 0xff000000) | ((c >> 16) & 0xff00) | (c & 0x00ff00ff); + p++; + q++; + } + } + break; +#else + // On little-endian rgba8888 is abgr32 and can use same rgb-swap as argb32 + Q_FALLTHROUGH(); #endif + case Format_RGB32: + case Format_ARGB32: + case Format_ARGB32_Premultiplied: res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { @@ -3352,14 +3369,27 @@ void QImage::rgbSwapped_inplace() d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00)); } break; - case Format_RGB32: - case Format_ARGB32: - case Format_ARGB32_Premultiplied: -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN case Format_RGBX8888: case Format_RGBA8888: case Format_RGBA8888_Premultiplied: +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + for (int i = 0; i < d->height; i++) { + uint *p = (uint*)scanLine(i); + uint *end = p + d->width; + while (p < end) { + uint c = *p; + *p = ((c << 16) & 0xff000000) | ((c >> 16) & 0xff00) | (c & 0x00ff00ff); + p++; + } + } + break; +#else + // On little-endian rgba8888 is abgr32 and can use same rgb-swap as argb32 + Q_FALLTHROUGH(); #endif + case Format_RGB32: + case Format_ARGB32: + case Format_ARGB32_Premultiplied: for (int i = 0; i < d->height; i++) { uint *p = (uint*)scanLine(i); uint *end = p + d->width; diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index eccff480bb..11ad9b7510 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -136,20 +136,20 @@ public: QImage() Q_DECL_NOEXCEPT; QImage(const QSize &size, Format format); QImage(int width, int height, Format format); - QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR); - QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR); - QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR); - QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR); + QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); + QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); + QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); + QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); #ifndef QT_NO_IMAGEFORMAT_XPM explicit QImage(const char * const xpm[]); #endif - explicit QImage(const QString &fileName, const char *format = Q_NULLPTR); + explicit QImage(const QString &fileName, const char *format = nullptr); QImage(const QImage &); #ifdef Q_COMPILER_RVALUE_REFS inline QImage(QImage &&other) Q_DECL_NOEXCEPT - : QPaintDevice(), d(Q_NULLPTR) + : QPaintDevice(), d(nullptr) { qSwap(d, other.d); } #endif ~QImage(); @@ -164,7 +164,7 @@ public: bool isNull() const; - int devType() const Q_DECL_OVERRIDE; + int devType() const override; bool operator==(const QImage &) const; bool operator!=(const QImage &) const; @@ -294,16 +294,16 @@ public: bool load(QIODevice *device, const char* format); - bool load(const QString &fileName, const char *format = Q_NULLPTR); - bool loadFromData(const uchar *buf, int len, const char *format = Q_NULLPTR); - inline bool loadFromData(const QByteArray &data, const char *aformat = Q_NULLPTR) + bool load(const QString &fileName, const char *format = nullptr); + bool loadFromData(const uchar *buf, int len, const char *format = nullptr); + inline bool loadFromData(const QByteArray &data, const char *aformat = nullptr) { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); } - bool save(const QString &fileName, const char *format = Q_NULLPTR, int quality = -1) const; - bool save(QIODevice *device, const char *format = Q_NULLPTR, int quality = -1) const; + bool save(const QString &fileName, const char *format = nullptr, int quality = -1) const; + bool save(QIODevice *device, const char *format = nullptr, int quality = -1) const; - static QImage fromData(const uchar *data, int size, const char *format = Q_NULLPTR); - inline static QImage fromData(const QByteArray &data, const char *format = Q_NULLPTR) + static QImage fromData(const uchar *data, int size, const char *format = nullptr); + inline static QImage fromData(const QByteArray &data, const char *format = nullptr) { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); } #if QT_DEPRECATED_SINCE(5, 0) @@ -311,7 +311,7 @@ public: #endif qint64 cacheKey() const; - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; + QPaintEngine *paintEngine() const override; // Auxiliary data int dotsPerMeterX() const; @@ -335,7 +335,7 @@ public: #endif #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const; + QT_DEPRECATED inline QString text(const char *key, const char *lang = nullptr) const; QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const; QT_DEPRECATED inline QStringList textLanguages() const; QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const; @@ -349,7 +349,7 @@ public: #endif protected: - virtual int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE; + virtual int metric(PaintDeviceMetric metric) const override; QImage mirrored_helper(bool horizontal, bool vertical) const; QImage rgbSwapped_helper() const; void mirrored_inplace(bool horizontal, bool vertical); diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h index baf9853259..35984dd6a5 100644 --- a/src/gui/image/qimageiohandler.h +++ b/src/gui/image/qimageiohandler.h @@ -140,7 +140,7 @@ class Q_GUI_EXPORT QImageIOPlugin : public QObject { Q_OBJECT public: - explicit QImageIOPlugin(QObject *parent = Q_NULLPTR); + explicit QImageIOPlugin(QObject *parent = nullptr); virtual ~QImageIOPlugin(); enum Capability { diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index ca559d491b..e13c528894 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -79,9 +79,9 @@ public: }; Q_ENUM(CacheMode) - explicit QMovie(QObject *parent = Q_NULLPTR); - explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = Q_NULLPTR); - explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = Q_NULLPTR); + explicit QMovie(QObject *parent = nullptr); + explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = nullptr); + explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = nullptr); ~QMovie(); static QList<QByteArray> supportedFormats(); diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 7c690c1498..c3044796ad 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -68,10 +68,10 @@ public: QPicturePaintEngine(); ~QPicturePaintEngine(); - bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE; - bool end() Q_DECL_OVERRIDE; + bool begin(QPaintDevice *pdev) override; + bool end() override; - void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE; + void updateState(const QPaintEngineState &state) override; void updatePen(const QPen &pen); void updateBrush(const QBrush &brush); @@ -86,18 +86,18 @@ public: void updateClipEnabled(bool enabled); void updateOpacity(qreal opacity); - void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE; - void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE; - void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) Q_DECL_OVERRIDE; + void drawEllipse(const QRectF &rect) override; + void drawPath(const QPainterPath &path) override; + void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) override; using QPaintEngine::drawPolygon; - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE; - void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE; + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override; void drawImage(const QRectF &r, const QImage &image, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; - void drawTextItem(const QPointF &p, const QTextItem &ti) Q_DECL_OVERRIDE; + Qt::ImageConversionFlags flags = Qt::AutoColor) override; + void drawTextItem(const QPointF &p, const QTextItem &ti) override; - Type type() const Q_DECL_OVERRIDE { return Picture; } + Type type() const override { return Picture; } protected: QPicturePaintEngine(QPaintEnginePrivate &dptr); diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index bf628e7571..7aa221948e 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -456,8 +456,8 @@ public: QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); } void setDpiX(int dpi) { dpi_x = dpi; } void setDpiY(int dpi) { dpi_y = dpi; } - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE { return 0; } - int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE + QPaintEngine *paintEngine() const override { return 0; } + int metric(PaintDeviceMetric m) const override { switch(m) { case PdmPhysicalDpiX: diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index db2b767efe..ec7b4bd7e3 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -62,17 +62,17 @@ public: bool isNull() const; - int devType() const Q_DECL_OVERRIDE; + int devType() const override; uint size() const; const char* data() const; virtual void setData(const char* data, uint size); bool play(QPainter *p); - bool load(QIODevice *dev, const char *format = Q_NULLPTR); - bool load(const QString &fileName, const char *format = Q_NULLPTR); - bool save(QIODevice *dev, const char *format = Q_NULLPTR); - bool save(const QString &fileName, const char *format = Q_NULLPTR); + bool load(QIODevice *dev, const char *format = nullptr); + bool load(const QString &fileName, const char *format = nullptr); + bool save(QIODevice *dev, const char *format = nullptr); + bool save(const QString &fileName, const char *format = nullptr); QRect boundingRect() const; void setBoundingRect(const QRect &r); @@ -98,12 +98,12 @@ public: static QT_DEPRECATED QStringList outputFormatList(); #endif // QT_DEPRECATED_SINCE(5, 10) - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; + QPaintEngine *paintEngine() const override; protected: QPicture(QPicturePrivate &data); - int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE; + int metric(PaintDeviceMetric m) const override; private: bool exec(QPainter *p, QDataStream &ds, int i); diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h index 32195687c7..3f59c04d79 100644 --- a/src/gui/image/qpictureformatplugin.h +++ b/src/gui/image/qpictureformatplugin.h @@ -60,7 +60,7 @@ class Q_GUI_EXPORT QPictureFormatPlugin : public QObject { Q_OBJECT public: - explicit QPictureFormatPlugin(QObject *parent = Q_NULLPTR); + explicit QPictureFormatPlugin(QObject *parent = nullptr); ~QPictureFormatPlugin(); virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic); diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index d651b57fd5..55cca7a766 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -65,7 +65,7 @@ public: explicit QPixmap(QPlatformPixmap *data); QPixmap(int w, int h); explicit QPixmap(const QSize &); - QPixmap(const QString& fileName, const char *format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor); + QPixmap(const QString& fileName, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor); #ifndef QT_NO_IMAGEFORMAT_XPM explicit QPixmap(const char * const xpm[]); #endif @@ -83,7 +83,7 @@ public: operator QVariant() const; bool isNull() const; - int devType() const Q_DECL_OVERRIDE; + int devType() const override; int width() const; int height() const; @@ -138,19 +138,19 @@ public: } #endif - bool load(const QString& fileName, const char *format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor); - bool loadFromData(const uchar *buf, uint len, const char* format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor); - inline bool loadFromData(const QByteArray &data, const char* format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor); - bool save(const QString& fileName, const char* format = Q_NULLPTR, int quality = -1) const; - bool save(QIODevice* device, const char* format = Q_NULLPTR, int quality = -1) const; + bool load(const QString& fileName, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool loadFromData(const uchar *buf, uint len, const char* format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor); + inline bool loadFromData(const QByteArray &data, const char* format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool save(const QString& fileName, const char* format = nullptr, int quality = -1) const; + bool save(QIODevice* device, const char* format = nullptr, int quality = -1) const; bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor); inline QPixmap copy(int x, int y, int width, int height) const; QPixmap copy(const QRect &rect = QRect()) const; - inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = Q_NULLPTR); - void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = Q_NULLPTR); + inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = nullptr); + void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = nullptr); #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } @@ -162,7 +162,7 @@ public: bool isQBitmap() const; - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; + QPaintEngine *paintEngine() const override; inline bool operator!() const { return isNull(); } @@ -172,7 +172,7 @@ public: #endif protected: - int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE; + int metric(PaintDeviceMetric) const override; static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); private: diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 9889cfb8ec..d70cbcdcc3 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -69,17 +69,17 @@ public: QBlittable *blittable() const; void setBlittable(QBlittable *blittable); - void resize(int width, int height) Q_DECL_OVERRIDE; - int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE; - void fill(const QColor &color) Q_DECL_OVERRIDE; - QImage *buffer() Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; - bool hasAlphaChannel() const Q_DECL_OVERRIDE; - void fromImage(const QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE; - qreal devicePixelRatio() const Q_DECL_OVERRIDE; - void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE; - - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; + void resize(int width, int height) override; + int metric(QPaintDevice::PaintDeviceMetric metric) const override; + void fill(const QColor &color) override; + QImage *buffer() override; + QImage toImage() const override; + bool hasAlphaChannel() const override; + void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override; + qreal devicePixelRatio() const override; + void setDevicePixelRatio(qreal scaleFactor) override; + + QPaintEngine *paintEngine() const override; void markRasterOverlay(const QRectF &); void markRasterOverlay(const QPointF &, const QTextItem &); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 6ea965a324..cff962181a 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -63,28 +63,28 @@ public: QRasterPlatformPixmap(PixelType type); ~QRasterPlatformPixmap(); - QPlatformPixmap *createCompatiblePlatformPixmap() const Q_DECL_OVERRIDE; - - void resize(int width, int height) Q_DECL_OVERRIDE; - bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE; - void fromImage(const QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE; - void fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE; - void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE; - - void copy(const QPlatformPixmap *data, const QRect &rect) Q_DECL_OVERRIDE; - bool scroll(int dx, int dy, const QRect &rect) Q_DECL_OVERRIDE; - void fill(const QColor &color) Q_DECL_OVERRIDE; - bool hasAlphaChannel() const Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; - QImage toImage(const QRect &rect) const Q_DECL_OVERRIDE; - QPaintEngine* paintEngine() const Q_DECL_OVERRIDE; - QImage* buffer() Q_DECL_OVERRIDE; - qreal devicePixelRatio() const Q_DECL_OVERRIDE; - void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE; + QPlatformPixmap *createCompatiblePlatformPixmap() const override; + + void resize(int width, int height) override; + bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) override; + void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override; + void fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags) override; + void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) override; + + void copy(const QPlatformPixmap *data, const QRect &rect) override; + bool scroll(int dx, int dy, const QRect &rect) override; + void fill(const QColor &color) override; + bool hasAlphaChannel() const override; + QImage toImage() const override; + QImage toImage(const QRect &rect) const override; + QPaintEngine* paintEngine() const override; + QImage* buffer() override; + qreal devicePixelRatio() const override; + void setDevicePixelRatio(qreal scaleFactor) override; protected: - int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE; + int metric(QPaintDevice::PaintDeviceMetric metric) const override; void createPixmapForImage(QImage sourceImage, Qt::ImageConversionFlags flags); void setImage(const QImage &image); QImage image; diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 742aa31ba9..4b8b1203d6 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -193,7 +193,7 @@ public: QPMCache(); ~QPMCache(); - void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *) override; bool insert(const QString& key, const QPixmap &pixmap, int cost); QPixmapCache::Key insert(const QPixmap &pixmap, int cost); bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost); diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 856b82f559..ea10ab1b76 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -56,7 +56,7 @@ public: Key(); Key(const Key &other); #ifdef Q_COMPILER_RVALUE_REFS - Key(Key &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; } + Key(Key &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } Key &operator =(Key &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif ~Key(); diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 07e372b1ae..519995e82a 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -185,6 +185,72 @@ void QStandardItemPrivate::childDeleted(QStandardItem *child) emit model->dataChanged(modelIndex, modelIndex); } +namespace { + + struct ByNormalizedRole + { + static int normalizedRole(int role) + { + return role == Qt::EditRole ? Qt::DisplayRole : role; + } + + bool operator()(const QStandardItemData& standardItemData, const std::pair<const int &, const QVariant&>& roleMapIt) const + { + return standardItemData.role < normalizedRole(roleMapIt.first); + } + bool operator()(const std::pair<const int&, const QVariant &>& roleMapIt, const QStandardItemData& standardItemData) const + { + return normalizedRole(roleMapIt.first) < standardItemData.role; + } + + }; + + /* + Based on std::transform with a twist. The inputs are iterators of <int, QVariant> pair. + The variant is checked for validity and if not valid, that element is not taken into account + which means that the resulting output might be shorter than the input. + */ + template<class Input, class OutputIt> + OutputIt roleMapStandardItemDataTransform(Input first1, Input last1, OutputIt d_first) + { + while (first1 != last1) { + if ((*first1).second.isValid()) + *d_first++ = QStandardItemData(*first1); + ++first1; + } + return d_first; + } + + + /* + Based on std::set_union with a twist. The idea is to create a union of both inputs + with an additional constraint: if an input contains an invalid variant, it means + that this one should not be taken into account for generating the output. + */ + template<class Input1, class Input2, + class OutputIt, class Compare> + OutputIt roleMapStandardItemDataUnion(Input1 first1, Input1 last1, + Input2 first2, Input2 last2, + OutputIt d_first, Compare comp) + { + for (; first1 != last1; ++d_first) { + if (first2 == last2) { + return roleMapStandardItemDataTransform(first1, last1, d_first); + } + if (comp(*first2, *first1)) { + *d_first = *first2++; + } else { + if ((*first1).second.isValid()) + *d_first = QStandardItemData(*first1); + if (!comp(*first1, *first2)) + ++first2; + ++first1; + } + } + return std::copy(first2, last2, d_first); + } +} + /*! \internal */ @@ -192,18 +258,25 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles) { Q_Q(QStandardItem); - //let's build the vector of new values + auto byRole = [](const QStandardItemData& item1, const QStandardItemData& item2) { + return item1.role < item2.role; + }; + + std::sort(values.begin(), values.end(), byRole); + + /* + Create a vector of QStandardItemData that will contain the original values + if the matching role is not contained in roles, the new value if it is and + if the new value is an invalid QVariant, it will be removed. + */ QVector<QStandardItemData> newValues; - for (auto it = roles.begin(), end = roles.end(); it != end; ++it) { - const QVariant &value = it.value(); - if (value.isValid()) { - int role = it.key(); - role = (role == Qt::EditRole) ? Qt::DisplayRole : role; - newValues.append(QStandardItemData(role, value)); - } - } + newValues.reserve(values.size()); + roleMapStandardItemDataUnion(roles.keyValueBegin(), + roles.keyValueEnd(), + values.cbegin(), values.cend(), + std::back_inserter(newValues), ByNormalizedRole()); - if (values!=newValues) { + if (newValues != values) { values.swap(newValues); if (model) model->d_func()->itemChanged(q); diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h index 73107b827c..c54e7b27d9 100644 --- a/src/gui/itemmodels/qstandarditemmodel.h +++ b/src/gui/itemmodels/qstandarditemmodel.h @@ -327,45 +327,45 @@ class Q_GUI_EXPORT QStandardItemModel : public QAbstractItemModel Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) public: - explicit QStandardItemModel(QObject *parent = Q_NULLPTR); - QStandardItemModel(int rows, int columns, QObject *parent = Q_NULLPTR); + explicit QStandardItemModel(QObject *parent = nullptr); + QStandardItemModel(int rows, int columns, QObject *parent = nullptr); ~QStandardItemModel(); void setItemRoleNames(const QHash<int,QByteArray> &roleNames); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &child) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; // Qt 6: Remove - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + int role = Qt::DisplayRole) const override; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, - int role = Qt::EditRole) Q_DECL_OVERRIDE; + int role = Qt::EditRole) override; - bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const override; + Qt::DropActions supportedDropActions() const override; - QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE; - bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) Q_DECL_OVERRIDE; + QMap<int, QVariant> itemData(const QModelIndex &index) const override; + bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override; void clear(); using QObject::parent; - void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; QStandardItem *itemFromIndex(const QModelIndex &index) const; QModelIndex indexFromItem(const QStandardItem *item) const; @@ -414,15 +414,15 @@ public: int sortRole() const; void setSortRole(int role); - QStringList mimeTypes() const Q_DECL_OVERRIDE; - QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE; - bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; + bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; Q_SIGNALS: void itemChanged(QStandardItem *item); protected: - QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent = Q_NULLPTR); + QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent = nullptr); private: friend class QStandardItemPrivate; diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h index 516cce8613..caee3ea34c 100644 --- a/src/gui/itemmodels/qstandarditemmodel_p.h +++ b/src/gui/itemmodels/qstandarditemmodel_p.h @@ -61,6 +61,7 @@ #include <QtCore/qstack.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> +#include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE @@ -69,6 +70,7 @@ class QStandardItemData public: inline QStandardItemData() : role(-1) {} inline QStandardItemData(int r, const QVariant &v) : role(r), value(v) {} + inline QStandardItemData(const std::pair<const int&, const QVariant&> &p) : role(p.first), value(p.second) {} int role; QVariant value; inline bool operator==(const QStandardItemData &other) const { return role == other.role && value == other.value; } @@ -91,6 +93,15 @@ inline QDataStream &operator<<(QDataStream &out, const QStandardItemData &data) return out; } +inline QDebug &operator<<(QDebug &debug, const QStandardItemData &data) +{ + QDebugStateSaver saver(debug); + debug.nospace() << data.role + << " " + << data.value; + return debug.space(); +} + #endif // QT_NO_DATASTREAM class QStandardItemPrivate diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index ccce3d84ef..d62ee7a053 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -87,7 +87,7 @@ public: ~QCursor(); QCursor &operator=(const QCursor &cursor); #ifdef Q_COMPILER_RVALUE_REFS - QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; } + QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } inline QCursor &operator=(QCursor &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index eaf6c74fd4..e7d83cbbaf 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -77,8 +77,8 @@ public: QInternalMimeData(); ~QInternalMimeData(); - bool hasFormat(const QString &mimeType) const Q_DECL_OVERRIDE; - QStringList formats() const Q_DECL_OVERRIDE; + bool hasFormat(const QString &mimeType) const override; + QStringList formats() const override; static bool canReadData(const QString &mimeType); @@ -87,7 +87,7 @@ public: static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data); protected: - QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; + QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override; virtual bool hasFormat_sys(const QString &mimeType) const = 0; virtual QStringList formats_sys() const = 0; diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 372b5f0896..d95da40368 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -724,7 +724,7 @@ class Q_GUI_EXPORT QActionEvent : public QEvent { QAction *act, *bef; public: - QActionEvent(int type, QAction *action, QAction *before = Q_NULLPTR); + QActionEvent(int type, QAction *action, QAction *before = nullptr); ~QActionEvent(); inline QAction *action() const { return act; } @@ -852,7 +852,7 @@ public: TouchPoint(const TouchPoint &other); #ifdef Q_COMPILER_RVALUE_REFS TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT - : d(Q_NULLPTR) + : d(nullptr) { qSwap(d, other.d); } TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT { qSwap(d, other.d); return *this; } @@ -940,7 +940,7 @@ public: #endif explicit QTouchEvent(QEvent::Type eventType, - QTouchDevice *device = Q_NULLPTR, + QTouchDevice *device = nullptr, Qt::KeyboardModifiers modifiers = Qt::NoModifier, Qt::TouchPointStates touchPointStates = Qt::TouchPointStates(), const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h index e8aa2e6f32..69b4f29854 100644 --- a/src/gui/kernel/qgenericplugin.h +++ b/src/gui/kernel/qgenericplugin.h @@ -52,7 +52,7 @@ class Q_GUI_EXPORT QGenericPlugin : public QObject { Q_OBJECT public: - explicit QGenericPlugin(QObject *parent = Q_NULLPTR); + explicit QGenericPlugin(QObject *parent = nullptr); ~QGenericPlugin(); virtual QObject* create(const QString& name, const QString &spec) = 0; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b26567ad0c..d967b03fee 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -190,7 +190,7 @@ QWindow *QGuiApplicationPrivate::focus_window = 0; static QBasicMutex applicationFontMutex; QFont *QGuiApplicationPrivate::app_font = 0; -QStyleHints *QGuiApplicationPrivate::styleHints = Q_NULLPTR; +QStyleHints *QGuiApplicationPrivate::styleHints = nullptr; bool QGuiApplicationPrivate::obey_desktop_settings = true; QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; @@ -748,7 +748,7 @@ QString QGuiApplication::desktopFileName() */ QWindow *QGuiApplication::modalWindow() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) if (QGuiApplicationPrivate::self->modalWindowList.isEmpty()) return 0; return QGuiApplicationPrivate::self->modalWindowList.first(); @@ -1527,7 +1527,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() cleanupThreadData(); delete QGuiApplicationPrivate::styleHints; - QGuiApplicationPrivate::styleHints = Q_NULLPTR; + QGuiApplicationPrivate::styleHints = nullptr; delete inputMethod; qt_cleanupFontDatabase(); @@ -1650,10 +1650,10 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function) QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); if (!pi) { qWarning("QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function"); - return Q_NULLPTR; + return nullptr; } - return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : Q_NULLPTR; + return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr; } /*! @@ -1736,7 +1736,6 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) { switch(e->type) { - case QWindowSystemInterfacePrivate::FrameStrutMouse: case QWindowSystemInterfacePrivate::Mouse: QGuiApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e)); break; @@ -1843,29 +1842,111 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv } } +/*! \internal + + History is silent on why Qt splits mouse events that change position and + button state at the same time. We believe that this was done to emulate mouse + behavior on touch screens. If mouse tracking is enabled, we will get move + events before the button is pressed. A touch panel does not generally give + move events when not pressed, so without event splitting code path we would + only see a press in a new location without any intervening moves. This could + confuse code that is written for a real mouse. The same is true for mouse + release events that change position, see tst_QWidget::touchEventSynthesizedMouseEvent() + auto test. +*/ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) { - QEvent::Type type; - Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons; - if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { - // A mouse event should not change both position and buttons at the same time. Instead we - // should first send a move event followed by a button changed event. Since this is not the case - // with the current event, we split it in two. - QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent( - e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers, e->source); - if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic) - mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; - e->buttons = mouse_buttons; - processMouseEvent(e); - processMouseEvent(&mouseButtonEvent); - return; + QEvent::Type type = QEvent::None; + Qt::MouseButton button = Qt::NoButton; + QWindow *window = e->window.data(); + bool positionChanged = QGuiApplicationPrivate::lastCursorPosition != e->globalPos; + bool mouseMove = false; + bool mousePress = false; + + if (e->enhancedMouseEvent()) { + type = e->buttonType; + button = e->button; + + if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove) + mouseMove = true; + else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress) + mousePress = true; + + if (!mouseMove && positionChanged) { + QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp, + e->localPos, e->globalPos, e->buttons & ~button, e->modifiers, Qt::NoButton, + e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove, + e->source, e->nonClientArea); + if (e->synthetic()) + moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; + processMouseEvent(&moveEvent); // mouse move excluding state change + processMouseEvent(e); // the original mouse event + return; + } + } else { + Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons; + if (positionChanged && (stateChange != Qt::NoButton)) { + QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp, e->localPos, + e->globalPos, mouse_buttons, e->modifiers, Qt::NoButton, QEvent::None, e->source, + e->nonClientArea); + if (e->synthetic()) + moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; + processMouseEvent(&moveEvent); // mouse move excluding state change + processMouseEvent(e); // the original mouse event + return; + } + + // In the compatibility path we deduce event type and button that caused the event + if (positionChanged) { + mouseMove = true; + type = e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove; + } else { + // Check to see if a new button has been pressed/released. + for (uint mask = Qt::LeftButton; mask <= Qt::MaxMouseButton; mask <<= 1) { + if (stateChange & mask) { + button = Qt::MouseButton(mask); + break; + } + } + if (button == Qt::NoButton) { + // Ignore mouse events that don't change the current state. This shouldn't + // really happen, getting here can only mean that the stored button state + // is out of sync with the actual physical button state. + return; + } + if (button & e->buttons) { + mousePress = true; + type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonPress + : QEvent::MouseButtonPress; + } else { + type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonRelease + : QEvent::MouseButtonRelease; + } + } } - QWindow *window = e->window.data(); modifier_buttons = e->modifiers; - QPointF localPoint = e->localPos; QPointF globalPoint = e->globalPos; + bool doubleClick = false; + + if (mouseMove) { + QGuiApplicationPrivate::lastCursorPosition = globalPoint; + if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| + qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) + mousePressButton = Qt::NoButton; + } else { + mouse_buttons = e->buttons; + if (mousePress) { + ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval()); + doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; + mousePressTime = e->timestamp; + mousePressButton = button; + const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint(); + mousePressX = point.x(); + mousePressY = point.y(); + } + } if (e->nullWindow()) { window = QGuiApplication::topLevelAt(globalPoint.toPoint()); @@ -1886,44 +1967,6 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo } } - Qt::MouseButton button = Qt::NoButton; - bool doubleClick = false; - const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse; - - if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) { - type = frameStrut ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove; - QGuiApplicationPrivate::lastCursorPosition = globalPoint; - if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| - qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) - mousePressButton = Qt::NoButton; - } else { // Check to see if a new button has been pressed/released. - for (int check = Qt::LeftButton; - check <= int(Qt::MaxMouseButton); - check = check << 1) { - if (check & stateChange) { - button = Qt::MouseButton(check); - break; - } - } - if (button == Qt::NoButton) { - // Ignore mouse events that don't change the current state. - return; - } - mouse_buttons = e->buttons; - if (button & e->buttons) { - ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval()); - doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; - type = frameStrut ? QEvent::NonClientAreaMouseButtonPress : QEvent::MouseButtonPress; - mousePressTime = e->timestamp; - mousePressButton = button; - const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint(); - mousePressX = point.x(); - mousePressY = point.y(); - } else { - type = frameStrut ? QEvent::NonClientAreaMouseButtonRelease : QEvent::MouseButtonRelease; - } - } - if (!window) return; @@ -1957,7 +2000,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo QGuiApplication::sendSpontaneousEvent(window, &ev); e->eventAccepted = ev.isAccepted(); if (!e->synthetic() && !ev.isAccepted() - && !frameStrut + && !e->nonClientArea && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) { if (!m_fakeTouchDevice) { m_fakeTouchDevice = new QTouchDevice; @@ -1994,7 +2037,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (doubleClick) { mousePressButton = Qt::NoButton; if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press - const QEvent::Type doubleClickType = frameStrut ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick; + const QEvent::Type doubleClickType = e->nonClientArea ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick; QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint, button, mouse_buttons, e->modifiers, e->source); dblClickEvent.setTimestamp(e->timestamp); @@ -2349,7 +2392,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T localValid = false; } if (type == QEvent::TabletRelease) - pointData.target = Q_NULLPTR; + pointData.target = nullptr; if (!window) return; } @@ -2366,20 +2409,30 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T break; } } - QTabletEvent ev(type, local, e->global, - e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, - e->tangentialPressure, e->rotation, e->z, - e->modifiers, e->uid, button, e->buttons); - ev.setAccepted(false); - ev.setTimestamp(e->timestamp); - QGuiApplication::sendSpontaneousEvent(window, &ev); + QTabletEvent tabletEvent(type, local, e->global, + e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, + e->tangentialPressure, e->rotation, e->z, + e->modifiers, e->uid, button, e->buttons); + tabletEvent.setAccepted(false); + tabletEvent.setTimestamp(e->timestamp); + QGuiApplication::sendSpontaneousEvent(window, &tabletEvent); pointData.state = e->buttons; - if (!ev.isAccepted() && !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse - && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) { - QWindowSystemInterfacePrivate::MouseEvent fake(window, e->timestamp, e->local, e->global, - e->buttons, e->modifiers, Qt::MouseEventSynthesizedByQt); - fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; - processMouseEvent(&fake); + if (!tabletEvent.isAccepted() + && !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse + && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) { + + const QEvent::Type mouseType = [&]() { + switch (type) { + case QEvent::TabletPress: return QEvent::MouseButtonPress; + case QEvent::TabletMove: return QEvent::MouseMove; + case QEvent::TabletRelease: return QEvent::MouseButtonRelease; + default: Q_UNREACHABLE(); + } + }(); + QWindowSystemInterfacePrivate::MouseEvent mouseEvent(window, e->timestamp, e->local, + e->global, e->buttons, e->modifiers, button, mouseType, Qt::MouseEventSynthesizedByQt); + mouseEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; + processMouseEvent(&mouseEvent); } #else Q_UNUSED(e) @@ -2485,7 +2538,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To ++it; } for (QSet<QWindow *>::const_iterator winIt = windowsNeedingCancel.constBegin(), - winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd; ++winIt) { + winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd; ++winIt) { touchEvent.setWindow(*winIt); QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent); } @@ -2498,8 +2551,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To e->timestamp, synthIt->pos, synthIt->screenPos, - mouse_buttons & ~Qt::LeftButton, + Qt::NoButton, e->modifiers, + Qt::LeftButton, + QEvent::MouseButtonRelease, Qt::MouseEventSynthesizedByQt); fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; processMouseEvent(&fake); @@ -2696,25 +2751,41 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (!e->synthetic() && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) { // exclude devices which generate their own mouse events if (!(touchEvent.device()->capabilities() & QTouchDevice::MouseEmulation)) { - Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton; - if (b == Qt::NoButton) + + if (eventType == QEvent::TouchEnd) self->synthesizedMousePoints.clear(); const QList<QTouchEvent::TouchPoint> &touchPoints = touchEvent.touchPoints(); if (eventType == QEvent::TouchBegin) m_fakeMouseSourcePointId = touchPoints.first().id(); + const QEvent::Type mouseType = [&]() { + switch (eventType) { + case QEvent::TouchBegin: return QEvent::MouseButtonPress; + case QEvent::TouchUpdate: return QEvent::MouseMove; + case QEvent::TouchEnd: return QEvent::MouseButtonRelease; + default: Q_UNREACHABLE(); + } + }(); + + Qt::MouseButton button = mouseType == QEvent::MouseMove ? Qt::NoButton : Qt::LeftButton; + Qt::MouseButtons buttons = mouseType == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton; + for (int i = 0; i < touchPoints.count(); ++i) { const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); if (touchPoint.id() == m_fakeMouseSourcePointId) { - if (b != Qt::NoButton) + if (eventType != QEvent::TouchEnd) self->synthesizedMousePoints.insert(w, SynthesizedMouseData( touchPoint.pos(), touchPoint.screenPos(), w)); + // All touch events that are not accepted by the application will be translated to + // left mouse button events instead (see AA_SynthesizeMouseForUnhandledTouchEvents docs). QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, touchPoint.pos(), touchPoint.screenPos(), - b | (mouse_buttons & ~Qt::LeftButton), + buttons, e->modifiers, + button, + mouseType, Qt::MouseEventSynthesizedByQt); fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; processMouseEvent(&fake); @@ -3506,7 +3577,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection() #ifndef QT_NO_CURSOR QCursor *QGuiApplication::overrideCursor() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first(); } @@ -3706,7 +3777,7 @@ bool QGuiApplication::desktopSettingsAware() */ QInputMethod *QGuiApplication::inputMethod() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) if (!qGuiApp->d_func()->inputMethod) qGuiApp->d_func()->inputMethod = new QInputMethod(); return qGuiApp->d_func()->inputMethod; diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index e130553b9d..8560fcf18a 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -157,7 +157,7 @@ public: static Qt::ApplicationState applicationState(); static int exec(); - bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE; + bool notify(QObject *, QEvent *) override; #ifndef QT_NO_SESSIONMANAGER // session management @@ -189,8 +189,8 @@ Q_SIGNALS: void applicationDisplayNameChanged(); protected: - bool event(QEvent *) Q_DECL_OVERRIDE; - bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) Q_DECL_OVERRIDE; + bool event(QEvent *) override; + bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override; QGuiApplication(QGuiApplicationPrivate &p); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 014ed861df..b7b847785c 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -85,13 +85,13 @@ public: void init(); void createPlatformIntegration(); - void createEventDispatcher() Q_DECL_OVERRIDE; - void eventDispatcherReady() Q_DECL_OVERRIDE; + void createEventDispatcher() override; + void eventDispatcherReady() override; virtual void notifyLayoutDirectionChange(); virtual void notifyActiveWindowChange(QWindow *previous); - virtual bool shouldQuit() Q_DECL_OVERRIDE; + virtual bool shouldQuit() override; bool shouldQuitInternal(const QWindowList &processedWindows); virtual bool tryCloseAllWindows(); @@ -213,7 +213,7 @@ public: static bool highDpiScalingUpdated; struct TabletPointData { - TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(Q_NULLPTR) {} + TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(nullptr) {} qint64 deviceId; Qt::MouseButtons state; QWindow *target; diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h index 3295ae0d40..9d4839cb25 100644 --- a/src/gui/kernel/qoffscreensurface.h +++ b/src/gui/kernel/qoffscreensurface.h @@ -59,10 +59,10 @@ class Q_GUI_EXPORT QOffscreenSurface : public QObject, public QSurface public: // ### Qt 6: merge overloads explicit QOffscreenSurface(QScreen *screen, QObject *parent); - explicit QOffscreenSurface(QScreen *screen = Q_NULLPTR); + explicit QOffscreenSurface(QScreen *screen = nullptr); virtual ~QOffscreenSurface(); - SurfaceType surfaceType() const Q_DECL_OVERRIDE; + SurfaceType surfaceType() const override; void create(); void destroy(); @@ -70,10 +70,10 @@ public: bool isValid() const; void setFormat(const QSurfaceFormat &format); - QSurfaceFormat format() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; QSurfaceFormat requestedFormat() const; - QSize size() const Q_DECL_OVERRIDE; + QSize size() const override; QScreen *screen() const; void setScreen(QScreen *screen); @@ -91,7 +91,7 @@ private Q_SLOTS: private: - QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE; + QPlatformSurface *surfaceHandle() const override; Q_DISABLE_COPY(QOffscreenSurface) }; diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 07153db84e..9cfaa52f17 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -151,7 +151,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QOpenGLContext) public: - explicit QOpenGLContext(QObject *parent = Q_NULLPTR); + explicit QOpenGLContext(QObject *parent = nullptr); ~QOpenGLContext(); void setFormat(const QSurfaceFormat &format); diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 9f9b4352fc..4f2f951d61 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -114,12 +114,12 @@ public: GLuint id() const { return m_id; } protected: - void invalidateResource() Q_DECL_OVERRIDE + void invalidateResource() override { m_id = 0; } - void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE; + void freeResource(QOpenGLContext *context) override; private: GLuint m_id; @@ -213,7 +213,7 @@ public: , workaround_missingPrecisionQualifiers(false) , active_engine(0) , qgl_current_fbo_invalid(false) - , qgl_current_fbo(Q_NULLPTR) + , qgl_current_fbo(nullptr) , defaultFboRedirect(0) { requestedFormat = QSurfaceFormat::defaultFormat(); @@ -266,7 +266,7 @@ public: static QOpenGLContextPrivate *get(QOpenGLContext *context) { - return context ? context->d_func() : Q_NULLPTR; + return context ? context->d_func() : nullptr; } #if !defined(QT_NO_DEBUG) diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index 5170c7ab63..cf3d712421 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -163,7 +163,7 @@ class QOpenGLWindowPaintDevice : public QOpenGLPaintDevice { public: QOpenGLWindowPaintDevice(QOpenGLWindow *window) : m_window(window) { } - void ensureActiveTarget() Q_DECL_OVERRIDE; + void ensureActiveTarget() override; QOpenGLWindow *m_window; }; @@ -188,9 +188,9 @@ public: void bindFBO(); void initialize(); - void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE; - void endPaint() Q_DECL_OVERRIDE; - void flush(const QRegion ®ion) Q_DECL_OVERRIDE; + void beginPaint(const QRegion ®ion) override; + void endPaint() override; + void flush(const QRegion ®ion) override; QOpenGLWindow::UpdateBehavior updateBehavior; bool hasFboBlit; @@ -344,7 +344,7 @@ void QOpenGLWindowPaintDevice::ensureActiveTarget() \sa QOpenGLWindow::UpdateBehavior */ QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent) - : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(Q_NULLPTR, updateBehavior)), parent) + : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(nullptr, updateBehavior)), parent) { setSurfaceType(QSurface::OpenGLSurface); } diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h index fe236f9538..7b3bf004a3 100644 --- a/src/gui/kernel/qopenglwindow.h +++ b/src/gui/kernel/qopenglwindow.h @@ -64,8 +64,8 @@ public: PartialUpdateBlend }; - explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR); - explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR); + explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr); + explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr); ~QOpenGLWindow(); UpdateBehavior updateBehavior() const; @@ -91,10 +91,10 @@ protected: virtual void paintUnderGL(); virtual void paintOverGL(); - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; - int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE; - QPaintDevice *redirected(QPoint *) const Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) override; + void resizeEvent(QResizeEvent *event) override; + int metric(PaintDeviceMetric metric) const override; + QPaintDevice *redirected(QPoint *) const override; private: Q_DISABLE_COPY(QOpenGLWindow) diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h index 81b41dcdd5..3be078132f 100644 --- a/src/gui/kernel/qpaintdevicewindow.h +++ b/src/gui/kernel/qpaintdevicewindow.h @@ -68,14 +68,14 @@ public Q_SLOTS: protected: virtual void paintEvent(QPaintEvent *event); - int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE; - void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE; - bool event(QEvent *event) Q_DECL_OVERRIDE; + int metric(PaintDeviceMetric metric) const override; + void exposeEvent(QExposeEvent *) override; + bool event(QEvent *event) override; QPaintDeviceWindow(QPaintDeviceWindowPrivate &dd, QWindow *parent); private: - QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; + QPaintEngine *paintEngine() const override; Q_DISABLE_COPY(QPaintDeviceWindow) }; diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index d04fb1f0c5..71f3d0c3b8 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -70,7 +70,7 @@ public: #ifdef Q_COMPILER_RVALUE_REFS QPalette(QPalette &&other) Q_DECL_NOTHROW : d(other.d), data(other.data) - { other.d = Q_NULLPTR; } + { other.d = nullptr; } inline QPalette &operator=(QPalette &&other) Q_DECL_NOEXCEPT { for_faster_swapping_dont_use = other.for_faster_swapping_dont_use; diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index e6cf6a8216..df78e7d896 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -128,7 +128,7 @@ void QPlatformCursor::setPos(const QPoint &pos) qWarning("This plugin does not support QCursor::setPos()" "; emulating movement within the application."); } - QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove); } // End of display and pointer event handling code diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp index d42231e958..cc01efd6db 100644 --- a/src/gui/kernel/qplatformgraphicsbuffer.cpp +++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp @@ -217,7 +217,7 @@ void QPlatformGraphicsBuffer::unlock() the memory returned when not having a SWWriteAccess. */ const uchar *QPlatformGraphicsBuffer::data() const -{ return Q_NULLPTR; } +{ return nullptr; } /*! Accessor for the bytes of the buffer. This function needs to be called on a @@ -226,7 +226,7 @@ const uchar *QPlatformGraphicsBuffer::data() const */ uchar *QPlatformGraphicsBuffer::data() { - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h index 5b7daff65a..6307f54a3e 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.h +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE namespace QPlatformGraphicsBufferHelper { bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, bool *premultipliedB, const QRect &rect = QRect()); - bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = Q_NULLPTR, bool *premultipliedB = Q_NULLPTR, const QRect &rect = QRect()); + bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = nullptr, bool *premultipliedB = nullptr, const QRect &rect = QRect()); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index 6614d45b12..b24541d3ec 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -92,7 +92,7 @@ void *QPlatformNativeInterface::nativeResourceForCursor(const QByteArray &resour { Q_UNUSED(resource); Q_UNUSED(cursor); - return Q_NULLPTR; + return nullptr; } #endif // !QT_NO_CURSOR @@ -129,7 +129,7 @@ QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeI QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &function) const { Q_UNUSED(function); - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/kernel/qplatformoffscreensurface.cpp b/src/gui/kernel/qplatformoffscreensurface.cpp index 9d35b37c6a..c2952e166c 100644 --- a/src/gui/kernel/qplatformoffscreensurface.cpp +++ b/src/gui/kernel/qplatformoffscreensurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h index be15a98e28..cef0fab7e1 100644 --- a/src/gui/kernel/qplatformoffscreensurface.h +++ b/src/gui/kernel/qplatformoffscreensurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -68,7 +68,7 @@ public: QOffscreenSurface *offscreenSurface() const; - QPlatformScreen *screen() const; + QPlatformScreen *screen() const override; virtual QSurfaceFormat format() const override; virtual bool isValid() const; diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h index 5a1e4fe82d..76e8767a05 100644 --- a/src/gui/kernel/qplatformsurface.h +++ b/src/gui/kernel/qplatformsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE +class QPlatformScreen; class Q_GUI_EXPORT QPlatformSurface { @@ -64,6 +65,7 @@ public: virtual QSurfaceFormat format() const = 0; QSurface *surface() const; + virtual QPlatformScreen *screen() const = 0; private: explicit QPlatformSurface(QSurface *surface); diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index ae39411729..2284290d6c 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -104,7 +104,7 @@ QPlatformWindow *QPlatformWindow::parent() const QPlatformScreen *QPlatformWindow::screen() const { QScreen *scr = window()->screen(); - return scr ? scr->handle() : Q_NULLPTR; + return scr ? scr->handle() : nullptr; } /*! diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index dff8f618e2..4105ef1c1a 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -79,7 +79,7 @@ public: QWindow *window() const; QPlatformWindow *parent() const; - QPlatformScreen *screen() const; + QPlatformScreen *screen() const override; virtual QSurfaceFormat format() const override; diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp index 73871e0f39..d06fee62cf 100644 --- a/src/gui/kernel/qrasterwindow.cpp +++ b/src/gui/kernel/qrasterwindow.cpp @@ -70,7 +70,7 @@ class QRasterWindowPrivate : public QPaintDeviceWindowPrivate { Q_DECLARE_PUBLIC(QRasterWindow) public: - void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE + void beginPaint(const QRegion ®ion) override { Q_Q(QRasterWindow); const QSize size = q->size(); @@ -81,12 +81,12 @@ public: backingstore->beginPaint(region); } - void endPaint() Q_DECL_OVERRIDE + void endPaint() override { backingstore->endPaint(); } - void flush(const QRegion ®ion) Q_DECL_OVERRIDE + void flush(const QRegion ®ion) override { Q_Q(QRasterWindow); backingstore->flush(region, q); diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h index 9b29183ad6..9fe01c076b 100644 --- a/src/gui/kernel/qrasterwindow.h +++ b/src/gui/kernel/qrasterwindow.h @@ -53,12 +53,12 @@ class Q_GUI_EXPORT QRasterWindow : public QPaintDeviceWindow Q_DECLARE_PRIVATE(QRasterWindow) public: - explicit QRasterWindow(QWindow *parent = Q_NULLPTR); + explicit QRasterWindow(QWindow *parent = nullptr); ~QRasterWindow(); protected: - int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE; - QPaintDevice *redirected(QPoint *) const Q_DECL_OVERRIDE; + int metric(PaintDeviceMetric metric) const override; + QPaintDevice *redirected(QPoint *) const override; private: Q_DISABLE_COPY(QRasterWindow) diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h index 2c25ca7c76..477938867c 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow_p.h +++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h @@ -71,7 +71,7 @@ public: void updateGeometry(const QPoint &pos); protected: - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *) override; private: QPixmap m_pixmap; diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 99aaed0444..1b56c7d9f2 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -97,7 +97,7 @@ QBasicDrag::QBasicDrag() : m_restoreCursor(false), m_eventLoop(0), m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false), m_drag(0), m_drag_icon_window(0), m_useCompositing(true), - m_screen(Q_NULLPTR) + m_screen(nullptr) { } diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h index 45c13e43b2..4db8eb4505 100644 --- a/src/gui/kernel/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -72,10 +72,10 @@ class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject public: virtual ~QBasicDrag(); - virtual Qt::DropAction drag(QDrag *drag) Q_DECL_OVERRIDE; - void cancelDrag() Q_DECL_OVERRIDE; + virtual Qt::DropAction drag(QDrag *drag) override; + void cancelDrag() override; - virtual bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; + virtual bool eventFilter(QObject *o, QEvent *e) override; protected: QBasicDrag(); @@ -127,10 +127,10 @@ public: QSimpleDrag(); protected: - virtual void startDrag() Q_DECL_OVERRIDE; - virtual void cancel() Q_DECL_OVERRIDE; - virtual void move(const QPoint &globalPos) Q_DECL_OVERRIDE; - virtual void drop(const QPoint &globalPos) Q_DECL_OVERRIDE; + virtual void startDrag() override; + virtual void cancel() override; + virtual void move(const QPoint &globalPos) override; + virtual void drop(const QPoint &globalPos) override; private: QWindow *m_current_window; diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 44ff054fa3..ac5543f884 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -141,12 +141,12 @@ public: }; Q_ENUM(AncestorMode) - explicit QWindow(QScreen *screen = Q_NULLPTR); + explicit QWindow(QScreen *screen = nullptr); explicit QWindow(QWindow *parent); virtual ~QWindow(); void setSurfaceType(SurfaceType surfaceType); - SurfaceType surfaceType() const Q_DECL_OVERRIDE; + SurfaceType surfaceType() const override; bool isVisible() const; @@ -168,7 +168,7 @@ public: void setModality(Qt::WindowModality modality); void setFormat(const QSurfaceFormat &format); - QSurfaceFormat format() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; QSurfaceFormat requestedFormat() const; void setFlags(Qt::WindowFlags flags); @@ -231,7 +231,7 @@ public: inline int x() const { return geometry().x(); } inline int y() const { return geometry().y(); } - QSize size() const Q_DECL_OVERRIDE { return geometry().size(); } + QSize size() const override { return geometry().size(); } inline QPoint position() const { return geometry().topLeft(); } void setPosition(const QPoint &pt); @@ -347,7 +347,7 @@ protected: virtual void hideEvent(QHideEvent *); // TODO Qt 6 - add closeEvent virtual handler - virtual bool event(QEvent *) Q_DECL_OVERRIDE; + virtual bool event(QEvent *) override; virtual void keyPressEvent(QKeyEvent *); virtual void keyReleaseEvent(QKeyEvent *); virtual void mousePressEvent(QMouseEvent *); @@ -367,7 +367,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_clearAlert()) - QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE; + QPlatformSurface *surfaceHandle() const override; Q_DISABLE_COPY(QWindow) @@ -380,12 +380,12 @@ private: #ifndef Q_QDOC template <> inline QWindow *qobject_cast<QWindow*>(QObject *o) { - if (!o || !o->isWindowType()) return Q_NULLPTR; + if (!o || !o->isWindowType()) return nullptr; return static_cast<QWindow*>(o); } template <> inline const QWindow *qobject_cast<const QWindow*>(const QObject *o) { - if (!o || !o->isWindowType()) return Q_NULLPTR; + if (!o || !o->isWindowType()) return nullptr; return static_cast<const QWindow*>(o); } #endif // !Q_QDOC diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index f9580291bc..a065e254df 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -341,35 +341,79 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *window, bool *accepted) \a w == 0 means that the event is in global coords only, \a local will be ignored in this case */ +#if QT_DEPRECATED_SINCE(5, 11) QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, Qt::MouseEventSource source) { - unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleMouseEvent<Delivery>(window, time, local, global, b, mods, source); + handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); } QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, Qt::MouseEventSource source) { - QWindowSystemInterfacePrivate::MouseEvent * e = - new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), b, mods, source); - QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); + handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); } void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, Qt::MouseEventSource source) { - const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleFrameStrutMouseEvent(window, time, local, global, b, mods, source); + handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); } void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, Qt::MouseEventSource source) { - QWindowSystemInterfacePrivate::MouseEvent * e = - new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, - QWindowSystemInterfacePrivate::FrameStrutMouse, - QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), b, mods, source); + handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); +} +#endif // QT_DEPRECATED_SINCE(5, 11) + +QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, + const QPointF &local, const QPointF &global, Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, + Qt::MouseEventSource source) +{ + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source); +} + +QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, + const QPointF &local, const QPointF &global, Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, + Qt::MouseEventSource source) +{ + auto localPos = QHighDpi::fromNativeLocalPosition(local, window); + auto globalPos = QHighDpi::fromNativePixels(global, window); + + QWindowSystemInterfacePrivate::MouseEvent *e = + new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos, + state, mods, button, type, source); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); +} + +void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, + const QPointF &local, const QPointF &global, + Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods, + Qt::MouseEventSource source) +{ + const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source); +} + +void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, + const QPointF &local, const QPointF &global, + Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods, + Qt::MouseEventSource source) +{ + auto localPos = QHighDpi::fromNativeLocalPosition(local, window); + auto globalPos = QHighDpi::fromNativePixels(global, window); + + QWindowSystemInterfacePrivate::MouseEvent *e = + new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos, + state, mods, button, type, source, true); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } @@ -1007,11 +1051,26 @@ bool QWindowSystemInterface::nonUserInputEventsQueued() // The following functions are used by testlib, and need to be synchronous to avoid // race conditions with plugins delivering native events from secondary threads. +// FIXME: It seems unnecessary to export these wrapper functions, when qtestlib could access +// QWindowSystemInterface directly (by adding dependency to gui-private), see QTBUG-63146. + +Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, + Qt::MouseButtons state, Qt::MouseButton button, + QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp) +{ + const qreal factor = QHighDpiScaling::factor(window); + QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window, + timestamp, local * factor, global * factor, state, button, type, mods); +} -Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp) +// Wrapper for compatibility with Qt < 5.11 +// ### Qt6: Remove +Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, + Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp) { const qreal factor = QHighDpiScaling::factor(window); - QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window, timestamp, local * factor, global * factor, b, mods); + QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window, + timestamp, local * factor, global * factor, b, Qt::NoButton, QEvent::None, mods); } // Wrapper for compatibility with Qt < 5.6 diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 1ded12d88d..e027157fac 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -76,20 +76,47 @@ public: struct AsynchronousDelivery {}; struct DefaultDelivery {}; +#if QT_DEPRECATED_SINCE(5, 11) template<typename Delivery = QWindowSystemInterface::DefaultDelivery> - static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, + QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); template<typename Delivery = QWindowSystemInterface::DefaultDelivery> - static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, + QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); - static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, + + QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); - static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, + QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); +#endif + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> + static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, + Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods = Qt::NoModifier, + Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> + static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, + const QPointF &global, Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods = Qt::NoModifier, + Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); + + static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, + const QPointF &global, Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods = Qt::NoModifier, + Qt::MouseEventSource source = + Qt::MouseEventNotSynthesized); + static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, + const QPointF &global, Qt::MouseButtons state, + Qt::MouseButton button, QEvent::Type type, + Qt::KeyboardModifiers mods = Qt::NoModifier, + Qt::MouseEventSource source = + Qt::MouseEventNotSynthesized); static bool handleShortcutEvent(QWindow *window, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1); @@ -166,7 +193,7 @@ public: template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleExposeEvent(QWindow *window, const QRegion ®ion); - static void handleCloseEvent(QWindow *window, bool *accepted = Q_NULLPTR); + static void handleCloseEvent(QWindow *window, bool *accepted = nullptr); template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleEnterEvent(QWindow *window, const QPointF &local = QPointF(), const QPointF& global = QPointF()); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 6a1360a26a..152ea92919 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -75,7 +75,7 @@ public: ActivatedWindow = 0x05, WindowStateChanged = 0x06, Mouse = UserInputEvent | 0x07, - FrameStrutMouse = UserInputEvent | 0x08, + FrameStrutMouse = UserInputEvent | 0x08, // ### Qt6 remove Wheel = UserInputEvent | 0x09, Key = UserInputEvent | 0x0a, Touch = UserInputEvent | 0x0b, @@ -225,18 +225,27 @@ public: class MouseEvent : public InputEvent { public: - MouseEvent(QWindow * w, ulong time, const QPointF &local, const QPointF &global, - Qt::MouseButtons b, Qt::KeyboardModifiers mods, - Qt::MouseEventSource src = Qt::MouseEventNotSynthesized) - : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b), source(src) { } - MouseEvent(QWindow * w, ulong time, EventType t, const QPointF &local, const QPointF &global, - Qt::MouseButtons b, Qt::KeyboardModifiers mods, - Qt::MouseEventSource src = Qt::MouseEventNotSynthesized) - : InputEvent(w, time, t, mods), localPos(local), globalPos(global), buttons(b), source(src) { } + MouseEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, + Qt::MouseButtons state, Qt::KeyboardModifiers mods, + Qt::MouseButton b, QEvent::Type type, + Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool frame = false) + : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(state), + source(src), nonClientArea(frame), button(b), buttonType(type) { } + + // ### In Qt6 this method can be removed as there won't be need for compatibility code path + bool enhancedMouseEvent() const + { + static const bool disableEnhanced = qEnvironmentVariableIsSet("QT_QPA_DISABLE_ENHANCED_MOUSE"); + return !disableEnhanced && buttonType != QEvent::None; + } + QPointF localPos; QPointF globalPos; Qt::MouseButtons buttons; Qt::MouseEventSource source; + bool nonClientArea; + Qt::MouseButton button; + QEvent::Type buttonType; }; class WheelEvent : public InputEvent { @@ -513,7 +522,7 @@ public: static QList<QTouchEvent::TouchPoint> fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, - const QWindow *window, quint8 deviceId, QEvent::Type *type = Q_NULLPTR); + const QWindow *window, quint8 deviceId, QEvent::Type *type = nullptr); static QList<QWindowSystemInterface::TouchPoint> toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList, const QWindow *window); diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 97df11a8bd..69c3510659 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -93,7 +93,7 @@ public: inline void fill(float value); double determinant() const; - QMatrix4x4 inverted(bool *invertible = Q_NULLPTR) const; + QMatrix4x4 inverted(bool *invertible = nullptr) const; QMatrix4x4 transposed() const; QMatrix3x3 normalMatrix() const; diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 7e663d48bb..3a476978e7 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -143,7 +143,7 @@ typedef QJsonArray::ConstIterator JsonArrayConstIt; static inline bool contains(const QJsonArray &haystack, unsigned needle) { for (JsonArrayConstIt it = haystack.constBegin(), cend = haystack.constEnd(); it != cend; ++it) { - if (needle == it->toString().toUInt(Q_NULLPTR, /* base */ 0)) + if (needle == it->toString().toUInt(nullptr, /* base */ 0)) return true; } return false; @@ -331,7 +331,7 @@ static bool matches(const QJsonObject &object, const QJsonValue vendorV = object.value(QLatin1String("vendor_id")); if (vendorV.isString()) { - if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0)) + if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0)) return false; } else { if (object.contains(QLatin1String("gl_vendor"))) { diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index f6c350ba0b..b4657fa118 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -235,10 +235,6 @@ typedef long long int int64_t; typedef unsigned long long int uint64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include <inttypes.h> -#elif defined(__SCO__) || defined(__USLC__) -#include <stdint.h> #elif defined(__UNIXOS2__) || defined(__SOL64__) typedef long int int32_t; typedef long long int int64_t; diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h index f2dfec3bb4..a810783731 100644 --- a/src/gui/opengl/qopenglbuffer.h +++ b/src/gui/opengl/qopenglbuffer.h @@ -124,7 +124,7 @@ public: void write(int offset, const void *data, int count); void allocate(const void *data, int count); - inline void allocate(int count) { allocate(Q_NULLPTR, count); } + inline void allocate(int count) { allocate(nullptr, count); } void *map(QOpenGLBuffer::Access access); void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access); diff --git a/src/gui/opengl/qopengldebug.h b/src/gui/opengl/qopengldebug.h index 6b10c36291..556ec175e1 100644 --- a/src/gui/opengl/qopengldebug.h +++ b/src/gui/opengl/qopengldebug.h @@ -167,7 +167,7 @@ public: }; Q_ENUM(LoggingMode) - explicit QOpenGLDebugLogger(QObject *parent = Q_NULLPTR); + explicit QOpenGLDebugLogger(QObject *parent = nullptr); ~QOpenGLDebugLogger(); bool initialize(); diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index 3a94fa8805..2f7afa4a66 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -69,13 +69,13 @@ public: delete m_shaders; } - void invalidateResource() Q_DECL_OVERRIDE + void invalidateResource() override { delete m_shaders; m_shaders = 0; } - void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE + void freeResource(QOpenGLContext *) override { } diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h index b8b0c31f31..856adb679e 100644 --- a/src/gui/opengl/qopenglext.h +++ b/src/gui/opengl/qopenglext.h @@ -1405,10 +1405,6 @@ typedef long long int int64_t; typedef unsigned long long int uint64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include <inttypes.h> -#elif defined(__SCO__) || defined(__USLC__) -#include <stdint.h> #elif defined(__UNIXOS2__) || defined(__SOL64__) typedef long int int32_t; typedef long long int int64_t; diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h index 81716fb8d3..a68e269065 100644 --- a/src/gui/opengl/qopenglextrafunctions.h +++ b/src/gui/opengl/qopenglextrafunctions.h @@ -511,7 +511,7 @@ public: void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); private: - static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != Q_NULLPTR; } + static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != nullptr; } }; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index b56bcd0866..628475a90a 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -953,7 +953,7 @@ QOpenGLFramebufferObject::~QOpenGLFramebufferObject() QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); if (contextPrv && contextPrv->qgl_current_fbo == this) { contextPrv->qgl_current_fbo_invalid = true; - contextPrv->qgl_current_fbo = Q_NULLPTR; + contextPrv->qgl_current_fbo = nullptr; } } @@ -1116,7 +1116,7 @@ bool QOpenGLFramebufferObject::release() QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(current); contextPrv->qgl_current_fbo_invalid = true; - contextPrv->qgl_current_fbo = Q_NULLPTR; + contextPrv->qgl_current_fbo = nullptr; } return true; @@ -1472,7 +1472,7 @@ bool QOpenGLFramebufferObject::bindDefault() if (ctx) { ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject()); QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true; - QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = Q_NULLPTR; + QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = nullptr; } #ifdef QT_DEBUG else diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 5e3537e47b..739ecacc51 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -216,13 +216,13 @@ struct QOpenGLFunctionsPrivateEx : public QOpenGLExtensionsPrivate, public QOpen , m_extensions(-1) {} - void invalidateResource() Q_DECL_OVERRIDE + void invalidateResource() override { m_features = -1; m_extensions = -1; } - void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE + void freeResource(QOpenGLContext *) override { // no gl resources to free } diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 0a5de2c9af..273ceaddc0 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -413,7 +413,7 @@ public: protected: QOpenGLFunctionsPrivate *d_ptr; - static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != Q_NULLPTR; } + static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; } }; Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures) diff --git a/src/gui/opengl/qopenglfunctions_1_0.h b/src/gui/opengl/qopenglfunctions_1_0.h index 8284604086..cddb7251ed 100644 --- a/src/gui/opengl/qopenglfunctions_1_0.h +++ b/src/gui/opengl/qopenglfunctions_1_0.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_0(); ~QOpenGLFunctions_1_0(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_1_1.h b/src/gui/opengl/qopenglfunctions_1_1.h index 052d3e93bd..8a9f16ec4c 100644 --- a/src/gui/opengl/qopenglfunctions_1_1.h +++ b/src/gui/opengl/qopenglfunctions_1_1.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_1(); ~QOpenGLFunctions_1_1(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_1_2.h b/src/gui/opengl/qopenglfunctions_1_2.h index 6b36500a79..7daca0923d 100644 --- a/src/gui/opengl/qopenglfunctions_1_2.h +++ b/src/gui/opengl/qopenglfunctions_1_2.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_2(); ~QOpenGLFunctions_1_2(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_1_3.h b/src/gui/opengl/qopenglfunctions_1_3.h index 3ed5851d5d..b527b57946 100644 --- a/src/gui/opengl/qopenglfunctions_1_3.h +++ b/src/gui/opengl/qopenglfunctions_1_3.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_3(); ~QOpenGLFunctions_1_3(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_1_4.h b/src/gui/opengl/qopenglfunctions_1_4.h index 849fad6744..1f3f5a9c0a 100644 --- a/src/gui/opengl/qopenglfunctions_1_4.h +++ b/src/gui/opengl/qopenglfunctions_1_4.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_4(); ~QOpenGLFunctions_1_4(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_1_5.h b/src/gui/opengl/qopenglfunctions_1_5.h index 18914a8957..d2f5311211 100644 --- a/src/gui/opengl/qopenglfunctions_1_5.h +++ b/src/gui/opengl/qopenglfunctions_1_5.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_1_5(); ~QOpenGLFunctions_1_5(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp index c175b13c5b..212723aa00 100644 --- a/src/gui/opengl/qopenglfunctions_2_0.cpp +++ b/src/gui/opengl/qopenglfunctions_2_0.cpp @@ -79,7 +79,7 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) { } diff --git a/src/gui/opengl/qopenglfunctions_2_0.h b/src/gui/opengl/qopenglfunctions_2_0.h index 74a91e0ff0..556597a9b3 100644 --- a/src/gui/opengl/qopenglfunctions_2_0.h +++ b/src/gui/opengl/qopenglfunctions_2_0.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_2_0(); ~QOpenGLFunctions_2_0(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp index 4e77efd121..b8b255014c 100644 --- a/src/gui/opengl/qopenglfunctions_2_1.cpp +++ b/src/gui/opengl/qopenglfunctions_2_1.cpp @@ -80,7 +80,7 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) { } diff --git a/src/gui/opengl/qopenglfunctions_2_1.h b/src/gui/opengl/qopenglfunctions_2_1.h index e9212640f7..f053222c71 100644 --- a/src/gui/opengl/qopenglfunctions_2_1.h +++ b/src/gui/opengl/qopenglfunctions_2_1.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_2_1(); ~QOpenGLFunctions_2_1(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp index 09e3ad09ef..4972c03b1e 100644 --- a/src/gui/opengl/qopenglfunctions_3_0.cpp +++ b/src/gui/opengl/qopenglfunctions_3_0.cpp @@ -81,8 +81,8 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) - , m_reserved_3_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) + , m_reserved_3_0_Deprecated(nullptr) { } diff --git a/src/gui/opengl/qopenglfunctions_3_0.h b/src/gui/opengl/qopenglfunctions_3_0.h index 1082d869d1..c592050c24 100644 --- a/src/gui/opengl/qopenglfunctions_3_0.h +++ b/src/gui/opengl/qopenglfunctions_3_0.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_0(); ~QOpenGLFunctions_3_0(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_1.h b/src/gui/opengl/qopenglfunctions_3_1.h index 2691dd29e7..3a8d3891f3 100644 --- a/src/gui/opengl/qopenglfunctions_3_1.h +++ b/src/gui/opengl/qopenglfunctions_3_1.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_1(); ~QOpenGLFunctions_3_1(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp index b90a123bfe..709f65edf8 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp @@ -83,8 +83,8 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) - , m_reserved_3_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) + , m_reserved_3_0_Deprecated(nullptr) { } diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h index 9f34190721..391e725953 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_2_Compatibility(); ~QOpenGLFunctions_3_2_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.h b/src/gui/opengl/qopenglfunctions_3_2_core.h index 2d5ee14bee..1eafb6f441 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_core.h +++ b/src/gui/opengl/qopenglfunctions_3_2_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_2_Core(); ~QOpenGLFunctions_3_2_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp index c585f0fc7c..b034391c86 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp @@ -84,7 +84,7 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) , d_3_3_Deprecated(0) { } diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h index a5c0cab63c..185dd5aab4 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_3_Compatibility(); ~QOpenGLFunctions_3_3_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.h b/src/gui/opengl/qopenglfunctions_3_3_core.h index 4f0132d959..47d54d717e 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_core.h +++ b/src/gui/opengl/qopenglfunctions_3_3_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_3_3_Core(); ~QOpenGLFunctions_3_3_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp index b5c423ef0c..4fe4526efc 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp @@ -85,7 +85,7 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) , d_3_3_Deprecated(0) { } diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h index 1fa5e8a361..c0e42443d3 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_0_Compatibility(); ~QOpenGLFunctions_4_0_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.h b/src/gui/opengl/qopenglfunctions_4_0_core.h index 8fd2af2d04..6cb55e86f7 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_core.h +++ b/src/gui/opengl/qopenglfunctions_4_0_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_0_Core(); ~QOpenGLFunctions_4_0_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp index 72c60c74b7..41ecb4672a 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp @@ -86,7 +86,7 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) , d_3_3_Deprecated(0) { } diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h index a284f8e6d3..bee169b50c 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_1_Compatibility(); ~QOpenGLFunctions_4_1_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.h b/src/gui/opengl/qopenglfunctions_4_1_core.h index d35db3c839..3a4fd0743b 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_core.h +++ b/src/gui/opengl/qopenglfunctions_4_1_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_1_Core(); ~QOpenGLFunctions_4_1_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp index 8398ef0948..fcc049c67b 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp @@ -87,7 +87,7 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) , d_3_3_Deprecated(0) { } diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h index 7b45859984..6726d5fc44 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_2_Compatibility(); ~QOpenGLFunctions_4_2_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.h b/src/gui/opengl/qopenglfunctions_4_2_core.h index 80bb33e7d8..a921329741 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_core.h +++ b/src/gui/opengl/qopenglfunctions_4_2_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_2_Core(); ~QOpenGLFunctions_4_2_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp index 19e67c6331..131ebc810f 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp @@ -88,7 +88,7 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility() , d_1_2_Deprecated(0) , d_1_3_Deprecated(0) , d_1_4_Deprecated(0) - , m_reserved_2_0_Deprecated(Q_NULLPTR) + , m_reserved_2_0_Deprecated(nullptr) , d_3_3_Deprecated(0) { } diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h index 515467a38d..b9d4eb1d6f 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_3_Compatibility(); ~QOpenGLFunctions_4_3_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.h b/src/gui/opengl/qopenglfunctions_4_3_core.h index 4a700c36d7..da552d64af 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_core.h +++ b/src/gui/opengl/qopenglfunctions_4_3_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_3_Core(); ~QOpenGLFunctions_4_3_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h index f2d640cdaf..7a05bd802d 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_4_Compatibility(); ~QOpenGLFunctions_4_4_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.h b/src/gui/opengl/qopenglfunctions_4_4_core.h index bcb7383a9e..6b29a9659b 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_core.h +++ b/src/gui/opengl/qopenglfunctions_4_4_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_4_Core(); ~QOpenGLFunctions_4_4_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h index b164538686..7a97085a85 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h +++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_5_Compatibility(); ~QOpenGLFunctions_4_5_Compatibility(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.h b/src/gui/opengl/qopenglfunctions_4_5_core.h index 0940d8cf61..bb1b17f7b1 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_core.h +++ b/src/gui/opengl/qopenglfunctions_4_5_core.h @@ -65,7 +65,7 @@ public: QOpenGLFunctions_4_5_Core(); ~QOpenGLFunctions_4_5_Core(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL 1.0 core functions void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/gui/opengl/qopenglfunctions_es2.h b/src/gui/opengl/qopenglfunctions_es2.h index 3b7d2806ea..851eb5951b 100644 --- a/src/gui/opengl/qopenglfunctions_es2.h +++ b/src/gui/opengl/qopenglfunctions_es2.h @@ -57,7 +57,7 @@ public: QOpenGLFunctions_ES2(); ~QOpenGLFunctions_ES2(); - bool initializeOpenGLFunctions() Q_DECL_OVERRIDE; + bool initializeOpenGLFunctions() override; // OpenGL ES2 core functions void glActiveTexture(GLenum texture); diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h index a2ed85c061..cbdbbb0c54 100644 --- a/src/gui/opengl/qopenglgradientcache_p.h +++ b/src/gui/opengl/qopenglgradientcache_p.h @@ -85,8 +85,8 @@ public: GLuint getBuffer(const QGradient &gradient, qreal opacity); inline int paletteSize() const { return 1024; } - void invalidateResource() Q_DECL_OVERRIDE; - void freeResource(QOpenGLContext *ctx) Q_DECL_OVERRIDE; + void invalidateResource() override; + void freeResource(QOpenGLContext *ctx) override; private: inline int maxCacheSize() const { return 60; } diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h index 679b3c0557..0541ce6168 100644 --- a/src/gui/opengl/qopenglpaintengine_p.h +++ b/src/gui/opengl/qopenglpaintengine_p.h @@ -116,37 +116,37 @@ public: QOpenGL2PaintEngineEx(); ~QOpenGL2PaintEngineEx(); - bool begin(QPaintDevice *device) Q_DECL_OVERRIDE; + bool begin(QPaintDevice *device) override; void ensureActive(); - bool end() Q_DECL_OVERRIDE; - - virtual void clipEnabledChanged() Q_DECL_OVERRIDE; - virtual void penChanged() Q_DECL_OVERRIDE; - virtual void brushChanged() Q_DECL_OVERRIDE; - virtual void brushOriginChanged() Q_DECL_OVERRIDE; - virtual void opacityChanged() Q_DECL_OVERRIDE; - virtual void compositionModeChanged() Q_DECL_OVERRIDE; - virtual void renderHintsChanged() Q_DECL_OVERRIDE; - virtual void transformChanged() Q_DECL_OVERRIDE; - - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE; + bool end() override; + + virtual void clipEnabledChanged() override; + virtual void penChanged() override; + virtual void brushChanged() override; + virtual void brushOriginChanged() override; + virtual void opacityChanged() override; + virtual void compositionModeChanged() override; + virtual void renderHintsChanged() override; + virtual void transformChanged() override; + + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, - QPainter::PixmapFragmentHints hints) Q_DECL_OVERRIDE; + QPainter::PixmapFragmentHints hints) override; virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; - virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE; - virtual void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE; - virtual void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE; - virtual void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE; + Qt::ImageConversionFlags flags = Qt::AutoColor) override; + virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) override; + virtual void fill(const QVectorPath &path, const QBrush &brush) override; + virtual void stroke(const QVectorPath &path, const QPen &pen) override; + virtual void clip(const QVectorPath &path, Qt::ClipOperation op) override; - virtual void drawStaticTextItem(QStaticTextItem *textItem) Q_DECL_OVERRIDE; + virtual void drawStaticTextItem(QStaticTextItem *textItem) override; bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr); - Type type() const Q_DECL_OVERRIDE { return OpenGL2; } + Type type() const override { return OpenGL2; } - virtual void setState(QPainterState *s) Q_DECL_OVERRIDE; - virtual QPainterState *createState(QPainterState *orig) const Q_DECL_OVERRIDE; + virtual void setState(QPainterState *s) override; + virtual QPainterState *createState(QPainterState *orig) const override; inline QOpenGL2PaintEngineState *state() { return static_cast<QOpenGL2PaintEngineState *>(QPaintEngineEx::state()); } @@ -154,16 +154,16 @@ public: return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state()); } - void beginNativePainting() Q_DECL_OVERRIDE; - void endNativePainting() Q_DECL_OVERRIDE; + void beginNativePainting() override; + void endNativePainting() override; void invalidateState(); void setRenderTextActive(bool); bool isNativePaintingActive() const; - bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE { return false; } - bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE; + bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const override { return false; } + bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const override; private: Q_DISABLE_COPY(QOpenGL2PaintEngineEx) @@ -265,7 +265,7 @@ public: void updateClipScissorTest(); void setScissor(const QRect &rect); void regenerateClip(); - void systemStateChanged() Q_DECL_OVERRIDE; + void systemStateChanged() override; void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true); void syncGlState(); diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h index fd4d82ecf9..84eb8d6956 100644 --- a/src/gui/opengl/qopenglshaderprogram.h +++ b/src/gui/opengl/qopenglshaderprogram.h @@ -79,7 +79,7 @@ public: }; Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) - explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = Q_NULLPTR); + explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr); virtual ~QOpenGLShader(); QOpenGLShader::ShaderType shaderType() const; @@ -96,7 +96,7 @@ public: GLuint shaderId() const; - static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = Q_NULLPTR); + static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = nullptr); private: friend class QOpenGLShaderProgram; @@ -114,7 +114,7 @@ class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject { Q_OBJECT public: - explicit QOpenGLShaderProgram(QObject *parent = Q_NULLPTR); + explicit QOpenGLShaderProgram(QObject *parent = nullptr); virtual ~QOpenGLShaderProgram(); bool addShader(QOpenGLShader *shader); @@ -306,7 +306,7 @@ public: void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count); void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count); - static bool hasOpenGLShaderPrograms(QOpenGLContext *context = Q_NULLPTR); + static bool hasOpenGLShaderPrograms(QOpenGLContext *context = nullptr); private Q_SLOTS: void shaderDestroyed(); diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 12d9b91603..c0c5283374 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -459,60 +459,60 @@ public: #if QT_DEPRECATED_SINCE(5, 3) QT_DEPRECATED void setData(int mipLevel, int layer, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, - void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + void *data, const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setData(int mipLevel, int layer, PixelFormat sourceFormat, PixelType sourceType, - void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + void *data, const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setData(int mipLevel, PixelFormat sourceFormat, PixelType sourceType, - void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + void *data, const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setData(PixelFormat sourceFormat, PixelType sourceType, - void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + void *data, const QOpenGLPixelTransferOptions * const options = nullptr); #endif // QT_DEPRECATED_SINCE(5, 3) void setData(int mipLevel, int layer, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, - const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const void *data, const QOpenGLPixelTransferOptions * const options = nullptr); void setData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, - const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const void *data, const QOpenGLPixelTransferOptions * const options = nullptr); void setData(int mipLevel, int layer, PixelFormat sourceFormat, PixelType sourceType, - const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const void *data, const QOpenGLPixelTransferOptions * const options = nullptr); void setData(int mipLevel, PixelFormat sourceFormat, PixelType sourceType, - const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const void *data, const QOpenGLPixelTransferOptions * const options = nullptr); void setData(PixelFormat sourceFormat, PixelType sourceType, - const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const void *data, const QOpenGLPixelTransferOptions * const options = nullptr); // Compressed data upload // ### Qt 6: remove the non-const void * overloads #if QT_DEPRECATED_SINCE(5, 3) QT_DEPRECATED void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, int dataSize, void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setCompressedData(int mipLevel, int layer, int dataSize, void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setCompressedData(int mipLevel, int dataSize, void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); QT_DEPRECATED void setCompressedData(int dataSize, void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); #endif // QT_DEPRECATED_SINCE(5, 3) void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, int dataSize, const void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); void setCompressedData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace, int dataSize, const void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); void setCompressedData(int mipLevel, int layer, int dataSize, const void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); void setCompressedData(int mipLevel, int dataSize, const void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); void setCompressedData(int dataSize, const void *data, - const QOpenGLPixelTransferOptions * const options = Q_NULLPTR); + const QOpenGLPixelTransferOptions * const options = nullptr); // Helpful overloads for setData void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h index 4a438c8d95..b9d7df91e3 100644 --- a/src/gui/opengl/qopengltexturecache_p.h +++ b/src/gui/opengl/qopengltexturecache_p.h @@ -82,8 +82,8 @@ public: void invalidate(qint64 key); - void invalidateResource() Q_DECL_OVERRIDE; - void freeResource(QOpenGLContext *ctx) Q_DECL_OVERRIDE; + void invalidateResource() override; + void freeResource(QOpenGLContext *ctx) override; private: GLuint bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureCache::BindOptions options); diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h index 6a1550dbed..0b7b5f6082 100644 --- a/src/gui/opengl/qopengltextureglyphcache_p.h +++ b/src/gui/opengl/qopengltextureglyphcache_p.h @@ -81,7 +81,7 @@ public: #endif } - void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE + void freeResource(QOpenGLContext *context) override { QOpenGLContext *ctx = context; #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG @@ -93,7 +93,7 @@ public: ctx->functions()->glDeleteTextures(1, &m_texture); } - void invalidateResource() Q_DECL_OVERRIDE + void invalidateResource() override { m_texture = 0; m_fbo = 0; @@ -113,12 +113,12 @@ public: QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix); ~QOpenGLTextureGlyphCache(); - virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE; - virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE; - virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE; - virtual int glyphPadding() const Q_DECL_OVERRIDE; - virtual int maxTextureWidth() const Q_DECL_OVERRIDE; - virtual int maxTextureHeight() const Q_DECL_OVERRIDE; + virtual void createTextureData(int width, int height) override; + virtual void resizeTextureData(int width, int height) override; + virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override; + virtual int glyphPadding() const override; + virtual int maxTextureWidth() const override; + virtual int maxTextureHeight() const override; inline GLuint texture() const { QOpenGLTextureGlyphCache *that = const_cast<QOpenGLTextureGlyphCache *>(this); diff --git a/src/gui/opengl/qopengltimerquery.h b/src/gui/opengl/qopengltimerquery.h index 7b9ab850e2..27da74a3fb 100644 --- a/src/gui/opengl/qopengltimerquery.h +++ b/src/gui/opengl/qopengltimerquery.h @@ -56,7 +56,7 @@ class Q_GUI_EXPORT QOpenGLTimerQuery : public QObject Q_OBJECT public: - explicit QOpenGLTimerQuery(QObject *parent = Q_NULLPTR); + explicit QOpenGLTimerQuery(QObject *parent = nullptr); ~QOpenGLTimerQuery(); bool create(); @@ -84,7 +84,7 @@ class Q_GUI_EXPORT QOpenGLTimeMonitor : public QObject Q_OBJECT public: - explicit QOpenGLTimeMonitor(QObject *parent = Q_NULLPTR); + explicit QOpenGLTimeMonitor(QObject *parent = nullptr); ~QOpenGLTimeMonitor(); void setSampleCount(int sampleCount); diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h index 63209cf392..3af1ed0466 100644 --- a/src/gui/opengl/qopenglversionfunctions.h +++ b/src/gui/opengl/qopenglversionfunctions.h @@ -193,7 +193,7 @@ class QAbstractOpenGLFunctionsPrivate { public: QAbstractOpenGLFunctionsPrivate() - : owningContext(Q_NULLPTR), + : owningContext(nullptr), initialized(false) {} diff --git a/src/gui/opengl/qopenglvertexarrayobject.h b/src/gui/opengl/qopenglvertexarrayobject.h index a8153ea40b..b81ae6a2a9 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.h +++ b/src/gui/opengl/qopenglvertexarrayobject.h @@ -56,7 +56,7 @@ class Q_GUI_EXPORT QOpenGLVertexArrayObject : public QObject Q_OBJECT public: - explicit QOpenGLVertexArrayObject(QObject* parent = Q_NULLPTR); + explicit QOpenGLVertexArrayObject(QObject* parent = nullptr); ~QOpenGLVertexArrayObject(); bool create(); diff --git a/src/gui/opengl/qopenglvertexarrayobject_p.h b/src/gui/opengl/qopenglvertexarrayobject_p.h index 937921765b..fd3a6f0f89 100644 --- a/src/gui/opengl/qopenglvertexarrayobject_p.h +++ b/src/gui/opengl/qopenglvertexarrayobject_p.h @@ -70,10 +70,10 @@ class QOpenGLVertexArrayObjectHelper public: explicit inline QOpenGLVertexArrayObjectHelper(QOpenGLContext *context) - : GenVertexArrays(Q_NULLPTR) - , DeleteVertexArrays(Q_NULLPTR) - , BindVertexArray(Q_NULLPTR) - , IsVertexArray(Q_NULLPTR) + : GenVertexArrays(nullptr) + , DeleteVertexArrays(nullptr) + , BindVertexArray(nullptr) + , IsVertexArray(nullptr) { qtInitializeVertexArrayObjectHelper(this, context); } diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 0c5ebcbda9..f7a9e9db59 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -129,10 +129,10 @@ public: void setGreenF(qreal green); void setBlueF(qreal blue); - void getRgb(int *r, int *g, int *b, int *a = Q_NULLPTR) const; + void getRgb(int *r, int *g, int *b, int *a = nullptr) const; void setRgb(int r, int g, int b, int a = 255); - void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = Q_NULLPTR) const; + void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = nullptr) const; void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0); QRgba64 rgba64() const Q_DECL_NOTHROW; @@ -156,10 +156,10 @@ public: qreal hsvSaturationF() const Q_DECL_NOTHROW; qreal valueF() const Q_DECL_NOTHROW; - void getHsv(int *h, int *s, int *v, int *a = Q_NULLPTR) const; + void getHsv(int *h, int *s, int *v, int *a = nullptr) const; void setHsv(int h, int s, int v, int a = 255); - void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = Q_NULLPTR) const; + void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = nullptr) const; void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0); int cyan() const Q_DECL_NOTHROW; @@ -172,10 +172,10 @@ public: qreal yellowF() const Q_DECL_NOTHROW; qreal blackF() const Q_DECL_NOTHROW; - void getCmyk(int *c, int *m, int *y, int *k, int *a = Q_NULLPTR); + void getCmyk(int *c, int *m, int *y, int *k, int *a = nullptr); void setCmyk(int c, int m, int y, int k, int a = 255); - void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = Q_NULLPTR); + void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = nullptr); void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); int hslHue() const Q_DECL_NOTHROW; // 0 <= hue < 360 @@ -186,10 +186,10 @@ public: qreal hslSaturationF() const Q_DECL_NOTHROW; qreal lightnessF() const Q_DECL_NOTHROW; - void getHsl(int *h, int *s, int *l, int *a = Q_NULLPTR) const; + void getHsl(int *h, int *s, int *l, int *a = nullptr) const; void setHsl(int h, int s, int l, int a = 255); - void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = Q_NULLPTR) const; + void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = nullptr) const; void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0); QColor toRgb() const Q_DECL_NOTHROW; diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 15e0ab5be1..74ecef767e 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -108,7 +108,7 @@ public: bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); } qreal determinant() const { return _m11*_m22 - _m12*_m21; } - Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = Q_NULLPTR) const; + Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = nullptr) const; bool operator==(const QMatrix &) const; bool operator!=(const QMatrix &) const; diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 40f5347b26..fb5dfe2318 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -67,48 +67,48 @@ class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine public: QBlitterPaintEngine(QBlittablePlatformPixmap *p); - virtual QPaintEngine::Type type() const Q_DECL_OVERRIDE + virtual QPaintEngine::Type type() const override { return Blitter; } - virtual bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE; - virtual bool end() Q_DECL_OVERRIDE; + virtual bool begin(QPaintDevice *pdev) override; + virtual bool end() override; // Call down into QBlittable - void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE; - void fillRect(const QRectF &rect, const QBrush &brush) Q_DECL_OVERRIDE; - void fillRect(const QRectF &rect, const QColor &color) Q_DECL_OVERRIDE; - void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE; - void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; - void drawPixmap(const QPointF &p, const QPixmap &pm) Q_DECL_OVERRIDE; - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE; + void fill(const QVectorPath &path, const QBrush &brush) override; + void fillRect(const QRectF &rect, const QBrush &brush) override; + void fillRect(const QRectF &rect, const QColor &color) override; + void drawRects(const QRect *rects, int rectCount) override; + void drawRects(const QRectF *rects, int rectCount) override; + void drawPixmap(const QPointF &p, const QPixmap &pm) override; + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; // State tracking - void setState(QPainterState *s) Q_DECL_OVERRIDE; - virtual void clipEnabledChanged() Q_DECL_OVERRIDE; - virtual void penChanged() Q_DECL_OVERRIDE; - virtual void brushChanged() Q_DECL_OVERRIDE; - virtual void opacityChanged() Q_DECL_OVERRIDE; - virtual void compositionModeChanged() Q_DECL_OVERRIDE; - virtual void renderHintsChanged() Q_DECL_OVERRIDE; - virtual void transformChanged() Q_DECL_OVERRIDE; + void setState(QPainterState *s) override; + virtual void clipEnabledChanged() override; + virtual void penChanged() override; + virtual void brushChanged() override; + virtual void opacityChanged() override; + virtual void compositionModeChanged() override; + virtual void renderHintsChanged() override; + virtual void transformChanged() override; // Override to lock the QBlittable before using raster - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - void fillPath(const QPainterPath &path, QSpanData *fillData) Q_DECL_OVERRIDE; - void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE; - void drawImage(const QPointF &p, const QImage &img) Q_DECL_OVERRIDE; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override; + void fillPath(const QPainterPath &path, QSpanData *fillData) override; + void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawEllipse(const QRectF &rect) override; + void drawImage(const QPointF &p, const QImage &img) override; void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; - void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) Q_DECL_OVERRIDE; - void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE; - void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; - void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE; - void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE; - void drawStaticTextItem(QStaticTextItem *) Q_DECL_OVERRIDE; + Qt::ImageConversionFlags flags = Qt::AutoColor) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; + void drawPoints(const QPointF *points, int pointCount) override; + void drawPoints(const QPoint *points, int pointCount) override; + void stroke(const QVectorPath &path, const QPen &pen) override; + void drawStaticTextItem(QStaticTextItem *) override; bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, - QFontEngine *fontEngine) Q_DECL_OVERRIDE; + QFontEngine *fontEngine) override; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index e2e0f821e3..8c6f668d9d 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -135,20 +135,20 @@ public: QRasterPaintEngine(QPaintDevice *device); ~QRasterPaintEngine(); - bool begin(QPaintDevice *device) Q_DECL_OVERRIDE; - bool end() Q_DECL_OVERRIDE; - - void penChanged() Q_DECL_OVERRIDE; - void brushChanged() Q_DECL_OVERRIDE; - void brushOriginChanged() Q_DECL_OVERRIDE; - void opacityChanged() Q_DECL_OVERRIDE; - void compositionModeChanged() Q_DECL_OVERRIDE; - void renderHintsChanged() Q_DECL_OVERRIDE; - void transformChanged() Q_DECL_OVERRIDE; - void clipEnabledChanged() Q_DECL_OVERRIDE; - - void setState(QPainterState *s) Q_DECL_OVERRIDE; - QPainterState *createState(QPainterState *orig) const Q_DECL_OVERRIDE; + bool begin(QPaintDevice *device) override; + bool end() override; + + void penChanged() override; + void brushChanged() override; + void brushOriginChanged() override; + void opacityChanged() override; + void compositionModeChanged() override; + void renderHintsChanged() override; + void transformChanged() override; + void clipEnabledChanged() override; + + void setState(QPainterState *s) override; + QPainterState *createState(QPainterState *orig) const override; inline QRasterPaintEngineState *state() { return static_cast<QRasterPaintEngineState *>(QPaintEngineEx::state()); } @@ -164,40 +164,40 @@ public: virtual void fillPath(const QPainterPath &path, QSpanData *fillData); virtual void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override; - void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE; + void drawEllipse(const QRectF &rect) override; - void fillRect(const QRectF &rect, const QBrush &brush) Q_DECL_OVERRIDE; - void fillRect(const QRectF &rect, const QColor &color) Q_DECL_OVERRIDE; + void fillRect(const QRectF &rect, const QBrush &brush) override; + void fillRect(const QRectF &rect, const QColor &color) override; - void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE; - void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; + void drawRects(const QRect *rects, int rectCount) override; + void drawRects(const QRectF *rects, int rectCount) override; - void drawPixmap(const QPointF &p, const QPixmap &pm) Q_DECL_OVERRIDE; - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE; - void drawImage(const QPointF &p, const QImage &img) Q_DECL_OVERRIDE; + void drawPixmap(const QPointF &p, const QPixmap &pm) override; + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; + void drawImage(const QPointF &p, const QImage &img) override; void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; - void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) Q_DECL_OVERRIDE; - void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE; + Qt::ImageConversionFlags flags = Qt::AutoColor) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; - void drawLines(const QLine *line, int lineCount) Q_DECL_OVERRIDE; - void drawLines(const QLineF *line, int lineCount) Q_DECL_OVERRIDE; + void drawLines(const QLine *line, int lineCount) override; + void drawLines(const QLineF *line, int lineCount) override; - void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; - void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE; + void drawPoints(const QPointF *points, int pointCount) override; + void drawPoints(const QPoint *points, int pointCount) override; - void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE; - void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE; + void stroke(const QVectorPath &path, const QPen &pen) override; + void fill(const QVectorPath &path, const QBrush &brush) override; - void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE; - void clip(const QRect &rect, Qt::ClipOperation op) Q_DECL_OVERRIDE; - void clip(const QRegion ®ion, Qt::ClipOperation op) Q_DECL_OVERRIDE; + void clip(const QVectorPath &path, Qt::ClipOperation op) override; + void clip(const QRect &rect, Qt::ClipOperation op) override; + void clip(const QRegion ®ion, Qt::ClipOperation op) override; inline const QClipData *clipData() const; - void drawStaticTextItem(QStaticTextItem *textItem) Q_DECL_OVERRIDE; + void drawStaticTextItem(QStaticTextItem *textItem) override; virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine); @@ -227,12 +227,12 @@ public: QRasterBuffer *rasterBuffer(); void alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h, bool useGammaCorrection); - Type type() const Q_DECL_OVERRIDE { return Raster; } + Type type() const override { return Raster; } - QPoint coordinateOffset() const Q_DECL_OVERRIDE; + QPoint coordinateOffset() const override; - bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const Q_DECL_OVERRIDE; - bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const Q_DECL_OVERRIDE; + bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const override; + bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const override; protected: QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *); diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 7c2c98140f..b2f8b64029 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -103,36 +103,36 @@ public: virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); - virtual void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE; - virtual void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; + virtual void drawRects(const QRect *rects, int rectCount) override; + virtual void drawRects(const QRectF *rects, int rectCount) override; - virtual void drawLines(const QLine *lines, int lineCount) Q_DECL_OVERRIDE; - virtual void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE; + virtual void drawLines(const QLine *lines, int lineCount) override; + virtual void drawLines(const QLineF *lines, int lineCount) override; - virtual void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE; - virtual void drawEllipse(const QRect &r) Q_DECL_OVERRIDE; + virtual void drawEllipse(const QRectF &r) override; + virtual void drawEllipse(const QRect &r) override; - virtual void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE; + virtual void drawPath(const QPainterPath &path) override; - virtual void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; - virtual void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE; + virtual void drawPoints(const QPointF *points, int pointCount) override; + virtual void drawPoints(const QPoint *points, int pointCount) override; - virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; + virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override; - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE = 0; + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override = 0; virtual void drawPixmap(const QPointF &pos, const QPixmap &pm); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE = 0; + Qt::ImageConversionFlags flags = Qt::AutoColor) override = 0; virtual void drawImage(const QPointF &pos, const QImage &image); - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE; + virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override; virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags<QPainter::PixmapFragmentHint> hints); - virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE; + virtual void updateState(const QPaintEngineState &state) override; virtual void drawStaticTextItem(QStaticTextItem *); diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 64d15d5296..12a9c720a8 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -416,9 +416,9 @@ public: void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding); - void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = Q_NULLPTR); - void drawText(const QRect &r, int flags, const QString &text, QRect *br = Q_NULLPTR); - inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = Q_NULLPTR); + void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr); + void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr); + inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr); void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption()); @@ -461,7 +461,7 @@ public: static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement, const QPoint& offset = QPoint()); - static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = Q_NULLPTR); + static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = nullptr); static void restoreRedirected(const QPaintDevice *device); void beginNativePainting(); diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index f5bb4e17a8..5a909f2ede 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -186,28 +186,28 @@ public: void setPdfVersion(PdfVersion version); // reimplementations QPaintEngine - bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE; - bool end() Q_DECL_OVERRIDE; + bool begin(QPaintDevice *pdev) override; + bool end() override; - void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; - void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE; - void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - void drawPath (const QPainterPath & path) Q_DECL_OVERRIDE; + void drawPoints(const QPointF *points, int pointCount) override; + void drawLines(const QLineF *lines, int lineCount) override; + void drawRects(const QRectF *rects, int rectCount) override; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawPath (const QPainterPath & path) override; - void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; - void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr) Q_DECL_OVERRIDE; + void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr) override; void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; - void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point) Q_DECL_OVERRIDE; + Qt::ImageConversionFlags flags = Qt::AutoColor) override; + void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point) override; void drawHyperlink(const QRectF &r, const QUrl &url); - void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE; + void updateState(const QPaintEngineState &state) override; int metric(QPaintDevice::PaintDeviceMetric metricType) const; - Type type() const Q_DECL_OVERRIDE; + Type type() const override; // end reimplementations QPaintEngine // Printer stuff... diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 5af465edeb..2f24c7efcb 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -79,7 +79,7 @@ public: virtual ~QPdfPagedPaintDevicePrivate() {} - bool setPageLayout(const QPageLayout &newPageLayout) Q_DECL_OVERRIDE + bool setPageLayout(const QPageLayout &newPageLayout) override { // Try to set the paint engine page layout pd->engine->setPageLayout(newPageLayout); @@ -88,7 +88,7 @@ public: return m_pageLayout.isEquivalentTo(newPageLayout); } - bool setPageSize(const QPageSize &pageSize) Q_DECL_OVERRIDE + bool setPageSize(const QPageSize &pageSize) override { // Try to set the paint engine page size pd->engine->setPageSize(pageSize); @@ -97,7 +97,7 @@ public: return m_pageLayout.pageSize().isEquivalentTo(pageSize); } - bool setPageOrientation(QPageLayout::Orientation orientation) Q_DECL_OVERRIDE + bool setPageOrientation(QPageLayout::Orientation orientation) override { // Set the print engine value pd->engine->setPageOrientation(orientation); @@ -106,12 +106,12 @@ public: return m_pageLayout.orientation() == orientation; } - bool setPageMargins(const QMarginsF &margins) Q_DECL_OVERRIDE + bool setPageMargins(const QMarginsF &margins) override { return setPageMargins(margins, pageLayout().units()); } - bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) Q_DECL_OVERRIDE + bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override { // Try to set engine margins pd->engine->setPageMargins(margins, units); @@ -120,7 +120,7 @@ public: return m_pageLayout.margins() == margins && m_pageLayout.units() == units; } - QPageLayout pageLayout() const Q_DECL_OVERRIDE + QPageLayout pageLayout() const override { return pd->engine->pageLayout(); } diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index d8d99ba800..03abfb3d7d 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -72,7 +72,7 @@ public: QPen &operator=(const QPen &pen) Q_DECL_NOTHROW; #ifdef Q_COMPILER_RVALUE_REFS QPen(QPen &&other) Q_DECL_NOTHROW - : d(other.d) { other.d = Q_NULLPTR; } + : d(other.d) { other.d = nullptr; } QPen &operator=(QPen &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 8ab22beb31..09c23fdfa1 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -704,7 +704,7 @@ void QPlatformBackingStore::endPaint() */ QPlatformGraphicsBuffer *QPlatformBackingStore::graphicsBuffer() const { - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 3fb6f925b3..1b8aae16e1 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -2281,7 +2281,14 @@ static void miRegionOp(QRegionPrivate &dest, dest.vectorize(); - QVector<QRect> oldRects = dest.rects; + /* + * The following calls are going to detach dest.rects. Since dest might be + * aliasing *reg1 and/or *reg2, and we could have active iterators on + * reg1->rects and reg2->rects (if the regions have more than 1 rectangle), + * take a copy of dest.rects to keep those iteractors valid. + */ + const QVector<QRect> destRectsCopy = dest.rects; + Q_UNUSED(destRectsCopy); dest.numRects = 0; @@ -3613,7 +3620,7 @@ static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock, } if (rowSize) { - QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : Q_NULLPTR); + QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : nullptr); if (!next || next->y() != pts[0].y()) { flushRow(row.data(), pts[0].y(), rowSize, reg, &lastRow, &extendTo, &needsExtend); diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 25253b496a..3da28872b1 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -169,9 +169,9 @@ public: : QTextureGlyphCache(format, matrix) { } ~QImageTextureGlyphCache(); - virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE; - virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE; - virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE; + virtual void createTextureData(int width, int height) override; + virtual void resizeTextureData(int width, int height) override; + virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override; inline const QImage &image() const { return m_image; } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 7f06915444..7a53c44bc4 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -265,7 +265,7 @@ QTransform::QTransform() , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxNone) - , d(Q_NULLPTR) + , d(nullptr) { } @@ -284,7 +284,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13, , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) , m_dirty(TxProject) - , d(Q_NULLPTR) + , d(nullptr) { } @@ -301,7 +301,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21, , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) - , d(Q_NULLPTR) + , d(nullptr) { } @@ -317,7 +317,7 @@ QTransform::QTransform(const QMatrix &mtx) m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) - , d(Q_NULLPTR) + , d(nullptr) { } diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 06ae611861..79835b36e2 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -116,7 +116,7 @@ public: qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33); - Q_REQUIRED_RESULT QTransform inverted(bool *invertible = Q_NULLPTR) const; + Q_REQUIRED_RESULT QTransform inverted(bool *invertible = nullptr) const; Q_REQUIRED_RESULT QTransform adjoint() const; Q_REQUIRED_RESULT QTransform transposed() const; @@ -173,7 +173,7 @@ private: , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) , m_dirty(TxProject) - , d(Q_NULLPTR) + , d(nullptr) { } inline QTransform(bool) @@ -181,7 +181,7 @@ private: , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxNone) - , d(Q_NULLPTR) + , d(nullptr) { } inline TransformationType inline_type() const; diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 438ad6e70b..8fea27f772 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -100,7 +100,7 @@ public: QTextDocument *document() const; void registerHandler(int objectType, QObject *component); - void unregisterHandler(int objectType, QObject *component = Q_NULLPTR); + void unregisterHandler(int objectType, QObject *component = nullptr); QTextObjectInterface *handlerForObject(int objectType) const; Q_SIGNALS: diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index f0a5053196..0c72ac3019 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2837,7 +2837,7 @@ QFontEngine *QFontCache::findEngine(const Key &key) end = engineCache.end(); if (it == end) return 0; - Q_ASSERT(it.value().data != Q_NULLPTR); + Q_ASSERT(it.value().data != nullptr); Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi)); // found... update the hitcount and timestamp @@ -2860,7 +2860,7 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value) void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti) { - Q_ASSERT(engine != Q_NULLPTR); + Q_ASSERT(engine != nullptr); Q_ASSERT(key.multi == (engine->type() == QFontEngine::Multi)); #ifdef QFONTCACHE_DEBUG diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 9e5d0b4329..350ba7ce3c 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -282,7 +282,7 @@ public: private: void increaseCost(uint cost); void decreaseCost(uint cost); - void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *event) override; void decreaseCache(); static const uint min_cost; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 2cc071d67b..afbf783c3a 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2685,7 +2685,15 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed); } if (index >= 0) { - engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); + QFontDef fontDef = request; + + // Don't pass empty family names to the platform font database, since it will then invoke its own matching + // and we will be out of sync with the matched font. + if (fontDef.family.isEmpty()) + fontDef.family = desc.family->name; + + engine = loadEngine(script, fontDef, desc.family, desc.foundry, desc.style, desc.size); + if (engine) initFontDef(desc, request, &engine->fontDef, multi); else @@ -2775,7 +2783,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (d->engineData->engines[script]) return; - QFontEngine *fe = Q_NULLPTR; + QFontEngine *fe = nullptr; req.fallBackFamilies = fallBackFamilies; if (!req.fallBackFamilies.isEmpty()) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index e4f9b8b9d4..5be8745b15 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1080,7 +1080,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat { const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context); if (caches == m_glyphCaches.cend()) - return Q_NULLPTR; + return nullptr; for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) { QFontEngineGlyphCache *cache = it->cache.data(); @@ -1088,7 +1088,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat return cache; } - return Q_NULLPTR; + return nullptr; } static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) @@ -1234,7 +1234,7 @@ int QFontEngine::glyphCount() const Qt::HANDLE QFontEngine::handle() const { - return Q_NULLPTR; + return nullptr; } const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 1ae2e86a93..a411e9ce4c 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -411,27 +411,27 @@ public: QFontEngineBox(int size); ~QFontEngineBox(); - virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; + virtual glyph_t glyphIndex(uint ucs4) const override; + virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; + virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override; void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si); - virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override; - virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - virtual glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE; - virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; + virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + virtual glyph_metrics_t boundingBox(glyph_t glyph) override; + virtual QFontEngine *cloneWithSize(qreal pixelSize) const override; - virtual QFixed ascent() const Q_DECL_OVERRIDE; - virtual QFixed capHeight() const Q_DECL_OVERRIDE; - virtual QFixed descent() const Q_DECL_OVERRIDE; - virtual QFixed leading() const Q_DECL_OVERRIDE; - virtual qreal maxCharWidth() const Q_DECL_OVERRIDE; - virtual qreal minLeftBearing() const Q_DECL_OVERRIDE { return 0; } - virtual qreal minRightBearing() const Q_DECL_OVERRIDE { return 0; } - virtual QImage alphaMapForGlyph(glyph_t) Q_DECL_OVERRIDE; + virtual QFixed ascent() const override; + virtual QFixed capHeight() const override; + virtual QFixed descent() const override; + virtual QFixed leading() const override; + virtual qreal maxCharWidth() const override; + virtual qreal minLeftBearing() const override { return 0; } + virtual qreal minRightBearing() const override { return 0; } + virtual QImage alphaMapForGlyph(glyph_t) override; - virtual bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE; + virtual bool canRender(const QChar *string, int len) const override; inline int size() const { return _size; } @@ -449,36 +449,36 @@ public: explicit QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies = QStringList()); ~QFontEngineMulti(); - virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - - virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - virtual glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE; - - virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; - virtual void doKerning(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; - virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; - virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE; - - virtual QFixed ascent() const Q_DECL_OVERRIDE; - virtual QFixed capHeight() const Q_DECL_OVERRIDE; - virtual QFixed descent() const Q_DECL_OVERRIDE; - virtual QFixed leading() const Q_DECL_OVERRIDE; - virtual QFixed xHeight() const Q_DECL_OVERRIDE; - virtual QFixed averageCharWidth() const Q_DECL_OVERRIDE; - virtual QImage alphaMapForGlyph(glyph_t) Q_DECL_OVERRIDE; - virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE; - virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) Q_DECL_OVERRIDE; - virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - - virtual QFixed lineThickness() const Q_DECL_OVERRIDE; - virtual QFixed underlinePosition() const Q_DECL_OVERRIDE; - virtual qreal maxCharWidth() const Q_DECL_OVERRIDE; - virtual qreal minLeftBearing() const Q_DECL_OVERRIDE; - virtual qreal minRightBearing() const Q_DECL_OVERRIDE; - - virtual bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE; + virtual glyph_t glyphIndex(uint ucs4) const override; + virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; + + virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + virtual glyph_metrics_t boundingBox(glyph_t glyph) override; + + virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override; + virtual void doKerning(QGlyphLayout *, ShaperFlags) const override; + virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) override; + virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override; + + virtual QFixed ascent() const override; + virtual QFixed capHeight() const override; + virtual QFixed descent() const override; + virtual QFixed leading() const override; + virtual QFixed xHeight() const override; + virtual QFixed averageCharWidth() const override; + virtual QImage alphaMapForGlyph(glyph_t) override; + virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override; + virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) override; + virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; + virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; + + virtual QFixed lineThickness() const override; + virtual QFixed underlinePosition() const override; + virtual qreal maxCharWidth() const override; + virtual qreal minLeftBearing() const override; + virtual qreal minRightBearing() const override; + + virtual bool canRender(const QChar *string, int len) const override; inline int fallbackFamilyCount() const { return m_fallbackFamilies.size(); } inline QString fallbackFamilyAt(int at) const { return m_fallbackFamilies.at(at); } diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h index e5c38ffbaf..b2dc620ad1 100644 --- a/src/gui/text/qfontengine_qpf2_p.h +++ b/src/gui/text/qfontengine_qpf2_p.h @@ -158,30 +158,30 @@ public: QFontEngineQPF2(const QFontDef &def, const QByteArray &data); ~QFontEngineQPF2(); - FaceId faceId() const Q_DECL_OVERRIDE { return face_id; } - bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE; - - virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; - - void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t t) Q_DECL_OVERRIDE; - - glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE; - - QFixed ascent() const Q_DECL_OVERRIDE; - QFixed capHeight() const Q_DECL_OVERRIDE; - QFixed descent() const Q_DECL_OVERRIDE; - QFixed leading() const Q_DECL_OVERRIDE; - qreal maxCharWidth() const Q_DECL_OVERRIDE; - qreal minLeftBearing() const Q_DECL_OVERRIDE; - qreal minRightBearing() const Q_DECL_OVERRIDE; - QFixed underlinePosition() const Q_DECL_OVERRIDE; - QFixed lineThickness() const Q_DECL_OVERRIDE; - - virtual int glyphCount() const Q_DECL_OVERRIDE { return glyphMapEntries; } + FaceId faceId() const override { return face_id; } + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override; + + virtual glyph_t glyphIndex(uint ucs4) const override; + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; + void recalcAdvances(QGlyphLayout *, ShaperFlags) const override; + + void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override; + QImage alphaMapForGlyph(glyph_t t) override; + + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + glyph_metrics_t boundingBox(glyph_t glyph) override; + + QFixed ascent() const override; + QFixed capHeight() const override; + QFixed descent() const override; + QFixed leading() const override; + qreal maxCharWidth() const override; + qreal minLeftBearing() const override; + qreal minRightBearing() const override; + QFixed underlinePosition() const override; + QFixed lineThickness() const override; + + virtual int glyphCount() const override { return glyphMapEntries; } bool isValid() const; diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 3eac309092..25e708be29 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -101,11 +101,11 @@ public: QRect boundingRect(QChar) const; QRect boundingRect(const QString &text) const; - QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = nullptr) const; inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, - int tabstops = 0, int *tabarray = Q_NULLPTR) const + int tabstops = 0, int *tabarray = nullptr) const { return boundingRect(QRect(x, y, w, h), flags, text, tabstops, tabarray); } - QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const; QRect tightBoundingRect(const QString &text) const; @@ -170,8 +170,8 @@ public: QRectF boundingRect(const QString &string) const; QRectF boundingRect(QChar) const; - QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = Q_NULLPTR) const; - QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = nullptr) const; + QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const; QRectF tightBoundingRect(const QString &text) const; diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index dbc2e6e558..d6f97547c4 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -439,7 +439,7 @@ namespace { { } - virtual void updateState(const QPaintEngineState &newState) Q_DECL_OVERRIDE + virtual void updateState(const QPaintEngineState &newState) override { if (newState.state() & QPaintEngine::DirtyPen && newState.pen().color() != m_currentColor) { @@ -448,7 +448,7 @@ namespace { } } - virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) Q_DECL_OVERRIDE + virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) override { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); @@ -484,15 +484,15 @@ namespace { m_items.append(currentItem); } - virtual void drawPolygon(const QPointF *, int , PolygonDrawMode ) Q_DECL_OVERRIDE + virtual void drawPolygon(const QPointF *, int , PolygonDrawMode ) override { /* intentionally empty */ } - virtual bool begin(QPaintDevice *) Q_DECL_OVERRIDE { return true; } - virtual bool end() Q_DECL_OVERRIDE { return true; } - virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) Q_DECL_OVERRIDE {} - virtual Type type() const Q_DECL_OVERRIDE + virtual bool begin(QPaintDevice *) override { return true; } + virtual bool end() override { return true; } + virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} + virtual Type type() const override { return User; } @@ -537,7 +537,7 @@ namespace { delete m_paintEngine; } - int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE + int metric(PaintDeviceMetric m) const override { int val; switch (m) { @@ -574,7 +574,7 @@ namespace { return val; } - virtual QPaintEngine *paintEngine() const Q_DECL_OVERRIDE + virtual QPaintEngine *paintEngine() const override { return m_paintEngine; } diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index c2761a39b9..41c578fc1b 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -116,11 +116,11 @@ class Q_GUI_EXPORT QTextDocument : public QObject Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged) public: - explicit QTextDocument(QObject *parent = Q_NULLPTR); - explicit QTextDocument(const QString &text, QObject *parent = Q_NULLPTR); + explicit QTextDocument(QObject *parent = nullptr); + explicit QTextDocument(const QString &text, QObject *parent = nullptr); ~QTextDocument(); - QTextDocument *clone(QObject *parent = Q_NULLPTR) const; + QTextDocument *clone(QObject *parent = nullptr) const; bool isEmpty() const; virtual void clear(); diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index 710c49628e..2054ebaa35 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -73,11 +73,11 @@ public: explicit QTextDocumentLayout(QTextDocument *doc); // from the abstract layout - void draw(QPainter *painter, const PaintContext &context) Q_DECL_OVERRIDE; - int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const Q_DECL_OVERRIDE; + void draw(QPainter *painter, const PaintContext &context) override; + int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const override; - int pageCount() const Q_DECL_OVERRIDE; - QSizeF documentSize() const Q_DECL_OVERRIDE; + int pageCount() const override; + QSizeF documentSize() const override; void setCursorWidth(int width); int cursorWidth() const; @@ -88,8 +88,8 @@ public: // internal for QTextEdit's NoWrap mode void setViewport(const QRectF &viewport); - virtual QRectF frameBoundingRect(QTextFrame *frame) const Q_DECL_OVERRIDE; - virtual QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE; + virtual QRectF frameBoundingRect(QTextFrame *frame) const override; + virtual QRectF blockBoundingRect(const QTextBlock &block) const override; QRectF tableBoundingRect(QTextTable *table) const; QRectF tableCellBoundingRect(QTextTable *table, const QTextTableCell &cell) const; @@ -104,12 +104,12 @@ public: bool contentHasAlignment() const; protected: - void documentChanged(int from, int oldLength, int length) Q_DECL_OVERRIDE; - void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE; - void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE; + void documentChanged(int from, int oldLength, int length) override; + void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) override; + void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) override; void drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item, - int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE; - virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE; + int posInDocument, const QTextFormat &format) override; + virtual void timerEvent(QTimerEvent *e) override; private: QRectF doLayout(int from, int oldLength, int length); void layoutFinished(); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index faddb3552d..71f02376ac 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1242,7 +1242,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, { HB_TAG('h','l','i','g'), !dontLigate, 0, uint(-1) } }; const int num_features = dontLigate ? 5 : 1; - const char *const *shaper_list = Q_NULLPTR; + const char *const *shaper_list = nullptr; #if defined(Q_OS_DARWIN) // What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines // - specifically functions in hb-coretext.cc would run into undefined behavior with data @@ -1252,7 +1252,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, "graphite2", "ot", "fallback", - Q_NULLPTR + nullptr }; shaper_list = s_shaper_list_without_coretext; } diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index be10efad8d..9154182df1 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1708,14 +1708,14 @@ public: inline QTextHtmlStyleSelector(const QTextHtmlParser *parser) : parser(parser) { nameCaseSensitivity = Qt::CaseInsensitive; } - virtual QStringList nodeNames(NodePtr node) const Q_DECL_OVERRIDE; - virtual QString attribute(NodePtr node, const QString &name) const Q_DECL_OVERRIDE; - virtual bool hasAttributes(NodePtr node) const Q_DECL_OVERRIDE; - virtual bool isNullNode(NodePtr node) const Q_DECL_OVERRIDE; - virtual NodePtr parentNode(NodePtr node) const Q_DECL_OVERRIDE; - virtual NodePtr previousSiblingNode(NodePtr node) const Q_DECL_OVERRIDE; - virtual NodePtr duplicateNode(NodePtr node) const Q_DECL_OVERRIDE; - virtual void freeNode(NodePtr node) const Q_DECL_OVERRIDE; + virtual QStringList nodeNames(NodePtr node) const override; + virtual QString attribute(NodePtr node, const QString &name) const override; + virtual bool hasAttributes(NodePtr node) const override; + virtual bool isNullNode(NodePtr node) const override; + virtual NodePtr parentNode(NodePtr node) const override; + virtual NodePtr previousSiblingNode(NodePtr node) const override; + virtual NodePtr duplicateNode(NodePtr node) const override; + virtual void freeNode(NodePtr node) const override; private: const QTextHtmlParser *parser; diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h index a22c91ecbf..339ef0af4f 100644 --- a/src/gui/text/qtextimagehandler_p.h +++ b/src/gui/text/qtextimagehandler_p.h @@ -67,8 +67,8 @@ class Q_GUI_EXPORT QTextImageHandler : public QObject, public: explicit QTextImageHandler(QObject *parent = 0); - virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE; - virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE; + virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) override; + virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) override; QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat); }; diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 980a099b05..67bc75a6b8 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -69,7 +69,7 @@ class Q_GUI_EXPORT QTextInlineObject { public: QTextInlineObject(int i, QTextEngine *e) : itm(i), eng(e) {} - inline QTextInlineObject() : itm(0), eng(Q_NULLPTR) {} + inline QTextInlineObject() : itm(0), eng(nullptr) {} inline bool isValid() const { return eng; } QRectF rect() const; @@ -107,7 +107,7 @@ public: // does itemization QTextLayout(); QTextLayout(const QString& text); - QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = Q_NULLPTR); + QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = nullptr); QTextLayout(const QTextBlock &b); ~QTextLayout(); @@ -210,7 +210,7 @@ Q_DECLARE_TYPEINFO(QTextLayout::FormatRange, Q_RELOCATABLE_TYPE); class Q_GUI_EXPORT QTextLine { public: - inline QTextLine() : index(0), eng(Q_NULLPTR) {} + inline QTextLine() : index(0), eng(nullptr) {} inline bool isValid() const { return eng; } QRectF rect() const; @@ -255,7 +255,7 @@ public: int lineNumber() const { return index; } - void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = Q_NULLPTR) const; + void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = nullptr) const; #if !defined(QT_NO_RAWFONT) QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const; diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index a5030de112..7e4efa28f8 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -203,7 +203,7 @@ class Q_GUI_EXPORT QTextBlock friend class QSyntaxHighlighter; public: inline QTextBlock(QTextDocumentPrivate *priv, int b) : p(priv), n(b) {} - inline QTextBlock() : p(Q_NULLPTR), n(0) {} + inline QTextBlock() : p(nullptr), n(0) {} inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {} inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; } @@ -260,7 +260,7 @@ public: friend class QTextBlock; iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {} public: - iterator() : p(Q_NULLPTR), b(0), e(0), n(0) {} + iterator() : p(nullptr), b(0), e(0), n(0) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {} #endif @@ -304,7 +304,7 @@ class Q_GUI_EXPORT QTextFragment { public: inline QTextFragment(const QTextDocumentPrivate *priv, int f, int fe) : p(priv), n(f), ne(fe) {} - inline QTextFragment() : p(Q_NULLPTR), n(0), ne(0) {} + inline QTextFragment() : p(nullptr), n(0), ne(0) {} inline QTextFragment(const QTextFragment &o) : p(o.p), n(o.n), ne(o.ne) {} inline QTextFragment &operator=(const QTextFragment &o) { p = o.p; n = o.n; ne = o.ne; return *this; } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 3dd19a6eda..30f5bc1051 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -94,7 +94,7 @@ public: if (contentStream) contentStream->close(); } - virtual void addFile(const QString &, const QString &, const QByteArray &) Q_DECL_OVERRIDE + virtual void addFile(const QString &, const QString &, const QByteArray &) override { // we ignore this... } @@ -137,7 +137,7 @@ public: zip.close(); } - virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) Q_DECL_OVERRIDE + virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) override { zip.addFile(fileName, bytes); addFile(fileName, mimeType); diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h index ee8e974396..156b091b05 100644 --- a/src/gui/text/qtexttable.h +++ b/src/gui/text/qtexttable.h @@ -54,7 +54,7 @@ class QTextTablePrivate; class Q_GUI_EXPORT QTextTableCell { public: - QTextTableCell() : table(Q_NULLPTR) {} + QTextTableCell() : table(nullptr) {} ~QTextTableCell() {} QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {} QTextTableCell &operator=(const QTextTableCell &o) @@ -69,7 +69,7 @@ public: int rowSpan() const; int columnSpan() const; - inline bool isValid() const { return table != Q_NULLPTR; } + inline bool isValid() const { return table != nullptr; } QTextCursor firstCursorPosition() const; QTextCursor lastCursorPosition() const; diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h index 848537272d..c969e1d5bc 100644 --- a/src/gui/text/qtexttable_p.h +++ b/src/gui/text/qtexttable_p.h @@ -65,8 +65,8 @@ public: ~QTextTablePrivate(); static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat); - void fragmentAdded(QChar type, uint fragment) Q_DECL_OVERRIDE; - void fragmentRemoved(QChar type, uint fragment) Q_DECL_OVERRIDE; + void fragmentAdded(QChar type, uint fragment) override; + void fragmentRemoved(QChar type, uint fragment) override; void update() const; diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index eba4b54672..ad23092537 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QValidator : public QObject { Q_OBJECT public: - explicit QValidator(QObject * parent = Q_NULLPTR); + explicit QValidator(QObject * parent = nullptr); ~QValidator(); enum State { @@ -93,12 +93,12 @@ class Q_GUI_EXPORT QIntValidator : public QValidator Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) public: - explicit QIntValidator(QObject * parent = Q_NULLPTR); - QIntValidator(int bottom, int top, QObject *parent = Q_NULLPTR); + explicit QIntValidator(QObject * parent = nullptr); + QIntValidator(int bottom, int top, QObject *parent = nullptr); ~QIntValidator(); - QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE; - void fixup(QString &input) const Q_DECL_OVERRIDE; + QValidator::State validate(QString &, int &) const override; + void fixup(QString &input) const override; void setBottom(int); void setTop(int); @@ -130,8 +130,8 @@ class Q_GUI_EXPORT QDoubleValidator : public QValidator Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged) public: - explicit QDoubleValidator(QObject * parent = Q_NULLPTR); - QDoubleValidator(double bottom, double top, int decimals, QObject *parent = Q_NULLPTR); + explicit QDoubleValidator(QObject * parent = nullptr); + QDoubleValidator(double bottom, double top, int decimals, QObject *parent = nullptr); ~QDoubleValidator(); enum Notation { @@ -139,7 +139,7 @@ public: ScientificNotation }; Q_ENUM(Notation) - QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE; + QValidator::State validate(QString &, int &) const override; virtual void setRange(double bottom, double top, int decimals = 0); void setBottom(double); @@ -174,11 +174,11 @@ class Q_GUI_EXPORT QRegExpValidator : public QValidator Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp NOTIFY regExpChanged) public: - explicit QRegExpValidator(QObject *parent = Q_NULLPTR); - explicit QRegExpValidator(const QRegExp& rx, QObject *parent = Q_NULLPTR); + explicit QRegExpValidator(QObject *parent = nullptr); + explicit QRegExpValidator(const QRegExp& rx, QObject *parent = nullptr); ~QRegExpValidator(); - virtual QValidator::State validate(QString& input, int& pos) const Q_DECL_OVERRIDE; + virtual QValidator::State validate(QString& input, int& pos) const override; void setRegExp(const QRegExp& rx); const QRegExp& regExp() const { return r; } @@ -204,11 +204,11 @@ class Q_GUI_EXPORT QRegularExpressionValidator : public QValidator Q_PROPERTY(QRegularExpression regularExpression READ regularExpression WRITE setRegularExpression NOTIFY regularExpressionChanged) public: - explicit QRegularExpressionValidator(QObject *parent = Q_NULLPTR); - explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = Q_NULLPTR); + explicit QRegularExpressionValidator(QObject *parent = nullptr); + explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = nullptr); ~QRegularExpressionValidator(); - virtual QValidator::State validate(QString &input, int &pos) const Q_DECL_OVERRIDE; + virtual QValidator::State validate(QString &input, int &pos) const override; QRegularExpression regularExpression() const; |