summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp1
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/accessible/qaccessiblebridge.h2
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp2
-rw-r--r--src/gui/accessible/qaccessibleobject.h28
-rw-r--r--src/gui/accessible/qaccessibleplugin.h2
-rw-r--r--src/gui/image/qbitmap.h2
-rw-r--r--src/gui/image/qicon.h4
-rw-r--r--src/gui/image/qicon_p.h22
-rw-r--r--src/gui/image/qiconengineplugin.h2
-rw-r--r--src/gui/image/qiconloader_p.h20
-rw-r--r--src/gui/image/qimage.cpp46
-rw-r--r--src/gui/image/qimage.h34
-rw-r--r--src/gui/image/qimageiohandler.h2
-rw-r--r--src/gui/image/qmovie.h6
-rw-r--r--src/gui/image/qpaintengine_pic_p.h22
-rw-r--r--src/gui/image/qpicture.cpp4
-rw-r--r--src/gui/image/qpicture.h14
-rw-r--r--src/gui/image/qpictureformatplugin.h2
-rw-r--r--src/gui/image/qpixmap.h22
-rw-r--r--src/gui/image/qpixmap_blitter_p.h22
-rw-r--r--src/gui/image/qpixmap_raster_p.h38
-rw-r--r--src/gui/image/qpixmapcache.cpp2
-rw-r--r--src/gui/image/qpixmapcache.h2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp93
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h50
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h11
-rw-r--r--src/gui/kernel/qcursor.h2
-rw-r--r--src/gui/kernel/qdnd_p.h6
-rw-r--r--src/gui/kernel/qevent.h6
-rw-r--r--src/gui/kernel/qgenericplugin.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp247
-rw-r--r--src/gui/kernel/qguiapplication.h6
-rw-r--r--src/gui/kernel/qguiapplication_p.h8
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp6
-rw-r--r--src/gui/kernel/qoffscreensurface.h10
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h8
-rw-r--r--src/gui/kernel/qopenglwindow.cpp10
-rw-r--r--src/gui/kernel/qopenglwindow.h12
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h8
-rw-r--r--src/gui/kernel/qpalette.h2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp2
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h2
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp4
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.cpp2
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h4
-rw-r--r--src/gui/kernel/qplatformsurface.h4
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.h4
-rw-r--r--src/gui/kernel/qrasterwindow.cpp6
-rw-r--r--src/gui/kernel/qrasterwindow.h6
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h2
-rw-r--r--src/gui/kernel/qsimpledrag.cpp2
-rw-r--r--src/gui/kernel/qsimpledrag_p.h14
-rw-r--r--src/gui/kernel/qwindow.h16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp85
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h37
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h29
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
-rw-r--r--src/gui/opengl/qopengl.cpp4
-rw-r--r--src/gui/opengl/qopengl.h4
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopengldebug.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp4
-rw-r--r--src/gui/opengl/qopenglext.h4
-rw-r--r--src/gui/opengl/qopenglextrafunctions.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp6
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp4
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp4
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp4
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h4
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h56
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h8
-rw-r--r--src/gui/opengl/qopengltexture.h36
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h4
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h16
-rw-r--r--src/gui/opengl/qopengltimerquery.h4
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.h2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject_p.h8
-rw-r--r--src/gui/painting/qcolor.h16
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp223
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp40
-rw-r--r--src/gui/painting/qdrawhelper_p.h14
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h64
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h82
-rw-r--r--src/gui/painting/qpaintengineex_p.h30
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qpainter.h8
-rw-r--r--src/gui/painting/qpdf_p.h26
-rw-r--r--src/gui/painting/qpdfwriter.cpp12
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp2
-rw-r--r--src/gui/painting/qregion.cpp11
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h6
-rw-r--r--src/gui/painting/qtransform.cpp8
-rw-r--r--src/gui/painting/qtransform.h6
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h2
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp12
-rw-r--r--src/gui/text/qfontengine.cpp6
-rw-r--r--src/gui/text/qfontengine_p.h92
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h48
-rw-r--r--src/gui/text/qfontmetrics.cpp170
-rw-r--r--src/gui/text/qfontmetrics.h25
-rw-r--r--src/gui/text/qstatictext.cpp18
-rw-r--r--src/gui/text/qtextdocument.h6
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h22
-rw-r--r--src/gui/text/qtextengine.cpp4
-rw-r--r--src/gui/text/qtexthtmlparser.cpp16
-rw-r--r--src/gui/text/qtextimagehandler_p.h4
-rw-r--r--src/gui/text/qtextlayout.h8
-rw-r--r--src/gui/text/qtextobject.h6
-rw-r--r--src/gui/text/qtextodfwriter.cpp4
-rw-r--r--src/gui/text/qtexttable.h4
-rw-r--r--src/gui/text/qtexttable_p.h4
-rw-r--r--src/gui/util/qvalidator.h28
157 files changed, 1324 insertions, 988 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..f566677ff4 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()
+ and tst_QWindow::generatedMouseMove() auto tests.
+*/
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;
@@ -1934,14 +1977,14 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen);
const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen);
QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint,
- button, mouse_buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
cursor->pointerEvent(ev);
}
}
#endif
- QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, mouse_buttons, e->modifiers, e->source);
+ QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
@@ -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;
@@ -1975,7 +2018,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
point.state = Qt::TouchPointPressed;
} else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
point.state = Qt::TouchPointReleased;
- } else if (type == QEvent::MouseMove && (mouse_buttons & Qt::LeftButton)) {
+ } else if (type == QEvent::MouseMove && (e->buttons & Qt::LeftButton)) {
point.state = Qt::TouchPointMoved;
} else {
return;
@@ -1994,9 +2037,9 @@ 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);
+ button, e->buttons, e->modifiers, e->source);
dblClickEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
}
@@ -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/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index 085652879c..caef942840 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -129,7 +129,7 @@ static inline qreal initialGlobalScaleFactor()
Note that the functions in this file do not work with the OS scale factor
directly and are limited to converting between device independent and native
- pixels. The OS scale factor is accunted for by QWindow::devicePixelRatio()
+ pixels. The OS scale factor is accounted for by QWindow::devicePixelRatio()
and similar functions.
Configuration Examples:
@@ -168,7 +168,7 @@ static inline qreal initialGlobalScaleFactor()
1) A global scale factor
The QT_SCALE_FACTOR environment variable can be used to set
- a global scale factor for all windows in the processs. This
+ a global scale factor for all windows in the process. This
is useful for testing and debugging (you can simulate any
devicePixelRatio without needing access to special hardware),
and perhaps also for targeting a specific application to
@@ -204,7 +204,7 @@ static inline qreal initialGlobalScaleFactor()
T fromNativePixels(T, QWindow*)
The following classes in QtGui use native pixels, for the convenience of the
- plataform plugins:
+ platform plugins:
QPlatformWindow
QPlatformScreen
QWindowSystemInterface (API only - Events are in device independent pixels)
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 &region) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
- void flush(const QRegion &region) Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &region) override;
+ void endPaint() override;
+ void flush(const QRegion &region) 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 &region) Q_DECL_OVERRIDE
+ void beginPaint(const QRegion &region) 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 &region) Q_DECL_OVERRIDE
+ void flush(const QRegion &region) 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 &region);
- 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/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index ee05f810f1..339a9749b8 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -38,16 +38,11 @@
****************************************************************************/
#include <qglobal.h>
-#include <private/qdrawhelper_p.h>
-#include <private/qrgba64_p.h>
+#include "qdrawhelper_p.h"
+#include "qrgba64_p.h"
QT_BEGIN_NAMESPACE
-# define PRELOAD_INIT(x)
-# define PRELOAD_INIT2(x,y)
-# define PRELOAD_COND(x)
-# define PRELOAD_COND2(x,y)
-
/* The constant alpha factor describes an alpha factor that gets applied
to the result of the composition operation combining it with the destination.
@@ -69,24 +64,6 @@ QT_BEGIN_NAMESPACE
where the source is an array of pixels.
*/
-/*
- result = 0
- d = d * cia
-*/
-#define comp_func_Clear_impl(dest, length, const_alpha)\
-{\
- if (const_alpha == 255) {\
- QT_MEMFILL_UINT(dest, length, 0);\
- } else {\
- int ialpha = 255 - const_alpha;\
- PRELOAD_INIT(dest)\
- for (int i = 0; i < length; ++i) {\
- PRELOAD_COND(dest)\
- dest[i] = BYTE_MUL(dest[i], ialpha);\
- }\
- }\
-}
-
#if defined __SSE2__
# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
#ifdef Q_PROCESSOR_X86_64
@@ -117,38 +94,41 @@ QT_BEGIN_NAMESPACE
# define INVALPHA(c) (65535 - ALPHA(c))
#endif
+
+/*
+ result = 0
+ d = d * cia
+*/
void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ if (const_alpha == 255) {
+ qt_memfill32(dest, 0, length);
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
+ dest[i] = BYTE_MUL(dest[i], ialpha);
+ }
}
void QT_FASTCALL comp_func_solid_Clear_rgb64(QRgba64 *dest, int length, QRgba64, uint const_alpha)
{
- if (const_alpha == 255)
+ if (const_alpha == 255) {
qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
}
}
void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ comp_func_solid_Clear(dest, length, 0, const_alpha);
}
void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int length, uint const_alpha)
{
- if (const_alpha == 255)
- qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
- STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
- }
+ comp_func_solid_Clear_rgb64(dest, length, QRgba64(), const_alpha);
}
/*
@@ -158,13 +138,11 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], ialpha);
}
}
@@ -175,7 +153,7 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
if (const_alpha == 255)
qt_memfill64((quint64*)dest, color, length);
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
auto c = multiplyAlpha255(CONVERT(color), const_alpha);
for (int i = 0; i < length; ++i) {
STORE(&dest[i], ADD(c, multiplyAlpha255(LOAD(&dest[i]), ialpha)));
@@ -186,12 +164,10 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255) {
- ::memcpy(dest, src, length * sizeof(uint));
+ ::memcpy(dest, src, size_t(length) * sizeof(uint));
} else {
- int ialpha = 255 - const_alpha;
- PRELOAD_INIT2(dest, src)
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha);
}
}
@@ -200,9 +176,9 @@ void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL
void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
- ::memcpy(dest, src, length * sizeof(quint64));
+ ::memcpy(dest, src, size_t(length) * sizeof(quint64));
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
STORE(&dest[i], interpolate255(LOAD(&src[i]), const_alpha, LOAD(&dest[i]), ialpha));
}
@@ -234,13 +210,11 @@ void QT_FASTCALL comp_func_Destination_rgb64(QRgba64 *, const QRgba64 *, int, ui
void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color));
}
}
@@ -263,10 +237,8 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
if (s >= 0xff000000)
dest[i] = s;
@@ -275,7 +247,6 @@ void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
@@ -309,9 +280,7 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = d + BYTE_MUL(color, qAlpha(~d));
}
@@ -330,16 +299,13 @@ void QT_FASTCALL comp_func_solid_DestinationOver_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
dest[i] = d + BYTE_MUL(src[i], qAlpha(~d));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = d + BYTE_MUL(s, qAlpha(~d));
@@ -369,17 +335,14 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
*/
void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia);
}
@@ -389,32 +352,30 @@ void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, ui
void QT_FASTCALL comp_func_solid_SourceIn_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
if (const_alpha == 255) {
+ auto c = CONVERT(color);
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(color, dest[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(c, dest[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
- uint cia = 65535 - ca;
- color = multiplyAlpha65535(color, ca);
+ auto cia = CONST(65535 - ca);
+ auto c = multiplyAlpha65535(CONVERT(color), ca);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, d.alpha(), d, cia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(c, ALPHA(d), d, cia));
}
}
}
void QT_FASTCALL comp_func_SourceIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(dest[i]));
}
} else {
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
@@ -450,9 +411,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint colo
if (const_alpha != 255) {
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -470,16 +429,13 @@ void QT_FASTCALL comp_func_solid_DestinationIn_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], a);
}
@@ -490,14 +446,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(dest[i], src[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), src[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
uint a = qt_div_65535(src[i].alpha() * ca) + cia;
- dest[i] = multiplyAlpha65535(dest[i], a);
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), a));
}
}
}
@@ -509,17 +465,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(~dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia);
}
@@ -545,16 +498,13 @@ void QT_FASTCALL comp_func_solid_SourceOut_rgb64(QRgba64 *dest, int length, QRgb
void QT_FASTCALL comp_func_SourceOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
@@ -589,9 +539,7 @@ void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint col
uint a = qAlpha(~color);
if (const_alpha != 255)
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -609,16 +557,13 @@ void QT_FASTCALL comp_func_solid_DestinationOut_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], sia);
}
@@ -653,9 +598,7 @@ void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color,
color = BYTE_MUL(color, const_alpha);
}
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia);
}
}
@@ -672,17 +615,14 @@ void QT_FASTCALL comp_func_solid_SourceAtop_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
@@ -719,9 +659,7 @@ void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint co
color = BYTE_MUL(color, const_alpha);
a = qAlpha(color) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
}
@@ -742,18 +680,15 @@ void QT_FASTCALL comp_func_solid_DestinationAtop_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
uint a = qAlpha(s) + cia;
@@ -771,8 +706,8 @@ void QT_FASTCALL comp_func_DestinationAtop_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
dest[i] = interpolate65535(d, s.alpha(), s, 65535 - d.alpha());
}
} else {
- int ca = const_alpha * 257;
- int cia = 65535 - ca;
+ uint ca = const_alpha * 257;
+ uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
QRgba64 s = multiplyAlpha65535(src[i], ca);
QRgba64 d = dest[i];
@@ -794,9 +729,7 @@ void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint co
color = BYTE_MUL(color, const_alpha);
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
}
@@ -806,26 +739,24 @@ void QT_FASTCALL comp_func_solid_XOR_rgb64(QRgba64 *dest, int length, QRgba64 co
{
if (const_alpha != 255)
color = multiplyAlpha255(color, const_alpha);
- uint sia = 65535 - color.alpha();
+ auto s = CONVERT(color);
+ auto sia = CONST(65535 - color.alpha());
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, 65535 - d.alpha(), d, sia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, sia));
}
}
void QT_FASTCALL comp_func_XOR(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
@@ -837,15 +768,15 @@ void QT_FASTCALL comp_func_XOR_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba6
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = src[i];
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = LOAD(&src[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
}
}
@@ -901,9 +832,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int
{
uint s = color;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
d = comp_func_Plus_one_pixel(d, s);
coverage.store(&dest[i], d);
@@ -940,9 +869,7 @@ void QT_FASTCALL comp_func_solid_Plus_rgb64(QRgba64 *dest, int length, QRgba64 c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1001,9 +928,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Multiply_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1060,9 +985,7 @@ void QT_FASTCALL comp_func_solid_Multiply_rgb64(QRgba64 *dest, int length, QRgba
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1129,9 +1052,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Screen_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1188,9 +1109,7 @@ void QT_FASTCALL comp_func_solid_Screen_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1277,9 +1196,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Overlay_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1336,9 +1253,7 @@ void QT_FASTCALL comp_func_solid_Overlay_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1415,9 +1330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Darken_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1474,9 +1387,7 @@ void QT_FASTCALL comp_func_solid_Darken_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1553,9 +1464,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Lighten_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1612,9 +1521,7 @@ void QT_FASTCALL comp_func_solid_Lighten_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1709,9 +1616,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorDodge_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1768,9 +1673,7 @@ void QT_FASTCALL comp_func_solid_ColorDodge_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1865,9 +1768,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorBurn_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1924,9 +1825,7 @@ void QT_FASTCALL comp_func_solid_ColorBurn_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2015,9 +1914,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_HardLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2074,9 +1971,7 @@ void QT_FASTCALL comp_func_solid_HardLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2178,9 +2073,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_SoftLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2237,9 +2130,7 @@ void QT_FASTCALL comp_func_solid_SoftLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2316,9 +2207,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Difference_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2375,9 +2264,7 @@ void QT_FASTCALL comp_func_solid_Difference_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2443,9 +2330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void QT_FASTCALL comp_func_solid_Exclusion_imp
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2503,9 +2388,7 @@ void QT_FASTCALL comp_func_solid_Exclusion_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 5ec570a5db..149fa124f6 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6443,7 +6443,7 @@ static void qInitDrawhelperFunctions()
sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
-#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint *src, int count,
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 4cbac009d8..e126f4b670 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1080,23 +1080,41 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_neon(uint *buffer, const Oper
return buffer;
}
-#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
template<bool RGBA>
static inline void convertARGBToARGB32PM_neon(uint *buffer, const uint *src, int count)
{
int i = 0;
+#if defined(Q_PROCESSOR_ARM_64)
const uint8x16_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15};
+#else
+ const uint8x8_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7 };
+#endif
const uint8x8_t shuffleMask = { 3, 3, 3, 3, 7, 7, 7, 7};
const uint32x4_t blendMask = vdupq_n_u32(0xff000000);
for (; i < count - 3; i += 4) {
uint32x4_t srcVector = vld1q_u32(src + i);
uint32x4_t alphaVector = vshrq_n_u32(srcVector, 24);
+#if defined(Q_PROCESSOR_ARM_64)
uint32_t alphaSum = vaddvq_u32(alphaVector);
+#else
+ // no vaddvq_u32
+ uint32x2_t tmp = vpadd_u32(vget_low_u32(alphaVector), vget_high_u32(alphaVector));
+ uint32_t alphaSum = vget_lane_u32(vpadd_u32(tmp, tmp), 0);
+#endif
if (alphaSum) {
if (alphaSum != 255 * 4) {
- if (RGBA)
+ if (RGBA) {
+#if defined(Q_PROCESSOR_ARM_64)
srcVector = vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask));
+#else
+ // no vqtbl1q_u8
+ const uint8x8_t low = vtbl1_u8(vreinterpret_u8_u32(vget_low_u32(srcVector)), rgbaMask);
+ const uint8x8_t high = vtbl1_u8(vreinterpret_u8_u32(vget_high_u32(srcVector)), rgbaMask);
+ srcVector = vcombine_u32(vreinterpret_u32_u8(low), vreinterpret_u32_u8(high));
+#endif
+ }
const uint8x8_t s1 = vreinterpret_u8_u32(vget_low_u32(srcVector));
const uint8x8_t s2 = vreinterpret_u8_u32(vget_high_u32(srcVector));
const uint8x8_t alpha1 = vtbl1_u8(s1, shuffleMask);
@@ -1110,10 +1128,19 @@ static inline void convertARGBToARGB32PM_neon(uint *buffer, const uint *src, int
const uint32x4_t d = vbslq_u32(blendMask, srcVector, vreinterpretq_u32_u8(vcombine_u8(d1, d2)));
vst1q_u32(buffer + i, d);
} else {
- if (RGBA)
- vst1q_u32(buffer + i, vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask)));
- else if (buffer != src)
+ if (RGBA) {
+#if defined(Q_PROCESSOR_ARM_64)
+ srcVector = vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask));
+#else
+ // no vqtbl1q_u8
+ const uint8x8_t low = vtbl1_u8(vreinterpret_u8_u32(vget_low_u32(srcVector)), rgbaMask);
+ const uint8x8_t high = vtbl1_u8(vreinterpret_u8_u32(vget_high_u32(srcVector)), rgbaMask);
+ srcVector = vcombine_u32(vreinterpret_u32_u8(low), vreinterpret_u32_u8(high));
+#endif
+ vst1q_u32(buffer + i, srcVector);
+ } else if (buffer != src) {
vst1q_u32(buffer + i, srcVector);
+ }
}
} else {
vst1q_u32(buffer + i, vdupq_n_u32(0));
@@ -1139,7 +1166,8 @@ const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint
convertARGBToARGB32PM_neon<true>(buffer, src, count);
return buffer;
}
-#endif
+
+#endif // Q_BYTE_ORDER == Q_LITTLE_ENDIAN
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 2be10d2cfb..1dea386da4 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1160,23 +1160,23 @@ const uint qt_bayer_matrix[16][16] = {
#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
-#define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
+#define MIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#else // 32 bits
// The mask for alpha can overflow over 32 bits
-#define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) quint32(qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
#endif
-inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
+inline uint comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
}
-inline int comp_func_Plus_one_pixel(uint d, const uint s)
+inline uint comp_func_Plus_one_pixel(uint d, const uint s)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return result;
}
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 &region, 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 &region, 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.cpp b/src/gui/painting/qpainter.cpp
index b95f9b18aa..6876a72e6e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5850,7 +5850,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen)
return;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (tf & Qt::TextBypassShaping) {
// Skip complex shaping, shape using glyph advances only
int len = str.length();
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 438cd3de3a..220e89a0c4 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2849,7 +2849,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
@@ -2872,7 +2872,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.cpp b/src/gui/text/qfontmetrics.cpp
index 5675d6921d..5ad57b064b 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -510,6 +510,7 @@ int QFontMetrics::rightBearing(QChar ch) const
return qRound(rb);
}
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
Returns the width in pixels of the first \a len characters of \a
text. If \a len is negative (the default), the entire string is
@@ -520,11 +521,13 @@ int QFontMetrics::rightBearing(QChar ch) const
string will cover whereas width() returns the distance to where
the next string should be drawn.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\sa boundingRect()
*/
int QFontMetrics::width(const QString &text, int len) const
{
- return width(text, len, 0);
+ return horizontalAdvance(text, len);
}
/*!
@@ -532,17 +535,17 @@ int QFontMetrics::width(const QString &text, int len) const
*/
int QFontMetrics::width(const QString &text, int len, int flags) const
{
- int pos = text.indexOf(QLatin1Char('\x9c'));
- if (pos != -1) {
- len = (len < 0) ? pos : qMin(pos, len);
- } else if (len < 0) {
- len = text.length();
- }
- if (len == 0)
- return 0;
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (flags & Qt::TextBypassShaping) {
+ int pos = text.indexOf(QLatin1Char('\x9c'));
+ if (pos != -1) {
+ len = (len < 0) ? pos : qMin(pos, len);
+ } else if (len < 0) {
+ len = text.length();
+ }
+ if (len == 0)
+ return 0;
+
// Skip complex shaping, only use advances
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
@@ -555,10 +558,11 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
width += glyphs.advances[i];
return qRound(width);
}
+#else
+ Q_UNUSED(flags)
#endif
- QStackTextEngine layout(text, QFont(d.data()));
- return qRound(layout.width(0, len));
+ return horizontalAdvance(text, len);
}
/*!
@@ -577,6 +581,8 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
in this particular font are both negative, while the bearings of
"o" are both positive.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\warning This function will produce incorrect results for Arabic
characters or non-spacing marks in the middle of a string, as the
glyph shaping and positioning of marks that happens when
@@ -587,6 +593,65 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
*/
int QFontMetrics::width(QChar ch) const
{
+ return horizontalAdvance(ch);
+}
+#endif // QT_DEPRECATED_SINCE(5, 11)
+
+/*!
+ Returns the horizontal advance in pixels of the first \a len characters of \a
+ text. If \a len is negative (the default), the entire string is
+ used.
+
+ This is the distance appropriate for drawing a subsequent character
+ after \a text.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+int QFontMetrics::horizontalAdvance(const QString &text, int len) const
+{
+ int pos = text.indexOf(QLatin1Char('\x9c'));
+ if (pos != -1) {
+ len = (len < 0) ? pos : qMin(pos, len);
+ } else if (len < 0) {
+ len = text.length();
+ }
+ if (len == 0)
+ return 0;
+
+ QStackTextEngine layout(text, QFont(d.data()));
+ return qRound(layout.width(0, len));
+}
+
+/*!
+ \overload
+
+ \image bearings.png Bearings
+
+ Returns the horizontal advance of character \a ch in pixels. This is a
+ distance appropriate for drawing a subsequent character after \a
+ ch.
+
+ Some of the metrics are described in the image. The
+ central dark rectangles cover the logical horizontalAdvance() of each
+ character. The outer pale rectangles cover the leftBearing() and
+ rightBearing() of each character. Notice that the bearings of "f"
+ in this particular font are both negative, while the bearings of
+ "o" are both positive.
+
+ \warning This function will produce incorrect results for Arabic
+ characters or non-spacing marks in the middle of a string, as the
+ glyph shaping and positioning of marks that happens when
+ processing strings cannot be taken into account. When implementing
+ an interactive text control, use QTextLayout instead.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+int QFontMetrics::horizontalAdvance(QChar ch) const
+{
if (QChar::category(ch.unicode()) == QChar::Mark_NonSpacing)
return 0;
@@ -677,7 +742,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -711,7 +776,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
base line.
\warning The width of the returned rectangle is not the advance width
- of the character. Use boundingRect(const QString &) or width() instead.
+ of the character. Use boundingRect(const QString &) or horizontalAdvance() instead.
\sa width()
*/
@@ -846,7 +911,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -1396,6 +1461,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
}
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
Returns the width in pixels of the characters in the given \a text.
@@ -1404,16 +1470,73 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
describing the pixels this string will cover whereas width()
returns the distance to where the next string should be drawn.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\sa boundingRect()
*/
qreal QFontMetricsF::width(const QString &text) const
{
+ return horizontalAdvance(text);
+}
+
+/*!
+ \overload
+
+ \image bearings.png Bearings
+
+ Returns the logical width of character \a ch in pixels. This is a
+ distance appropriate for drawing a subsequent character after \a
+ ch.
+
+ Some of the metrics are described in the image to the right. The
+ central dark rectangles cover the logical width() of each
+ character. The outer pale rectangles cover the leftBearing() and
+ rightBearing() of each character. Notice that the bearings of "f"
+ in this particular font are both negative, while the bearings of
+ "o" are both positive.
+
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
+ \warning This function will produce incorrect results for Arabic
+ characters or non-spacing marks in the middle of a string, as the
+ glyph shaping and positioning of marks that happens when
+ processing strings cannot be taken into account. When implementing
+ an interactive text control, use QTextLayout instead.
+
+ \sa boundingRect()
+*/
+qreal QFontMetricsF::width(QChar ch) const
+{
+ return horizontalAdvance(ch);
+}
+#endif
+
+/*!
+ Returns the horizontal advance in pixels of the first \a length characters of \a
+ text. If \a length is negative (the default), the entire string is
+ used.
+
+ The advance is the distance appropriate for drawing a subsequent
+ character after \a text.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
+{
int pos = text.indexOf(QLatin1Char('\x9c'));
- int len = (pos != -1) ? pos : text.length();
+ if (pos != -1)
+ length = (length < 0) ? pos : qMin(pos, length);
+ else if (length < 0)
+ length = text.length();
+
+ if (length == 0)
+ return 0;
QStackTextEngine layout(text, QFont(d.data()));
layout.itemize();
- return layout.width(0, len).toReal();
+ return layout.width(0, length).toReal();
}
/*!
@@ -1421,7 +1544,7 @@ qreal QFontMetricsF::width(const QString &text) const
\image bearings.png Bearings
- Returns the logical width of character \a ch in pixels. This is a
+ Returns the horizontal advance of character \a ch in pixels. This is a
distance appropriate for drawing a subsequent character after \a
ch.
@@ -1438,9 +1561,11 @@ qreal QFontMetricsF::width(const QString &text) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
+ \since 5.11
+
\sa boundingRect()
*/
-qreal QFontMetricsF::width(QChar ch) const
+qreal QFontMetricsF::horizontalAdvance(QChar ch) const
{
if (ch.category() == QChar::Mark_NonSpacing)
return 0.;
@@ -1467,6 +1592,7 @@ qreal QFontMetricsF::width(QChar ch) const
return advance.toReal();
}
+
/*!
Returns the bounding rectangle of the characters in the string
specified by \a text. The bounding rectangle always covers at least
@@ -1477,7 +1603,7 @@ qreal QFontMetricsF::width(QChar ch) const
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -1650,7 +1776,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 3eac309092..b6167a1d47 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -90,10 +90,16 @@ public:
int leftBearing(QChar) const;
int rightBearing(QChar) const;
+
+#if QT_DEPRECATED_SINCE(5, 11)
int width(const QString &, int len = -1) const;
int width(const QString &, int len, int flags) const;
-
int width(QChar) const;
+#endif
+
+ int horizontalAdvance(const QString &, int len = -1) const;
+ int horizontalAdvance(QChar) const;
+
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QT_DEPRECATED int charWidth(const QString &str, int pos) const;
#endif
@@ -101,11 +107,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;
@@ -164,14 +170,19 @@ public:
qreal leftBearing(QChar) const;
qreal rightBearing(QChar) const;
- qreal width(const QString &string) const;
+#if QT_DEPRECATED_SINCE(5, 11)
+ qreal width(const QString &string) const;
qreal width(QChar) const;
+#endif
+
+ qreal horizontalAdvance(const QString &string, int length = -1) const;
+ qreal horizontalAdvance(QChar) const;
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;