summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp3
-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/configure.json64
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qicon.cpp3
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfont.cpp2
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp4
-rw-r--r--src/gui/image/qbitmap.h2
-rw-r--r--src/gui/image/qicon.cpp35
-rw-r--r--src/gui/image/qicon.h7
-rw-r--r--src/gui/image/qicon_p.h22
-rw-r--r--src/gui/image/qiconengineplugin.h2
-rw-r--r--src/gui/image/qiconloader.cpp88
-rw-r--r--src/gui/image/qiconloader_p.h27
-rw-r--r--src/gui/image/qimage.cpp72
-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/qdrag.cpp7
-rw-r--r--src/gui/kernel/qevent.cpp28
-rw-r--r--src/gui/kernel/qevent.h6
-rw-r--r--src/gui/kernel/qgenericplugin.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp294
-rw-r--r--src/gui/kernel/qguiapplication.h7
-rw-r--r--src/gui/kernel/qguiapplication_p.h8
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp6
-rw-r--r--src/gui/kernel/qkeysequence.h2
-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/qplatformdialoghelper.cpp1
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.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/qplatformtheme.cpp5
-rw-r--r--src/gui/kernel/qplatformtheme.h3
-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.cpp2
-rw-r--r--src/gui/kernel/qwindow.h21
-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/qgenericmatrix.cpp58
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp4
-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.cpp19
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h12
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions.h25
-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.cpp2
-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/qcoregraphics.mm107
-rw-r--r--src/gui/painting/qcoregraphics_p.h3
-rw-r--r--src/gui/painting/qdrawhelper.cpp13
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp165
-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.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h82
-rw-r--r--src/gui/painting/qpaintengineex.cpp37
-rw-r--r--src/gui/painting/qpaintengineex_p.h30
-rw-r--r--src/gui/painting/qpainter.cpp27
-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.cpp75
-rw-r--r--src/gui/painting/qregion.h3
-rw-r--r--src/gui/painting/qrgba64.qdoc8
-rw-r--r--src/gui/painting/qrgba64_p.h15
-rw-r--r--src/gui/painting/qt_mips_asm_dsp_p.h2
-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.cpp19
-rw-r--r--src/gui/text/qfontengine.cpp19
-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/qharfbuzzng.cpp40
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp13
-rw-r--r--src/gui/text/qstatictext.cpp40
-rw-r--r--src/gui/text/qstatictext_p.h2
-rw-r--r--src/gui/text/qtextdocument.cpp20
-rw-r--r--src/gui/text/qtextdocument.h6
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp6
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h22
-rw-r--r--src/gui/text/qtextengine.cpp4
-rw-r--r--src/gui/text/qtextformat.cpp34
-rw-r--r--src/gui/text/qtexthtmlparser.cpp16
-rw-r--r--src/gui/text/qtextimagehandler_p.h4
-rw-r--r--src/gui/text/qtextlayout.cpp8
-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/qtextoption.cpp19
-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
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.h61
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp4
195 files changed, 2118 insertions, 1352 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 2db4d46874..d60a21606b 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1578,7 +1578,7 @@ QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
/*!
- \fn QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
+ \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
Create a new QAccessibleTextCursorEvent for \a iface,
The \a cursorPos is the new cursor position.
@@ -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/configure.json b/src/gui/configure.json
index a7f08f2cc0..ccaf38e4b7 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -1,7 +1,8 @@
{
"module": "gui",
"depends": [
- "core"
+ "core",
+ "network"
],
"testDir": "../../config.tests",
@@ -206,7 +207,7 @@
"test": {
"include": "harfbuzz/hb.h",
"tail": [
- "#if !HB_VERSION_ATLEAST(0, 9, 42)",
+ "#if !HB_VERSION_ATLEAST(1, 6, 0)",
"# error This version of harfbuzz is too old.",
"#endif"
],
@@ -395,6 +396,30 @@
"-lts"
]
},
+ "v4l2": {
+ "label": "V4L2",
+ "test": {
+ "include": [
+ "cstddef"
+ ],
+ "tail": [
+ "extern \"C\" {",
+ "#include <mediactl/mediactl.h>",
+ "#include <mediactl/v4l2subdev.h>",
+ "}"
+ ],
+ "main": [
+ "v4l2_format fmt;",
+ "media_pad *pad = nullptr;",
+ "media_device *device = media_device_new(\"/dev/media\");",
+ "v4l2_subdev_set_format(nullptr, nullptr, 0, V4L2_SUBDEV_FORMAT_ACTIVE);"
+ ]
+ },
+ "sources": [
+ { "type": "pkgConfig", "args": "libv4l2 libmediactl" },
+ "-lmediactl -lv4l2 -lv4l2subdev"
+ ]
+ },
"vulkan": {
"label": "Vulkan",
"test": "qpa/vulkan",
@@ -955,7 +980,8 @@
},
"fontconfig": {
"label": "Fontconfig",
- "condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig",
+ "autoDetect": "!config.darwin",
+ "condition": "!config.win32 && features.system-freetype && libs.fontconfig",
"output": [ "privateFeature", "feature" ]
},
"gbm": {
@@ -1019,10 +1045,19 @@
"condition": "tests.linuxfb && features.regularexpression",
"output": [ "privateFeature" ]
},
+ "vsp2": {
+ "label": "VSP2",
+ "condition": "libs.v4l2",
+ "autoDetect": false,
+ "output": [ "privateFeature" ]
+ },
"vnc": {
"label": "VNC",
"section": "Platform plugins",
- "condition": "config.unix && !config.android && !config.darwin && features.regularexpression",
+ "condition": [
+ "config.unix && !config.android && !config.darwin",
+ "features.regularexpression && features.network"
+ ],
"output": [ "privateFeature" ]
},
"mirclient": {
@@ -1136,6 +1171,11 @@
"condition": "features.eglfs && features.gbm && features.kms",
"output": [ "privateFeature" ]
},
+ "eglfs_vsp2": {
+ "label": "EGLFS VSP2",
+ "condition": "features.eglfs && features.gbm && features.kms && features.vsp2",
+ "output": [ "privateFeature" ]
+ },
"eglfs_mali": {
"label": "EGLFS Mali",
"condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)",
@@ -1226,6 +1266,12 @@
"condition": "libs.tslib",
"output": [ "privateFeature" ]
},
+ "tuiotouch": {
+ "label": "TuioTouch",
+ "purpose": "Provides the TuioTouch input plugin.",
+ "condition": "features.network && features.udpsocket",
+ "output": [ "privateFeature" ]
+ },
"xcb": {
"label": "XCB",
"section": "Platform plugins",
@@ -1316,6 +1362,7 @@
},
"xlib": {
"label": "XLib",
+ "autoDetect": "!config.darwin || features.xcb",
"condition": "tests.xlib",
"output": [ "privateFeature" ]
},
@@ -1539,6 +1586,13 @@ XKB configuration data. This is required for keyboard input support."
},
{
"type": "note",
+ "condition": "features.xcb && config.darwin",
+ "message": "XCB support on macOS is minimal and untested. Some features will
+not work properly or at all (e.g. OpenGL, desktop services or accessibility),
+or may depend on your system and XQuartz setup."
+ },
+ {
+ "type": "note",
"condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
"message": "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing."
},
@@ -1647,7 +1701,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "EGLFS details",
"condition": "features.eglfs",
"entries": [
- "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_vsp2", "eglfs_mali", "eglfs_brcm", "egl_x11"
]
},
"linuxfb", "vnc", "mirclient",
diff --git a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
index f472494e4a..faad6574a7 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
@@ -79,3 +79,6 @@ void MyWidget::drawIcon(QPainter *painter, QPoint pos)
QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
//! [4]
+//! [5]
+ QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << "my/search/path");
+//! [5]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
index 82d8525ded..1901ca9b10 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
@@ -72,6 +72,6 @@ QString family = info.family();
//! [4]
QFontMetrics fm(f1);
-int textWidthInPixels = fm.width("How many pixels wide is this text?");
+int textWidthInPixels = fm.horizontalAdvance("How many pixels wide is this text?");
int textHeightInPixels = fm.height();
//! [4]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
index 6cffa4f611..6b478d3297 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
@@ -51,7 +51,7 @@
//! [0]
QFont font("times", 24);
QFontMetrics fm(font);
-int pixelsWide = fm.width("What's the width of this text?");
+int pixelsWide = fm.horizontalAdvance("What's the width of this text?");
int pixelsHigh = fm.height();
//! [0]
@@ -59,6 +59,6 @@ int pixelsHigh = fm.height();
//! [1]
QFont font("times", 24);
QFontMetricsF fm(font);
-qreal pixelsWide = fm.width("What's the width of this text?");
+qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?");
qreal pixelsHigh = fm.height();
//! [1]
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.cpp b/src/gui/image/qicon.cpp
index 9b2e96d4b0..32fa9e75ac 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1158,6 +1158,36 @@ QStringList QIcon::themeSearchPaths()
}
/*!
+ \since 5.11
+
+ Returns the fallback search paths for icons.
+
+ The default value will depend on the platform.
+
+ \sa setFallbackSearchPaths(), themeSearchPaths()
+*/
+QStringList QIcon::fallbackSearchPaths()
+{
+ return QIconLoader::instance()->fallbackSearchPaths();
+}
+
+/*!
+ \since 5.11
+
+ Sets the fallback search paths for icons to \a paths.
+
+ \note To add some path without replacing existing ones:
+
+ \snippet code/src_gui_image_qicon.cpp 5
+
+ \sa fallbackSearchPaths(), setThemeSearchPaths()
+*/
+void QIcon::setFallbackSearchPaths(const QStringList &paths)
+{
+ QIconLoader::instance()->setFallbackSearchPaths(paths);
+}
+
+/*!
\since 4.6
Sets the current icon theme to \a name.
@@ -1216,7 +1246,10 @@ QString QIcon::themeName()
the lookup. These caches can be generated using gtk-update-icon-cache:
\l{https://developer.gnome.org/gtk3/stable/gtk-update-icon-cache.html}.
- \sa themeName(), setThemeName(), themeSearchPaths()
+ \note If an icon can't be found in the current theme, then it will be
+ searched in fallbackSearchPaths() as an unthemed icon.
+
+ \sa themeName(), setThemeName(), themeSearchPaths(), fallbackSearchPaths()
*/
QIcon QIcon::fromTheme(const QString &name)
{
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 40d3e92af9..653ba6fda4 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);
@@ -118,6 +118,9 @@ public:
static QStringList themeSearchPaths();
static void setThemeSearchPaths(const QStringList &searchpath);
+ static QStringList fallbackSearchPaths();
+ static void setFallbackSearchPaths(const QStringList &paths);
+
static QString themeName();
static void setThemeName(const QString &path);
@@ -147,7 +150,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.cpp b/src/gui/image/qiconloader.cpp
index 3cb6f46bd6..1ea4f1340b 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -95,6 +95,16 @@ static inline QStringList systemIconSearchPaths()
return QStringList();
}
+static inline QStringList systemFallbackSearchPaths()
+{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
+ const QVariant themeHint = theme->themeHint(QPlatformTheme::IconFallbackSearchPaths);
+ if (themeHint.isValid())
+ return themeHint.toStringList();
+ }
+ return QStringList();
+}
+
extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp
void QIconLoader::ensureInitialized()
@@ -158,6 +168,20 @@ QStringList QIconLoader::themeSearchPaths() const
return m_iconDirs;
}
+void QIconLoader::setFallbackSearchPaths(const QStringList &searchPaths)
+{
+ m_fallbackDirs = searchPaths;
+ invalidateKey();
+}
+
+QStringList QIconLoader::fallbackSearchPaths() const
+{
+ if (m_fallbackDirs.isEmpty()) {
+ m_fallbackDirs = systemFallbackSearchPaths();
+ }
+ return m_fallbackDirs;
+}
+
/*!
\internal
Helper class that reads and looks up into the icon-theme.cache generated with
@@ -481,11 +505,54 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
return info;
}
+QThemeIconInfo QIconLoader::lookupFallbackIcon(const QString &iconName) const
+{
+ QThemeIconInfo info;
+
+ const QString pngIconName = iconName + QLatin1String(".png");
+ const QString xpmIconName = iconName + QLatin1String(".xpm");
+ const QString svgIconName = iconName + QLatin1String(".svg");
+
+ const auto searchPaths = QIcon::fallbackSearchPaths();
+ for (const QString &iconDir: searchPaths) {
+ QDir currentDir(iconDir);
+ if (currentDir.exists(pngIconName)) {
+ PixmapEntry *iconEntry = new PixmapEntry;
+ iconEntry->dir.type = QIconDirInfo::Fallback;
+ iconEntry->filename = currentDir.filePath(pngIconName);
+ info.entries.append(iconEntry);
+ break;
+ } else if (currentDir.exists(xpmIconName)) {
+ PixmapEntry *iconEntry = new PixmapEntry;
+ iconEntry->dir.type = QIconDirInfo::Fallback;
+ iconEntry->filename = currentDir.filePath(xpmIconName);
+ info.entries.append(iconEntry);
+ break;
+ } else if (m_supportsSvg &&
+ currentDir.exists(svgIconName)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir.type = QIconDirInfo::Fallback;
+ iconEntry->filename = currentDir.filePath(svgIconName);
+ info.entries.append(iconEntry);
+ break;
+ }
+ }
+
+ if (!info.entries.isEmpty())
+ info.iconName = iconName;
+
+ return info;
+}
+
QThemeIconInfo QIconLoader::loadIcon(const QString &name) const
{
if (!themeName().isEmpty()) {
QStringList visited;
- return findIconHelper(themeName(), name, visited);
+ const QThemeIconInfo iconInfo = findIconHelper(themeName(), name, visited);
+ if (!iconInfo.entries.isEmpty())
+ return iconInfo;
+
+ return lookupFallbackIcon(name);
}
return QThemeIconInfo();
@@ -573,6 +640,8 @@ static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize, int icon
} else if (dir.type == QIconDirInfo::Threshold) {
return iconsize >= dir.size - dir.threshold &&
iconsize <= dir.size + dir.threshold;
+ } else if (dir.type == QIconDirInfo::Fallback) {
+ return true;
}
Q_ASSERT(1); // Not a valid value
@@ -603,6 +672,8 @@ static int directorySizeDistance(const QIconDirInfo &dir, int iconsize, int icon
else if (scaledIconSize > (dir.size + dir.threshold) * dir.scale)
return scaledIconSize - dir.maxSize * dir.scale;
else return 0;
+ } else if (dir.type == QIconDirInfo::Fallback) {
+ return 0;
}
Q_ASSERT(1); // Not a valid value
@@ -657,9 +728,11 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
QIconLoaderEngineEntry *entry = entryForSize(m_info, size);
if (entry) {
const QIconDirInfo &dir = entry->dir;
- if (dir.type == QIconDirInfo::Scalable)
+ if (dir.type == QIconDirInfo::Scalable) {
return size;
- else {
+ } else if (dir.type == QIconDirInfo::Fallback) {
+ return QIcon(entry->filename).actualSize(size, mode, state);
+ } else {
int result = qMin<int>(dir.size, qMin(size.width(), size.height()));
return QSize(result, result);
}
@@ -745,8 +818,13 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
// Gets all sizes from the DirectoryInfo entries
for (int i = 0; i < N; ++i) {
- int size = m_info.entries.at(i)->dir.size;
- sizes.append(QSize(size, size));
+ const QIconLoaderEngineEntry *entry = m_info.entries.at(i);
+ if (entry->dir.type == QIconDirInfo::Fallback) {
+ sizes.append(QIcon(entry->filename).availableSizes());
+ } else {
+ int size = entry->dir.size;
+ sizes.append(QSize(size, size));
+ }
}
arg.sizes.swap(sizes); // commit
}
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 9398bca585..746e871fb1 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -69,7 +69,7 @@ class QIconLoader;
struct QIconDirInfo
{
- enum Type { Fixed, Scalable, Threshold };
+ enum Type { Fixed, Scalable, Threshold, Fallback };
QIconDirInfo(const QString &_path = QString()) :
path(_path),
size(0),
@@ -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;
@@ -180,6 +180,8 @@ public:
QIconTheme theme() { return themeList.value(themeName()); }
void setThemeSearchPath(const QStringList &searchPaths);
QStringList themeSearchPaths() const;
+ void setFallbackSearchPaths(const QStringList &searchPaths);
+ QStringList fallbackSearchPaths() const;
QIconDirInfo dirInfo(int dirindex);
static QIconLoader *instance();
void updateSystemTheme();
@@ -191,6 +193,8 @@ private:
QThemeIconInfo findIconHelper(const QString &themeName,
const QString &iconName,
QStringList &visited) const;
+ QThemeIconInfo lookupFallbackIcon(const QString &iconName) const;
+
uint m_themeKey;
bool m_supportsSvg;
bool m_initialized;
@@ -199,6 +203,7 @@ private:
mutable QString m_systemTheme;
mutable QStringList m_iconDirs;
mutable QHash <QString, QIconTheme> themeList;
+ mutable QStringList m_fallbackDirs;
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 7999ce6bbe..7fcae12cbd 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1976,7 +1976,8 @@ QImage::Format QImage::format() const
}
/*!
- \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const
+ \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const &
+ \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) &&
Returns a copy of the image in the given \a format.
@@ -2134,8 +2135,8 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
/*!
\since 5.9
- Changes the \a format of the image without changing the data. Only
- works between formats of the same depth.
+ Changes the format of the image to \a format without changing the
+ data. Only works between formats of the same depth.
Returns \c true if successful.
@@ -2988,7 +2989,9 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
}
/*!
- \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) const
+ \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) const &
+ \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) &&
+
Returns a mirror of the image, mirrored in the horizontal and/or
the vertical direction depending on whether \a horizontal and \a
vertical are set to true or false.
@@ -3193,7 +3196,9 @@ void QImage::mirrored_inplace(bool horizontal, bool vertical)
}
/*!
- \fn QImage QImage::rgbSwapped() const
+ \fn QImage QImage::rgbSwapped() const &
+ \fn QImage QImage::rgbSwapped() &&
+
Returns a QImage in which the values of the red and blue
components of all pixels have been swapped, effectively converting
an RGB image to an BGR image.
@@ -3262,14 +3267,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++) {
@@ -3353,14 +3375,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;
@@ -4779,8 +4814,8 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
QDebug operator<<(QDebug dbg, const QImage &i)
{
QDebugStateSaver saver(dbg);
- dbg.resetFormat();
dbg.nospace();
+ dbg.noquote();
dbg << "QImage(";
if (i.isNull()) {
dbg << "null";
@@ -4788,8 +4823,15 @@ QDebug operator<<(QDebug dbg, const QImage &i)
dbg << i.size() << ",format=" << i.format() << ",depth=" << i.depth();
if (i.colorCount())
dbg << ",colorCount=" << i.colorCount();
+ const int bytesPerLine = i.bytesPerLine();
dbg << ",devicePixelRatio=" << i.devicePixelRatio()
- << ",bytesPerLine=" << i.bytesPerLine() << ",sizeInBytes=" << i.sizeInBytes();
+ << ",bytesPerLine=" << bytesPerLine << ",sizeInBytes=" << i.sizeInBytes();
+ if (dbg.verbosity() > 2 && i.height() > 0) {
+ const int outputLength = qMin(bytesPerLine, 24);
+ dbg << ",line0="
+ << QByteArray(reinterpret_cast<const char *>(i.scanLine(0)), outputLength).toHex()
+ << "...";
+ }
}
dbg << ')';
return dbg;
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 8112b8e8fd..9b76b62f24 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/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 0aadac2c62..982c9e7659 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -319,14 +319,13 @@ Qt::DropAction QDrag::start(Qt::DropActions request)
to override the default native cursors. To revert to using the
native cursor for \a action pass in a null QPixmap as \a cursor.
- The \a action can only be CopyAction, MoveAction or LinkAction.
- All other values of DropAction are ignored.
+ Note: setting the drag cursor for IgnoreAction may not work on
+ all platforms. X11 and macOS has been tested to work. Windows
+ does not support it.
*/
void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)
{
Q_D(QDrag);
- if (action != Qt::CopyAction && action != Qt::MoveAction && action != Qt::LinkAction)
- return;
if (cursor.isNull())
d->customCursors.remove(action);
else
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 139b36ef71..be8ce1a011 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -694,6 +694,13 @@ QHoverEvent::~QHoverEvent()
*/
/*!
+ \enum QWheelEvent::anonymous
+ \internal
+
+ \value DefaultDeltasPerStep Defaqult deltas per step
+*/
+
+/*!
\fn Qt::MouseButtons QWheelEvent::buttons() const
Returns the mouse state when the event occurred.
@@ -2400,8 +2407,9 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
The \a tangentialPressure parameter contins the tangential pressure of an air
brush. If the device does not support tangential pressure, pass 0 here.
- \a rotation contains the device's rotation in degrees. 4D mice and the Wacom
- Art Pen support rotation. If the device does not support rotation, pass 0 here.
+ \a rotation contains the device's rotation in degrees.
+ 4D mice, the Wacom Art Pen, and the Apple Pencil support rotation.
+ If the device does not support rotation, pass 0 here.
The \a button that caused the event is given as a value from the
\l Qt::MouseButton enum. If the event \a type is not \l TabletPress or
@@ -2542,10 +2550,12 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn qreal QTabletEvent::rotation() const
- Returns the rotation of the current device in degress. This is usually
- given by a 4D Mouse. If the device does not support rotation this value is
- always 0.0.
-
+ Returns the rotation of the current tool in degrees, where zero means the
+ tip of the stylus is pointing towards the top of the tablet, a positive
+ value means it's turned to the right, and a negative value means it's
+ turned to the left. This can be given by a 4D Mouse or a rotation-capable
+ stylus (such as the Wacom Art Pen or the Apple Pencil). If the device does
+ not support rotation, this value is always 0.0.
*/
/*!
@@ -4506,7 +4516,7 @@ QTouchEvent::TouchPoint::TouchPoint(int id)
{ }
/*!
- \fn TouchPoint::TouchPoint(const TouchPoint &other)
+ \fn QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
\internal
Constructs a copy of \a other.
@@ -5048,12 +5058,12 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
}
/*!
- \fn TouchPoint &TouchPoint::operator=(const TouchPoint &other)
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
\internal
*/
/*!
- \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other)
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(QTouchEvent::TouchPoint &&other)
\internal
*/
/*!
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 8996e1d7e6..3d85f47f34 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -53,6 +53,7 @@
#include <qpa/qplatformdrag.h>
#include <QtCore/QAbstractEventDispatcher>
+#include <QtCore/QStandardPaths>
#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
@@ -190,7 +191,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;
@@ -244,6 +245,15 @@ static inline void clearFontUnlocked()
QGuiApplicationPrivate::app_font = 0;
}
+static bool checkRunningUnderFlatpak()
+{
+#if QT_CONFIG(dbus)
+ return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
+#else
+ return false;
+#endif // QT_CONFIG(dbus)
+}
+
// Using aggregate initialization instead of ctor so we can have a POD global static
#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER { Qt::TopLeftCorner, -1, -1, -1, -1 }
@@ -748,7 +758,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();
@@ -1140,8 +1150,14 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) {
QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
- QString fatalMessage
- = QStringLiteral("This application failed to start because it could not find or load the Qt platform plugin \"%1\"\nin \"%2\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ QString fatalMessage;
+ if (keys.contains(name)) {
+ fatalMessage = QStringLiteral("This application failed to start because it could not load the Qt platform plugin \"%2\"\nin \"%3\", even though it was found. ").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ fatalMessage += QStringLiteral("This is usually due to missing dependencies, which you can verify by setting the env variable QT_DEBUG_PLUGINS to 1.\n\n");
+ } else {
+ fatalMessage = QStringLiteral("This application failed to start because it could not find the Qt platform plugin \"%2\"\nin \"%3\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ }
+
if (!keys.isEmpty()) {
fatalMessage += QStringLiteral("Available platform plugins are: %1.\n\n").arg(
keys.join(QLatin1String(", ")));
@@ -1173,16 +1189,21 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (!platformThemeName.isEmpty())
themeNames.append(platformThemeName);
- // 2) Ask the platform integration for a list of theme names
+ // 2) Special case - check whether we are in sandbox to use flatpak platform theme for portals support
+ if (checkRunningUnderFlatpak()) {
+ themeNames.append(QStringLiteral("flatpak"));
+ }
+
+ // 3) Ask the platform integration for a list of theme names
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
- // 3) Look for a theme plugin.
+ // 4) Look for a theme plugin.
for (const QString &themeName : qAsConst(themeNames)) {
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
if (QGuiApplicationPrivate::platform_theme)
break;
}
- // 4) If no theme plugin was found ask the platform integration to
+ // 5) If no theme plugin was found ask the platform integration to
// create a theme
if (!QGuiApplicationPrivate::platform_theme) {
for (const QString &themeName : qAsConst(themeNames)) {
@@ -1193,7 +1214,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// No error message; not having a theme plugin is allowed.
}
- // 5) Fall back on the built-in "null" platform theme.
+ // 6) Fall back on the built-in "null" platform theme.
if (!QGuiApplicationPrivate::platform_theme)
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
@@ -1527,7 +1548,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
cleanupThreadData();
delete QGuiApplicationPrivate::styleHints;
- QGuiApplicationPrivate::styleHints = Q_NULLPTR;
+ QGuiApplicationPrivate::styleHints = nullptr;
delete inputMethod;
qt_cleanupFontDatabase();
@@ -1650,10 +1671,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 +1757,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;
@@ -1846,29 +1866,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());
@@ -1889,44 +1991,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;
@@ -1937,14 +2001,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()) {
@@ -1960,7 +2024,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;
@@ -1978,7 +2042,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;
@@ -1997,9 +2061,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);
}
@@ -2363,7 +2427,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
localValid = false;
}
if (type == QEvent::TabletRelease)
- pointData.target = Q_NULLPTR;
+ pointData.target = nullptr;
if (!window)
return;
}
@@ -2380,20 +2444,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)
@@ -2499,7 +2573,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);
}
@@ -2512,8 +2586,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);
@@ -2710,25 +2786,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);
@@ -3018,6 +3110,15 @@ void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
}
/*!
+ \since 5.11
+ \fn void QGuiApplication::fontChanged(const QFont &font)
+
+ This signal is emitted when the \a font of the application changes.
+
+ \sa font()
+*/
+
+/*!
Returns the default application font.
\sa setFont()
@@ -3038,11 +3139,16 @@ QFont QGuiApplication::font()
void QGuiApplication::setFont(const QFont &font)
{
QMutexLocker locker(&applicationFontMutex);
+ const bool emitChange = !QGuiApplicationPrivate::app_font
+ || (*QGuiApplicationPrivate::app_font != font);
if (!QGuiApplicationPrivate::app_font)
QGuiApplicationPrivate::app_font = new QFont(font);
else
*QGuiApplicationPrivate::app_font = font;
applicationResourceFlags |= ApplicationFontExplicitlySet;
+
+ if (emitChange && qGuiApp)
+ emit qGuiApp->fontChanged(*QGuiApplicationPrivate::app_font);
}
/*!
@@ -3520,7 +3626,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();
}
@@ -3719,7 +3825,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..02dffef0fe 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
@@ -187,10 +187,11 @@ Q_SIGNALS:
#endif
void paletteChanged(const QPalette &pal);
void applicationDisplayNameChanged();
+ void fontChanged(const QFont &font);
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 becaa7ceb3..75cbc7abde 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();
@@ -215,7 +215,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 078f185d08..8689f9f3b1 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/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 6bdfd84ca3..82b88e5d99 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -59,7 +59,7 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
#endif
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
void qt_set_sequence_auto_mnemonic(bool b);
#endif
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/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index ad134ebe7f..fbadb48f70 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -297,6 +297,7 @@ void QColorDialogStaticData::writeSettings() const
{
#ifndef QT_NO_SETTINGS
if (customSet) {
+ const_cast<QColorDialogStaticData*>(this)->customSet = false;
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
for (int i = 0; i < int(CustomColorCount); ++i)
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
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/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 873ec3a33b..151151de23 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -629,7 +629,7 @@ void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const
Q_UNUSED(icon);
}
-#if QT_CONFIG(vulkan)
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
/*!
Factory function for QPlatformVulkanInstance. The \a instance parameter is a
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index eeaa7574f7..a7d9a87502 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -192,7 +192,7 @@ public:
virtual void beep() const;
-#if QT_CONFIG(vulkan)
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const;
#endif
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/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index cd3966fb47..1856952805 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -516,6 +516,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(QString());
case QPlatformTheme::IconThemeSearchPaths:
return QVariant(QStringList());
+ case QPlatformTheme::IconFallbackSearchPaths:
+ return QVariant(QStringList());
case QPlatformTheme::StyleNames:
return QVariant(QStringList());
case QPlatformTheme::ShowShortcutsInContextMenus:
@@ -747,8 +749,7 @@ QString QPlatformTheme::removeMnemonics(const QString &original)
int currPos = 0;
int l = original.length();
while (l) {
- if (original.at(currPos) == QLatin1Char('&')
- && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
+ if (original.at(currPos) == QLatin1Char('&')) {
++currPos;
--l;
if (l == 0)
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index f4ff418db6..87873d446f 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -116,7 +116,8 @@ public:
MouseDoubleClickDistance,
WheelScrollLines,
TouchDoubleTapDistance,
- ShowShortcutsInContextMenus
+ ShowShortcutsInContextMenus,
+ IconFallbackSearchPaths
};
enum DialogType {
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 7a4be7b8a8..4bf96e277f 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 cf5f38d249..61f1cb624c 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.cpp b/src/gui/kernel/qwindow.cpp
index 3e5777ad49..2c7e061bcf 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2841,7 +2841,7 @@ QDebug operator<<(QDebug debug, const QWindow *window)
}
#endif // !QT_NO_DEBUG_STREAM
-#if QT_CONFIG(vulkan)
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
/*!
Associates this window with the specified Vulkan \a instance.
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 44ff054fa3..439e62d0bd 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -88,7 +88,7 @@ class QWindowContainer;
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
#endif
-#if QT_CONFIG(vulkan)
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
class QVulkanInstance;
#endif
@@ -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);
@@ -270,7 +270,7 @@ public:
static QWindow *fromWinId(WId id);
-#if QT_CONFIG(vulkan)
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
void setVulkanInstance(QVulkanInstance *instance);
QVulkanInstance *vulkanInstance() const;
#endif
@@ -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)
@@ -378,14 +378,15 @@ private:
};
#ifndef Q_QDOC
+// should these be seen by clang-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 c47d940e4a..35a9ede227 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -348,35 +348,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);
}
@@ -1014,11 +1058,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 bd6416cc95..b22495f9d0 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 f781d6e3b8..c3fb19d21a 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,
@@ -235,18 +235,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 {
@@ -523,7 +532,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/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 95312bcbe4..b144d132d0 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -61,13 +61,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix()
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix()
Constructs a NxM identity matrix.
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(Qt::Initialization)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(Qt::Initialization)
\since 5.5
\internal
@@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(const T *values)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(const T *values)
Constructs a matrix from the given N * M floating-point \a values.
The contents of the array \a values is assumed to be in
@@ -85,21 +85,21 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T& QGenericMatrix::operator()(int row, int column) const
+ \fn template <int N, int M, typename T> const T& QGenericMatrix<N, M, T>::operator()(int row, int column) const
Returns a constant reference to the element at position
(\a row, \a column) in this matrix.
*/
/*!
- \fn T& QGenericMatrix::operator()(int row, int column)
+ \fn template <int N, int M, typename T> T& QGenericMatrix<N, M, T>::operator()(int row, int column)
Returns a reference to the element at position (\a row, \a column)
in this matrix so that the element can be assigned to.
*/
/*!
- \fn bool QGenericMatrix::isIdentity() const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::isIdentity() const
Returns \c true if this matrix is the identity; false otherwise.
@@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QGenericMatrix::setToIdentity()
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::setToIdentity()
Sets this matrix to the identity.
@@ -115,77 +115,77 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QGenericMatrix::fill(T value)
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::fill(T value)
Fills all elements of this matrix with \a value.
*/
/*!
- \fn QGenericMatrix<M, N> QGenericMatrix::transposed() const
+ \fn template <int N, int M, typename T> QGenericMatrix<M, N> QGenericMatrix<N, M, T>::transposed() const
Returns this matrix, transposed about its diagonal.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator+=(const QGenericMatrix<N, M, T>& other)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other)
Adds the contents of \a other to this matrix.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator-=(const QGenericMatrix<N, M, T>& other)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other)
Subtracts the contents of \a other from this matrix.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator*=(T factor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor)
Multiplies all elements of this matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator/=(T divisor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor)
Divides all elements of this matrix by \a divisor.
*/
/*!
- \fn bool QGenericMatrix::operator==(const QGenericMatrix<N, M, T>& other) const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const
Returns \c true if this matrix is identical to \a other; false otherwise.
*/
/*!
- \fn bool QGenericMatrix::operator!=(const QGenericMatrix<N, M, T>& other) const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const
Returns \c true if this matrix is not identical to \a other; false otherwise.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
\relates QGenericMatrix
Returns the sum of \a m1 and \a m2.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
\relates QGenericMatrix
Returns the difference of \a m1 and \a m2.
*/
/*!
- \fn QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2)
+ \fn template<int NN, int M1, int M2, typename TT> QGenericMatrix<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2)
\relates QGenericMatrix
- Returns the product of the NxM2 matrix \a m1 and the M1xN matrix \a m2
+ Returns the product of the NNxM2 matrix \a m1 and the M1xNN matrix \a m2
to produce a M1xM2 matrix result.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
\overload
\relates QGenericMatrix
@@ -193,35 +193,35 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
\relates QGenericMatrix
Returns the result of multiplying all elements of \a matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
\relates QGenericMatrix
Returns the result of multiplying all elements of \a matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
\relates QGenericMatrix
Returns the result of dividing all elements of \a matrix by \a divisor.
*/
/*!
- \fn void QGenericMatrix::copyDataTo(T *values) const
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::copyDataTo(T *values) const
Retrieves the N * M items in this matrix and copies them to \a values
in row-major order.
*/
/*!
- \fn T *QGenericMatrix::data()
+ \fn template <int N, int M, typename T> T *QGenericMatrix<N, M, T>::data()
Returns a pointer to the raw data of this matrix.
@@ -229,7 +229,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T *QGenericMatrix::data() const
+ \fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::data() const
Returns a constant pointer to the raw data of this matrix.
@@ -237,7 +237,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T *QGenericMatrix::constData() const
+ \fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::constData() const
Returns a constant pointer to the raw data of this matrix.
@@ -247,7 +247,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DATASTREAM
/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
+ \fn template <int N, int M, typename T> QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
\relates QGenericMatrix
Writes the given \a matrix to the given \a stream and returns a
@@ -257,7 +257,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
+ \fn template <int N, int M, typename T> QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
\relates QGenericMatrix
Reads a NxM matrix from the given \a stream into the given \a matrix
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index d016f07522..045fa210c4 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -126,7 +126,7 @@ QMatrix4x4::QMatrix4x4(const float *values)
*/
/*!
- \fn QMatrix4x4::QMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
+ \fn template <int N, int M> QMatrix4x4::QMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
Constructs a 4x4 matrix from the left-most 4 columns and top-most
4 rows of \a matrix. If \a matrix has less than 4 columns or rows,
@@ -146,7 +146,7 @@ QMatrix4x4::QMatrix4x4(const float *values)
*/
/*!
- \fn QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
+ \fn template <int N, int M> QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
\relates QMatrix4x4
\obsolete
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..469f019a1c 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -816,7 +816,7 @@ static inline GLenum effectiveInternalFormat(GLenum internalFormat)
return internalFormat;
}
-/*! \fn QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target)
+/*!
Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the size \a size. The texture is bound to the
@@ -847,7 +847,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
d->init(this, size, NoAttachment, target, effectiveInternalFormat(0));
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the given \a width and \a height.
@@ -859,7 +859,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
{
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object of the given \a size based on the
supplied \a format.
@@ -873,7 +873,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpe
format.samples(), format.mipmap());
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object of the given \a width and \a height
based on the supplied \a format.
@@ -884,7 +884,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const
{
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a texture to the
buffer of the given \a width and \a height.
@@ -905,7 +905,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
d->init(this, QSize(width, height), attachment, target, effectiveInternalFormat(internalFormat));
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a texture to the
buffer of the given \a size.
@@ -927,7 +927,6 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
}
/*!
- \fn QOpenGLFramebufferObject::~QOpenGLFramebufferObject()
Destroys the framebuffer object and frees any allocated resources.
*/
@@ -953,7 +952,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 +1115,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 +1471,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/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index b9e61e9ee4..161054d1bf 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -49,8 +49,18 @@
#include <QtCore/qscopedpointer.h>
-QT_BEGIN_NAMESPACE
+#if defined(Q_CLANG_QDOC)
+#undef GLuint
+typedef unsigned int GLuint;
+#undef GLenum
+typedef unsigned int GLenum;
+#undef GL_TEXTURE_2D
+#define GL_TEXTURE_2D 0x0DE1
+#undef GLbitfield
+typedef unsigned int GLbitfield;
+#endif
+QT_BEGIN_NAMESPACE
class QOpenGLFramebufferObjectPrivate;
class QOpenGLFramebufferObjectFormat;
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index f2bc357c3a..ff044a91da 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
}
@@ -2584,7 +2584,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glEndTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glEndTransformFeedback()
Convenience function that calls glEndTransformFeedback().
@@ -3091,7 +3091,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glPauseTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glPauseTransformFeedback()
Convenience function that calls glPauseTransformFeedback().
@@ -3156,7 +3156,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glResumeTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glResumeTransformFeedback()
Convenience function that calls glResumeTransformFeedback().
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 0a5de2c9af..72af128219 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -227,6 +227,29 @@ struct QOpenGLFunctionsPrivate;
#undef glTexLevelParameteriv
+#if defined(Q_CLANG_QDOC)
+#undef GLint
+typedef int GLint;
+#undef GLsizei
+typedef int GLsizei;
+#undef GLuint
+typedef unsigned int GLuint;
+#undef GLenum
+typedef unsigned int GLenum;
+#undef GLbitfield
+typedef unsigned int GLbitfield;
+#undef GLfloat
+typedef float GLfloat;
+#undef GLclampf
+typedef float GLclampf;
+#undef GLboolean
+typedef bool GLboolean;
+#undef GLvoid
+typedef void GLvoid;
+#undef GLchar
+typedef char GLchar;
+#endif
+
class Q_GUI_EXPORT QOpenGLFunctions
{
public:
@@ -413,7 +436,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.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index cc8af16bfe..b044397f8e 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -562,7 +562,7 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source
break;
}
state = Normal;
- // fall through
+ Q_FALLTHROUGH();
case Normal:
if (*c == '/')
state = CommentStarting;
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/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index e1601d87dc..2249859c43 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -293,103 +293,6 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
}
#endif
-// ---------------------- Color Management ----------------------
-
-static CGColorSpaceRef m_genericColorSpace = 0;
-static QHash<uint32_t, CGColorSpaceRef> m_displayColorSpaceHash;
-static bool m_postRoutineRegistered = false;
-
-static void qt_mac_cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<uint32_t, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
-static CGColorSpaceRef qt_mac_displayColorSpace(const QWindow *window)
-{
- CGColorSpaceRef colorSpace = 0;
- uint32_t displayID = 0;
-
-#ifdef Q_OS_MACOS
- if (window == 0) {
- displayID = CGMainDisplayID();
- } else {
- displayID = CGMainDisplayID();
- /*
- ### get correct display
- const QRect &qrect = window->geometry();
- CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
- CGDisplayCount throwAway;
- CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
- if (dErr != kCGErrorSuccess)
- return macDisplayColorSpace(0); // fall back on main display
- */
- }
- if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
- return colorSpace;
-
- colorSpace = CGDisplayCopyColorSpace(displayID);
-#else
- Q_UNUSED(window);
-#endif
-
- if (colorSpace == 0)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- m_displayColorSpaceHash.insert(displayID, colorSpace);
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
- }
- return colorSpace;
-}
-
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
-{
- Q_UNUSED(paintDevice);
-
- // FIXME: Move logic into each paint device once Qt has support for color spaces
- return qt_mac_displayColorSpace(0);
-
- // The following code seems to take care of QWidget, but in reality doesn't, as
- // qt_mac_displayColorSpace ignores the argument and always uses the main display.
-#if 0
- bool isWidget = (paintDevice->devType() == QInternal::Widget);
- return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice)->window() : 0);
-#endif
-}
-
-CGColorSpaceRef qt_mac_genericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return qt_mac_displayColorSpace(0);
-#endif
-}
-
// ---------------------- Geometry Helpers ----------------------
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
@@ -459,12 +362,13 @@ QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0)
if (!image)
return; // Context type not supported.
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintDevice);
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
uint flags = kCGImageAlphaPremultipliedFirst;
flags |= kCGBitmapByteOrder32Host;
context = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
+ 8, image->bytesPerLine(), colorSpace, flags);
+ CFRelease(colorSpace);
CGContextTranslateCTM(context, 0, image->height());
const qreal devicePixelRatio = paintDevice->devicePixelRatioF();
CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
@@ -492,7 +396,7 @@ QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
devType == QInternal::Pixmap ||
devType == QInternal::Image)) {
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintEngine->paintDevice());
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
uint flags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
flags |= kCGBitmapByteOrder32Host;
@@ -500,7 +404,8 @@ QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
const QImage *image = static_cast<const QImage *>(paintEngine->paintDevice());
context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
+ 8, image->bytesPerLine(), colorSpace, flags);
+ CFRelease(colorSpace);
// Invert y axis
CGContextTranslateCTM(context, 0, image->height());
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index 6b6a1e800e..de721c94aa 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -75,9 +75,6 @@ Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
-Q_GUI_EXPORT CGColorSpaceRef qt_mac_genericColorSpace();
-Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
-
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
#ifdef HAVE_APPKIT
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 6bfdc940ac..6ddfcdfaf4 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6399,12 +6399,19 @@ static void qInitDrawhelperFunctions()
qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ extern void QT_FASTCALL comp_func_Source_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_rgb64_avx2(QRgba64 *destPixels, const QRgba64 *srcPixels, int length, uint const_alpha);
extern void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_SourceOver_rgb64_avx2(QRgba64 *destPixels, const QRgba64 *srcPixels, int length, uint const_alpha);
extern void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha);
- extern void QT_FASTCALL comp_func_Source_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_rgb64_avx2(QRgba64 *destPixels, int length, QRgba64 color, uint const_alpha);
+
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2;
+ qt_functionForMode64_C[QPainter::CompositionMode_Source] = comp_func_Source_rgb64_avx2;
qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_avx2;
+ qt_functionForMode64_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_rgb64_avx2;
qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_avx2;
- qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2;
+ qt_functionForModeSolid64_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_rgb64_avx2;
extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2(uint *b, uint *end, const QTextureData &image,
int &fx, int &fy, int fdx, int /*fdy*/);
@@ -6444,7 +6451,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_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index 2619539788..cf89f408b5 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -39,6 +39,7 @@
#include "qdrawhelper_p.h"
#include "qdrawingprimitive_sse2_p.h"
+#include "qrgba64_p.h"
#if defined(QT_COMPILER_SUPPORTS_AVX2)
@@ -73,6 +74,25 @@ inline static void BYTE_MUL_AVX2(__m256i &pixelVector, const __m256i &alphaChann
pixelVector = _mm256_or_si256(pixelVectorAG, pixelVectorRB);
}
+inline static void BYTE_MUL_RGB64_AVX2(__m256i &pixelVector, const __m256i &alphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ __m256i pixelVectorAG = _mm256_srli_epi32(pixelVector, 16);
+ __m256i pixelVectorRB = _mm256_and_si256(pixelVector, colorMask);
+
+ pixelVectorAG = _mm256_mullo_epi32(pixelVectorAG, alphaChannel);
+ pixelVectorRB = _mm256_mullo_epi32(pixelVectorRB, alphaChannel);
+
+ pixelVectorRB = _mm256_add_epi32(pixelVectorRB, _mm256_srli_epi32(pixelVectorRB, 16));
+ pixelVectorAG = _mm256_add_epi32(pixelVectorAG, _mm256_srli_epi32(pixelVectorAG, 16));
+ pixelVectorRB = _mm256_add_epi32(pixelVectorRB, half);
+ pixelVectorAG = _mm256_add_epi32(pixelVectorAG, half);
+
+ pixelVectorRB = _mm256_srli_epi32(pixelVectorRB, 16);
+ pixelVectorAG = _mm256_andnot_si256(colorMask, pixelVectorAG);
+
+ pixelVector = _mm256_or_si256(pixelVectorAG, pixelVectorRB);
+}
+
// See INTERPOLATE_PIXEL_255_SSE2 for details.
inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
{
@@ -96,6 +116,29 @@ inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i
dstVector = _mm256_or_si256(finalAG, finalRB);
}
+inline static void INTERPOLATE_PIXEL_RGB64_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ const __m256i srcVectorAG = _mm256_srli_epi32(srcVector, 16);
+ const __m256i dstVectorAG = _mm256_srli_epi32(dstVector, 16);
+ const __m256i srcVectorRB = _mm256_and_si256(srcVector, colorMask);
+ const __m256i dstVectorRB = _mm256_and_si256(dstVector, colorMask);
+ const __m256i srcVectorAGalpha = _mm256_mullo_epi32(srcVectorAG, alphaChannel);
+ const __m256i srcVectorRBalpha = _mm256_mullo_epi32(srcVectorRB, alphaChannel);
+ const __m256i dstVectorAGoneMinusAlpha = _mm256_mullo_epi32(dstVectorAG, oneMinusAlphaChannel);
+ const __m256i dstVectorRBoneMinusAlpha = _mm256_mullo_epi32(dstVectorRB, oneMinusAlphaChannel);
+ __m256i finalAG = _mm256_add_epi32(srcVectorAGalpha, dstVectorAGoneMinusAlpha);
+ __m256i finalRB = _mm256_add_epi32(srcVectorRBalpha, dstVectorRBoneMinusAlpha);
+ finalAG = _mm256_add_epi32(finalAG, _mm256_srli_epi32(finalAG, 16));
+ finalRB = _mm256_add_epi32(finalRB, _mm256_srli_epi32(finalRB, 16));
+ finalAG = _mm256_add_epi32(finalAG, half);
+ finalRB = _mm256_add_epi32(finalRB, half);
+ finalAG = _mm256_andnot_si256(colorMask, finalAG);
+ finalRB = _mm256_srli_epi32(finalRB, 16);
+
+ dstVector = _mm256_or_si256(finalAG, finalRB);
+}
+
+
// See BLEND_SOURCE_OVER_ARGB32_SSE2 for details.
inline static void BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
{
@@ -288,6 +331,64 @@ void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixe
BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(dst, src, length, const_alpha);
}
+void QT_FASTCALL comp_func_SourceOver_rgb64_avx2(QRgba64 *dst, const QRgba64 *src, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ const __m256i half = _mm256_set1_epi32(0x8000);
+ const __m256i one = _mm256_set1_epi32(0xffff);
+ const __m256i colorMask = _mm256_set1_epi32(0x0000ffff);
+ __m256i alphaMask = _mm256_set1_epi32(0xff000000);
+ alphaMask = _mm256_unpacklo_epi8(alphaMask, alphaMask);
+ const __m256i alphaShuffleMask = _mm256_set_epi8(char(0xff),char(0xff),15,14,char(0xff),char(0xff),15,14,char(0xff),char(0xff),7,6,char(0xff),char(0xff),7,6,
+ char(0xff),char(0xff),15,14,char(0xff),char(0xff),15,14,char(0xff),char(0xff),7,6,char(0xff),char(0xff),7,6);
+
+ if (const_alpha == 255) {
+ int x = 0;
+ for (; x < length && (quintptr(dst + x) & 31); ++x)
+ blend_pixel(dst[x], src[x]);
+ for (; x < length - 3; x += 4) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ // Not all transparent
+ if (_mm256_testc_si256(srcVector, alphaMask)) {
+ // All opaque
+ _mm256_store_si256((__m256i *)&dst[x], srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi32(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_RGB64_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi16(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ }
+ SIMD_EPILOGUE(x, length, 3)
+ blend_pixel(dst[x], src[x]);
+ } else {
+ const __m256i constAlphaVector = _mm256_set1_epi32(const_alpha | (const_alpha << 8));
+ int x = 0;
+ for (; x < length && (quintptr(dst + x) & 31); ++x)
+ blend_pixel(dst[x], src[x], const_alpha);
+ for (; x < length - 3; x += 4) {
+ __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ // Not all transparent
+ BYTE_MUL_RGB64_AVX2(srcVector, constAlphaVector, colorMask, half);
+
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi32(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_RGB64_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi16(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ SIMD_EPILOGUE(x, length, 3)
+ blend_pixel(dst[x], src[x], const_alpha);
+ }
+}
+
void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255) {
@@ -319,6 +420,39 @@ void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, u
}
}
+void QT_FASTCALL comp_func_Source_rgb64_avx2(QRgba64 *dst, const QRgba64 *src, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ if (const_alpha == 255) {
+ ::memcpy(dst, src, length * sizeof(QRgba64));
+ } else {
+ const uint ca = const_alpha | (const_alpha << 8); // adjust to [0-65535]
+ const uint cia = 65535 - const_alpha;
+
+ int x = 0;
+
+ // 1) prologue, align on 32 bytes
+ for (; x < length && (quintptr(dst + x) & 31); ++x)
+ dst[x] = interpolate65535(src[x], ca, dst[x], cia);
+
+ // 2) interpolate pixels with AVX2
+ const __m256i half = _mm256_set1_epi32(0x8000);
+ const __m256i colorMask = _mm256_set1_epi32(0x0000ffff);
+ const __m256i constAlphaVector = _mm256_set1_epi32(ca);
+ const __m256i oneMinusConstAlpha = _mm256_set1_epi32(cia);
+ for (; x < length - 3; x += 4) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_RGB64_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+
+ // 3) Epilogue
+ SIMD_EPILOGUE(x, length, 3)
+ dst[x] = interpolate65535(src[x], ca, dst[x], cia);
+ }
+}
+
void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
@@ -350,6 +484,37 @@ void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, u
}
}
+void QT_FASTCALL comp_func_solid_SourceOver_rgb64_avx2(QRgba64 *destPixels, int length, QRgba64 color, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ if (const_alpha == 255 && color.isOpaque()) {
+ qt_memfill64((quint64*)destPixels, color, length);
+ } else {
+ if (const_alpha != 255)
+ color = multiplyAlpha255(color, const_alpha);
+
+ const uint minusAlphaOfColor = ~ushort(color.alpha());
+ int x = 0;
+ quint64 *dst = (quint64 *) destPixels;
+ const __m256i colorVector = _mm256_set1_epi64x(color);
+ const __m256i colorMask = _mm256_set1_epi32(0x0000ffff);
+ const __m256i half = _mm256_set1_epi32(0x8000);
+ const __m256i minusAlphaOfColorVector = _mm256_set1_epi32(minusAlphaOfColor);
+
+ for (; x < length && (quintptr(dst + x) & 31); ++x)
+ destPixels[x] = color + multiplyAlpha65535(destPixels[x], minusAlphaOfColor);
+
+ for (; x < length - 3; x += 4) {
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_RGB64_AVX2(dstVector, minusAlphaOfColorVector, colorMask, half);
+ dstVector = _mm256_add_epi16(colorVector, dstVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ SIMD_EPILOGUE(x, length, 3)
+ destPixels[x] = color + multiplyAlpha65535(destPixels[x], minusAlphaOfColor);
+ }
+}
+
#define interpolate_4_pixels_16_avx2(tlr1, tlr2, blr1, blr2, distx, disty, colorMask, v_256, b) \
{ \
/* Correct for later unpack */ \
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 df9f762314..4c2fe87355 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.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 1637a933b1..0e3163eefb 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3782,8 +3782,8 @@ void QClipData::initialize()
}
} else if (hasRegionClip) {
- const QVector<QRect> rects = clipRegion.rects();
- const int numRects = rects.size();
+ const auto rects = clipRegion.begin();
+ const int numRects = clipRegion.rectCount();
{ // resize
const int maxSpans = (ymax - ymin) * numRects;
@@ -3797,8 +3797,8 @@ void QClipData::initialize()
int firstInBand = 0;
count = 0;
while (firstInBand < numRects) {
- const int currMinY = rects.at(firstInBand).y();
- const int currMaxY = currMinY + rects.at(firstInBand).height();
+ const int currMinY = rects[firstInBand].y();
+ const int currMaxY = currMinY + rects[firstInBand].height();
while (y < currMinY) {
m_clipLines[y].spans = 0;
@@ -3807,7 +3807,7 @@ void QClipData::initialize()
}
int lastInBand = firstInBand;
- while (lastInBand + 1 < numRects && rects.at(lastInBand+1).top() == y)
+ while (lastInBand + 1 < numRects && rects[lastInBand+1].top() == y)
++lastInBand;
while (y < currMaxY) {
@@ -3816,7 +3816,7 @@ void QClipData::initialize()
m_clipLines[y].count = lastInBand - firstInBand + 1;
for (int r = firstInBand; r <= lastInBand; ++r) {
- const QRect &currRect = rects.at(r);
+ const QRect &currRect = rects[r];
QSpan *span = m_spans + count;
span->x = currRect.x();
span->len = currRect.width();
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.cpp b/src/gui/painting/qpaintengineex.cpp
index 812cb8c02d..0643a7cbb6 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -619,18 +619,17 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op)
void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
{
- if (region.rectCount() == 1)
- clip(region.boundingRect(), op);
-
- QVector<QRect> rects = region.rects();
- if (rects.size() <= 32) {
+ const auto rectsInRegion = region.rectCount();
+ if (rectsInRegion == 1) {
+ clip(*region.begin(), op);
+ } else if (rectsInRegion <= 32) {
qreal pts[2*32*4];
int pos = 0;
- for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
- qreal x1 = i->x();
- qreal y1 = i->y();
- qreal x2 = i->x() + i->width();
- qreal y2 = i->y() + i->height();
+ for (QRect r : region) {
+ qreal x1 = r.x();
+ qreal y1 = r.y();
+ qreal x2 = r.x() + r.width();
+ qreal y2 = r.y() + r.height();
pts[pos++] = x1;
pts[pos++] = y1;
@@ -644,19 +643,19 @@ void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
pts[pos++] = x1;
pts[pos++] = y2;
}
- QVectorPath vp(pts, rects.size() * 4, qpaintengineex_rect4_types_32);
+ QVectorPath vp(pts, rectsInRegion * 4, qpaintengineex_rect4_types_32);
clip(vp, op);
} else {
- QVarLengthArray<qreal> pts(rects.size() * 2 * 4);
- QVarLengthArray<QPainterPath::ElementType> types(rects.size() * 4);
+ QVarLengthArray<qreal> pts(rectsInRegion * 2 * 4);
+ QVarLengthArray<QPainterPath::ElementType> types(rectsInRegion * 4);
int ppos = 0;
int tpos = 0;
- for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
- qreal x1 = i->x();
- qreal y1 = i->y();
- qreal x2 = i->x() + i->width();
- qreal y2 = i->y() + i->height();
+ for (QRect r : region) {
+ qreal x1 = r.x();
+ qreal y1 = r.y();
+ qreal x2 = r.x() + r.width();
+ qreal y2 = r.y() + r.height();
pts[ppos++] = x1;
pts[ppos++] = y1;
@@ -676,7 +675,7 @@ void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
types[tpos++] = QPainterPath::LineToElement;
}
- QVectorPath vp(pts.data(), rects.size() * 4, types.data());
+ QVectorPath vp(pts.data(), rectsInRegion * 4, types.data());
clip(vp, op);
}
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 6e84a3f384..ec1b4c1310 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -4256,7 +4256,7 @@ void QPainter::drawEllipse(const QRectF &r)
}
/*!
- \fn QPainter::drawEllipse(const QRect &rectangle)
+ \fn void QPainter::drawEllipse(const QRect &rectangle)
\overload
@@ -4298,7 +4298,7 @@ void QPainter::drawEllipse(const QRect &r)
}
/*!
- \fn QPainter::drawEllipse(int x, int y, int width, int height)
+ \fn void QPainter::drawEllipse(int x, int y, int width, int height)
\overload
@@ -4309,7 +4309,7 @@ void QPainter::drawEllipse(const QRect &r)
/*!
\since 4.4
- \fn QPainter::drawEllipse(const QPointF &center, qreal rx, qreal ry)
+ \fn void QPainter::drawEllipse(const QPointF &center, qreal rx, qreal ry)
\overload
@@ -4319,7 +4319,7 @@ void QPainter::drawEllipse(const QRect &r)
/*!
\since 4.4
- \fn QPainter::drawEllipse(const QPoint &center, int rx, int ry)
+ \fn void QPainter::drawEllipse(const QPoint &center, int rx, int ry)
\overload
@@ -5744,7 +5744,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
if (d->extended == 0
|| !d->state->matrix.isAffine()
|| !fe->supportsTransformation(d->state->matrix)) {
- staticText_d->paintText(topLeftPosition, this);
+ staticText_d->paintText(topLeftPosition, this, pen().color());
return;
}
@@ -5816,11 +5816,16 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
QPen oldPen = d->state->pen;
QColor currentColor = oldPen.color();
+ static const QColor bodyIndicator(0, 0, 0, 0);
for (int i=0; i<staticText_d->itemCount; ++i) {
QStaticTextItem *item = staticText_d->items + i;
- if (item->color.isValid() && currentColor != item->color) {
- setPen(item->color);
- currentColor = item->color;
+ if (item->color.isValid() && currentColor != item->color
+ && item->color != bodyIndicator) {
+ setPen(item->color);
+ currentColor = item->color;
+ } else if (item->color == bodyIndicator) {
+ setPen(oldPen);
+ currentColor = oldPen.color();
}
d->extended->drawStaticTextItem(item);
@@ -5850,7 +5855,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();
@@ -6737,7 +6742,7 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo
}
/*!
- \fn QPainter::drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap,
+ \fn void QPainter::drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap,
const QPoint &position = QPoint())
\overload
@@ -7478,7 +7483,7 @@ start_lengthVariant:
if (!expandtabs) {
text[offset] = QLatin1Char(' ');
} else if (!tabarraylen && !tabstops) {
- tabstops = qRound(fm.width(QLatin1Char('x'))*8);
+ tabstops = qRound(fm.horizontalAdvance(QLatin1Char('x'))*8);
}
} else if (chr == QChar(ushort(0x9c))) {
// string with multiple length variants
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..77718ce747 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -81,8 +81,9 @@ QT_BEGIN_NAMESPACE
contains() a QPoint or QRect. The bounding rectangle can be found
with boundingRect().
- Iteration over the region (with begin(), end()) gives a decomposition of
- the region into rectangles. The same sequence of rectangles is returned by rects().
+ Iteration over the region (with begin(), end(), or C++11
+ ranged-for loops) gives a decomposition of the region into
+ rectangles.
Example of using complex regions:
\snippet code/src_gui_painting_qregion.cpp 0
@@ -447,19 +448,20 @@ QDebug operator<<(QDebug s, const QRegion &r)
} else if (r.isEmpty()) {
s << "empty";
} else {
- const QVector<QRect> rects = r.rects();
- const int count = rects.size();
+ const int count = r.rectCount();
if (count > 1)
s << "size=" << count << ", bounds=(";
QtDebugUtils::formatQRect(s, r.boundingRect());
if (count > 1) {
s << ") - [";
- for (int i = 0; i < count; ++i) {
- if (i)
+ bool first = true;
+ for (const QRect &rect : r) {
+ if (!first)
s << ", ";
s << '(';
- QtDebugUtils::formatQRect(s, rects.at(i));
+ QtDebugUtils::formatQRect(s, rect);
s << ')';
+ first = false;
}
s << ']';
}
@@ -740,7 +742,7 @@ bool QRegion::intersects(const QRegion &region) const
#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) || defined(Q_CLANG_QDOC)
-/*!
+/*
\overload
\since 4.4
*/
@@ -754,7 +756,8 @@ QRegion QRegion::intersect(const QRect &r) const
\fn int QRegion::rectCount() const
\since 4.6
- Returns the number of rectangles that will be returned in rects().
+ Returns the number of rectangles that this region is composed of.
+ Same as \c{end() - begin()}.
*/
/*!
@@ -916,20 +919,28 @@ QRegion QRegion::intersect(const QRect &r) const
gives a rectangle that is QRect::isNull().
*/
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
\fn QVector<QRect> QRegion::rects() const
+ \obsolete
+
+ Use begin() and end() instead.
Returns an array of non-overlapping rectangles that make up the
region.
The union of all the rectangles is equal to the original region.
*/
+#endif
/*!
\typedef QRegion::const_iterator
\since 5.8
- An iterator over the QRects that make up the region.
+ An iterator over the non-overlapping rectangles that make up the
+ region.
+
+ The union of all the rectangles is equal to the original region.
QRegion does not offer mutable iterators.
@@ -940,7 +951,10 @@ QRegion QRegion::intersect(const QRect &r) const
\typedef QRegion::const_reverse_iterator
\since 5.8
- A reverse iterator over the QRects that make up the region.
+ A reverse iterator over the non-overlapping rectangles that make up the
+ region.
+
+ The union of all the rectangles is equal to the original region.
QRegion does not offer mutable iterators.
@@ -952,8 +966,9 @@ QRegion QRegion::intersect(const QRect &r) const
\since 5.8
Returns a const_iterator pointing to the beginning of the range of
- rectangles that make up this range, in the order in which rects()
- returns them.
+ non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa rbegin(), cbegin(), end()
*/
@@ -969,9 +984,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::end() const
\since 5.8
- Returns a const_iterator pointing to one past the end of the range of
- rectangles that make up this range, in the order in which rects()
- returns them.
+ Returns a const_iterator pointing to one past the end of
+ non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa rend(), cend(), begin()
*/
@@ -987,9 +1003,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::rbegin() const
\since 5.8
- Returns a const_reverse_iterator pointing to the beginning of the range of
- rectangles that make up this range, in the reverse order in which rects()
- returns them.
+ Returns a const_reverse_iterator pointing to the beginning of the
+ range of non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa begin(), crbegin(), rend()
*/
@@ -1005,9 +1022,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::rend() const
\since 5.8
- Returns a const_reverse_iterator pointing to one past the end of the range of
- rectangles that make up this range, in the reverse order in which rects()
- returns them.
+ Returns a const_reverse_iterator pointing to one past the end of
+ the range of non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa end(), crend(), rbegin()
*/
@@ -2281,7 +2299,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 +3638,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);
@@ -4340,6 +4365,7 @@ bool qt_region_strictContains(const QRegion &region, const QRect &rect)
&& rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
}
+#if QT_DEPRECATED_SINCE(5, 11)
QVector<QRect> QRegion::rects() const
{
if (d->qt_rgn) {
@@ -4351,6 +4377,7 @@ QVector<QRect> QRegion::rects() const
return QVector<QRect>();
}
}
+#endif
QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW
{
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 8dd7649447..9fe6ed5675 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -122,7 +122,10 @@ public:
bool intersects(const QRect &r) const;
QRect boundingRect() const Q_DECL_NOTHROW;
+#if QT_DEPRECATED_SINCE(5, 11)
+ QT_DEPRECATED_X("Use begin()/end() instead")
QVector<QRect> rects() const;
+#endif
void setRects(const QRect *rect, int num);
int rectCount() const Q_DECL_NOTHROW;
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
diff --git a/src/gui/painting/qrgba64.qdoc b/src/gui/painting/qrgba64.qdoc
index 064f018210..26c78a5dcd 100644
--- a/src/gui/painting/qrgba64.qdoc
+++ b/src/gui/painting/qrgba64.qdoc
@@ -105,7 +105,7 @@
*/
/*!
- \fn QRgba64::setRed(quint16 red)
+ \fn void QRgba64::setRed(quint16 red)
Sets the red color component of this color to \a red.
@@ -121,7 +121,7 @@
*/
/*!
- \fn QRgba64::setGreen(quint16 green)
+ \fn void QRgba64::setGreen(quint16 green)
Sets the green color component of this color to \a green.
@@ -137,7 +137,7 @@
*/
/*!
- \fn QRgba64::setBlue(quint16 blue)
+ \fn void QRgba64::setBlue(quint16 blue)
Sets the blue color component of this color to \a blue.
@@ -153,7 +153,7 @@
*/
/*!
- \fn QRgba64::setAlpha(quint16 alpha)
+ \fn void QRgba64::setAlpha(quint16 alpha)
Sets the alpha of this color to \a alpha.
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index 7776a5b08a..adceda2210 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -299,6 +299,21 @@ inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha)
return blend;
}
+static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src)
+{
+ if (src.isOpaque())
+ dst = src;
+ else if (!src.isTransparent())
+ dst = src + multiplyAlpha65535(dst, 65535 - src.alpha());
+}
+
+static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src, const int const_alpha)
+{
+ if (!src.isTransparent()) {
+ src = multiplyAlpha255(src, const_alpha);
+ dst = src + multiplyAlpha65535(dst, 65535 - src.alpha());
+ }
+}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qt_mips_asm_dsp_p.h b/src/gui/painting/qt_mips_asm_dsp_p.h
index 1393a35667..172910ea1c 100644
--- a/src/gui/painting/qt_mips_asm_dsp_p.h
+++ b/src/gui/painting/qt_mips_asm_dsp_p.h
@@ -55,6 +55,7 @@
#pragma qt_sync_stop_processing
#endif
+#ifndef Q_CLANG_QDOC
#define zero $0
#define AT $1
#define v0 $2
@@ -88,6 +89,7 @@
#define fp $30
#define s8 $30
#define ra $31
+#endif
/*
* LEAF_MIPS32R2 - declare leaf_mips32r2 routine
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 33dc27983a..4be2197c68 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -804,6 +804,13 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
return alias;
}
+/*!
+ Returns a list of alternative fonts for the specified \a family and
+ \a style and \a script using the \a styleHint given.
+
+ Default implementation returns a list of fonts for which \a style and \a script support
+ has been reported during the font database population.
+*/
QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
Q_UNUSED(family);
@@ -2685,7 +2692,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 +2790,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 33df020a6c..3b64ee0136 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -992,13 +992,12 @@ void QFontEngine::removeGlyphFromCache(glyph_t)
QFontEngine::Properties QFontEngine::properties() const
{
Properties p;
- QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8());
- psname += '-';
- psname += QByteArray::number(fontDef.style);
- psname += '-';
- psname += QByteArray::number(fontDef.weight);
-
- p.postscriptName = psname;
+ p.postscriptName
+ = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8())
+ + '-'
+ + QByteArray::number(fontDef.style)
+ + '-'
+ + QByteArray::number(fontDef.weight);
p.ascent = ascent();
p.descent = descent();
p.leading = leading();
@@ -1080,7 +1079,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 +1087,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 +1233,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/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 6aca660205..36bd81c76b 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -202,7 +202,21 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_HATRAN,
HB_SCRIPT_MULTANI,
HB_SCRIPT_OLD_HUNGARIAN,
- HB_SCRIPT_SIGNWRITING
+ HB_SCRIPT_SIGNWRITING,
+
+ // Unicode 9.0 additions
+ HB_SCRIPT_ADLAM,
+ HB_SCRIPT_BHAIKSUKI,
+ HB_SCRIPT_MARCHEN,
+ HB_SCRIPT_NEWA,
+ HB_SCRIPT_OSAGE,
+ HB_SCRIPT_TANGUT,
+
+ // Unicode 10.0 additions
+ HB_SCRIPT_MASARAM_GONDI,
+ HB_SCRIPT_NUSHU,
+ HB_SCRIPT_SOYOMBO,
+ HB_SCRIPT_ZANABAZAR_SQUARE
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
@@ -422,7 +436,6 @@ hb_unicode_funcs_t *hb_qt_get_unicode_funcs()
// Font routines
-#if HB_VERSION_ATLEAST(1, 1, 3)
static hb_bool_t
_hb_qt_get_font_h_extents(hb_font_t * /*font*/, void *font_data,
hb_font_extents_t *metrics,
@@ -437,9 +450,7 @@ _hb_qt_get_font_h_extents(hb_font_t * /*font*/, void *font_data,
return true;
}
-#endif
-#if HB_VERSION_ATLEAST(1, 2, 3)
static hb_bool_t
_hb_qt_font_get_nominal_glyph(hb_font_t * /*font*/, void *font_data,
hb_codepoint_t unicode,
@@ -453,7 +464,6 @@ _hb_qt_font_get_nominal_glyph(hb_font_t * /*font*/, void *font_data,
return *glyph != 0;
}
-#endif
static hb_bool_t
_hb_qt_font_get_variation_glyph(hb_font_t * /*font*/, void *font_data,
@@ -490,17 +500,6 @@ _hb_qt_font_get_glyph_h_advance(hb_font_t *font, void *font_data,
return advance.value();
}
-#if !HB_VERSION_ATLEAST(1, 1, 2)
-static hb_bool_t
-_hb_qt_font_get_glyph_h_origin(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*glyph*/,
- hb_position_t * /*x*/, hb_position_t * /*y*/,
- void * /*user_data*/)
-{
- return true; // we always work in the horizontal coordinates
-}
-#endif
-
static hb_position_t
_hb_qt_font_get_glyph_h_kerning(hb_font_t *font, void *font_data,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
@@ -581,19 +580,10 @@ struct _hb_qt_font_funcs_t {
{
funcs = hb_font_funcs_create();
-#if HB_VERSION_ATLEAST(1, 1, 3)
hb_font_funcs_set_font_h_extents_func(funcs, _hb_qt_get_font_h_extents, NULL, NULL);
-#endif
-#if HB_VERSION_ATLEAST(1, 2, 3)
hb_font_funcs_set_nominal_glyph_func(funcs, _hb_qt_font_get_nominal_glyph, NULL, NULL);
hb_font_funcs_set_variation_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
-#else
- hb_font_funcs_set_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
-#endif
hb_font_funcs_set_glyph_h_advance_func(funcs, _hb_qt_font_get_glyph_h_advance, NULL, NULL);
-#if !HB_VERSION_ATLEAST(1, 1, 2)
- hb_font_funcs_set_glyph_h_origin_func(funcs, _hb_qt_font_get_glyph_h_origin, NULL, NULL);
-#endif
hb_font_funcs_set_glyph_h_kerning_func(funcs, _hb_qt_font_get_glyph_h_kerning, NULL, NULL);
hb_font_funcs_set_glyph_extents_func(funcs, _hb_qt_font_get_glyph_extents, NULL, NULL);
hb_font_funcs_set_glyph_contour_point_func(funcs, _hb_qt_font_get_glyph_contour_point, NULL, NULL);
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 4ad826e87b..d89805d18e 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -62,8 +62,6 @@ void qt_registerFontFamily(const QString &familyName);
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias);
/*!
- \fn void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle)
-
Registers the pre-rendered QPF2 font contained in the given \a dataArray.
\sa registerFont()
@@ -373,17 +371,6 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
/*!
- \fn QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
-
- Returns a list of alternative fonts for the specified \a family and
- \a style and \a script using the \a styleHint given.
-
- Default implementation returns a list of fonts for which \a style and \a script support
- has been reported during the font database population.
-*/
-// implemented in qfontdatabase.cpp
-
-/*!
Adds an application font described by the font contained supplied \a fontData
or using the font contained in the file referenced by \a fileName. Returns
a list of family names, or an empty list if the font could not be added.
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index dbc2e6e558..2f90754274 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -435,11 +435,11 @@ namespace {
public:
DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations)
: m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
- m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black)
+ m_untransformedCoordinates(untransformedCoordinates), m_currentColor(0, 0, 0, 0)
{
}
- 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;
}
@@ -599,7 +599,7 @@ namespace {
};
}
-void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
+void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p, const QColor &pen)
{
bool preferRichText = textFormat == Qt::RichText
|| (textFormat == Qt::AutoText && Qt::mightBeRichText(text));
@@ -631,15 +631,16 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
textLayout.endLayout();
actualSize = textLayout.boundingRect().size();
+ p->setPen(pen);
textLayout.draw(p, topLeftPosition);
} else {
QTextDocument document;
#ifndef QT_NO_CSSPARSER
- QColor color = p->pen().color();
- document.setDefaultStyleSheet(QString::fromLatin1("body { color: #%1%2%3 }")
- .arg(QString::number(color.red(), 16), 2, QLatin1Char('0'))
- .arg(QString::number(color.green(), 16), 2, QLatin1Char('0'))
- .arg(QString::number(color.blue(), 16), 2, QLatin1Char('0')));
+ document.setDefaultStyleSheet(QString::fromLatin1("body { color: rgba(%1, %2, %3, %4%) }")
+ .arg(QString::number(pen.red()))
+ .arg(QString::number(pen.green()))
+ .arg(QString::number(pen.blue()))
+ .arg(QString::number(pen.alpha())));
#endif
document.setDefaultFont(font);
document.setDocumentMargin(0.0);
@@ -657,13 +658,10 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
p->save();
p->translate(topLeftPosition);
QAbstractTextDocumentLayout::PaintContext ctx;
- ctx.palette.setColor(QPalette::Text, p->pen().color());
+ ctx.palette.setColor(QPalette::Text, pen);
document.documentLayout()->draw(p, ctx);
p->restore();
- if (textWidth >= 0.0)
- document.adjustSize(); // Find optimal size
-
actualSize = document.size();
}
}
@@ -682,7 +680,7 @@ void QStaticTextPrivate::init()
painter.setFont(font);
painter.setTransform(matrix);
- paintText(QPointF(0, 0), &painter);
+ paintText(QPointF(0, 0), &painter, QColor(0, 0, 0, 0));
}
QVector<QStaticTextItem> deviceItems = device.items();
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index dda566a22b..c4023488ff 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -131,7 +131,7 @@ public:
~QStaticTextPrivate();
void init();
- void paintText(const QPointF &pos, QPainter *p);
+ void paintText(const QPointF &pos, QPainter *p, const QColor &pen);
void invalidate()
{
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index db0650d154..931c9d7490 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n);
/*!
+ \fn bool Qt::mightBeRichText(const QString& text)
+
Returns \c true if the string \a text is likely to be rich text;
otherwise returns \c false.
@@ -144,6 +146,8 @@ bool Qt::mightBeRichText(const QString& text)
/*!
+ \fn QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
+
Converts the plain text string \a plain to an HTML-formatted
paragraph while preserving most of its look.
@@ -805,7 +809,7 @@ void QTextDocument::adjustSize()
// Pull this private function in from qglobal.cpp
QFont f = defaultFont();
QFontMetrics fm(f);
- int mw = fm.width(QLatin1Char('x')) * 80;
+ int mw = fm.horizontalAdvance(QLatin1Char('x')) * 80;
int w = mw;
setTextWidth(w);
QSizeF size = documentLayout()->documentSize();
@@ -970,7 +974,7 @@ QString QTextDocument::defaultStyleSheet() const
/*!
- \fn QTextDocument::undoAvailable(bool available);
+ \fn void QTextDocument::undoAvailable(bool available);
This signal is emitted whenever undo operations become available
(\a available is true) or unavailable (\a available is false).
@@ -982,14 +986,14 @@ QString QTextDocument::defaultStyleSheet() const
*/
/*!
- \fn QTextDocument::redoAvailable(bool available);
+ \fn void QTextDocument::redoAvailable(bool available);
This signal is emitted whenever redo operations become available
(\a available is true) or unavailable (\a available is false).
*/
/*!
- \fn QTextDocument::cursorPositionChanged(const QTextCursor &cursor);
+ \fn void QTextDocument::cursorPositionChanged(const QTextCursor &cursor);
This signal is emitted whenever the position of a cursor changed
due to an editing operation. The cursor that changed is passed in
@@ -999,7 +1003,7 @@ QString QTextDocument::defaultStyleSheet() const
*/
/*!
- \fn QTextDocument::blockCountChanged(int newBlockCount);
+ \fn void QTextDocument::blockCountChanged(int newBlockCount);
\since 4.3
This signal is emitted when the total number of text blocks in the
@@ -1008,7 +1012,7 @@ QString QTextDocument::defaultStyleSheet() const
*/
/*!
- \fn QTextDocument::documentLayoutChanged();
+ \fn void QTextDocument::documentLayoutChanged();
\since 4.4
This signal is emitted when a new document layout is set.
@@ -1841,7 +1845,7 @@ QFont QTextDocument::defaultFont() const
}
/*!
- \fn QTextDocument::modificationChanged(bool changed)
+ \fn void QTextDocument::modificationChanged(bool changed)
This signal is emitted whenever the content of the document
changes in a way that affects the modification state. If \a
@@ -1898,7 +1902,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co
painter->setFont(QFont(doc->defaultFont()));
const QString pageString = QString::number(index);
- painter->drawText(qRound(pageNumberPos.x() - painter->fontMetrics().width(pageString)),
+ painter->drawText(qRound(pageNumberPos.x() - painter->fontMetrics().horizontalAdvance(pageString)),
qRound(pageNumberPos.y() + view.top()),
pageString);
}
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.cpp b/src/gui/text/qtextdocumentlayout.cpp
index e9194e73ff..9877a23fa6 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1427,7 +1427,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
case QTextListFormat::ListLowerRoman:
case QTextListFormat::ListUpperRoman:
itemText = static_cast<QTextList *>(object)->itemText(bl);
- size.setWidth(fontMetrics.width(itemText));
+ size.setWidth(fontMetrics.horizontalAdvance(itemText));
size.setHeight(fontMetrics.height());
break;
@@ -1445,7 +1445,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QRectF r(pos, size);
- qreal xoff = fontMetrics.width(QLatin1Char(' '));
+ qreal xoff = fontMetrics.horizontalAdvance(QLatin1Char(' '));
if (dir == Qt::LeftToRight)
xoff = -xoff - size.width();
r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2));
@@ -2613,7 +2613,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
QFixed extraMargin;
if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
QFontMetricsF fm(bl.charFormat().font());
- extraMargin = QFixed::fromReal(fm.width(QChar(QChar(0x21B5))));
+ extraMargin = QFixed::fromReal(fm.horizontalAdvance(QChar(QChar(0x21B5))));
}
const QFixed indent = this->blockIndent(blockFormat);
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/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 8fe474af2c..08106db6ce 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -201,8 +201,10 @@ public:
inline void insertProperty(qint32 key, const QVariant &value)
{
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
props[i].value = value;
@@ -216,8 +218,10 @@ public:
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
props.remove(i);
return;
}
@@ -2584,13 +2588,13 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
}
/*!
- \fn QTextFrameFormat::isValid() const
+ \fn bool QTextFrameFormat::isValid() const
Returns \c true if the format description is valid; otherwise returns \c false.
*/
/*!
- \fn QTextFrameFormat::setPosition(Position policy)
+ \fn void QTextFrameFormat::setPosition(Position policy)
Sets the \a policy for positioning frames with this frame format.
@@ -2603,7 +2607,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorder(qreal width)
+ \fn void QTextFrameFormat::setBorder(qreal width)
Sets the \a width (in pixels) of the frame's border.
*/
@@ -2615,7 +2619,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorderBrush(const QBrush &brush)
+ \fn void QTextFrameFormat::setBorderBrush(const QBrush &brush)
\since 4.3
Sets the \a brush used for the frame's border.
@@ -2629,7 +2633,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorderStyle(BorderStyle style)
+ \fn void QTextFrameFormat::setBorderStyle(BorderStyle style)
\since 4.3
Sets the \a style of the frame's border.
@@ -2643,7 +2647,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setMargin(qreal margin)
+ \fn void QTextFrameFormat::setMargin(qreal margin)
Sets the frame's \a margin in pixels.
This method also sets the left, right, top and bottom margins
@@ -2667,7 +2671,7 @@ void QTextFrameFormat::setMargin(qreal amargin)
*/
/*!
- \fn QTextFrameFormat::setTopMargin(qreal margin)
+ \fn void QTextFrameFormat::setTopMargin(qreal margin)
\since 4.3
Sets the frame's top \a margin in pixels.
@@ -2687,7 +2691,7 @@ qreal QTextFrameFormat::topMargin() const
}
/*!
- \fn QTextFrameFormat::setBottomMargin(qreal margin)
+ \fn void QTextFrameFormat::setBottomMargin(qreal margin)
\since 4.3
Sets the frame's bottom \a margin in pixels.
@@ -2707,7 +2711,7 @@ qreal QTextFrameFormat::bottomMargin() const
}
/*!
- \fn QTextFrameFormat::setLeftMargin(qreal margin)
+ \fn void QTextFrameFormat::setLeftMargin(qreal margin)
\since 4.3
Sets the frame's left \a margin in pixels.
@@ -2727,7 +2731,7 @@ qreal QTextFrameFormat::leftMargin() const
}
/*!
- \fn QTextFrameFormat::setRightMargin(qreal margin)
+ \fn void QTextFrameFormat::setRightMargin(qreal margin)
\since 4.3
Sets the frame's right \a margin in pixels.
@@ -2747,7 +2751,7 @@ qreal QTextFrameFormat::rightMargin() const
}
/*!
- \fn QTextFrameFormat::setPadding(qreal width)
+ \fn void QTextFrameFormat::setPadding(qreal width)
Sets the \a width of the frame's internal padding in pixels.
*/
@@ -2759,7 +2763,7 @@ qreal QTextFrameFormat::rightMargin() const
*/
/*!
- \fn QTextFrameFormat::setWidth(const QTextLength &width)
+ \fn void QTextFrameFormat::setWidth(const QTextLength &width)
Sets the frame's border rectangle's \a width.
@@ -2767,7 +2771,7 @@ qreal QTextFrameFormat::rightMargin() const
*/
/*!
- \fn QTextFrameFormat::setWidth(qreal width)
+ \fn void QTextFrameFormat::setWidth(qreal width)
\overload
Convenience method that sets the width of the frame's border
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.cpp b/src/gui/text/qtextlayout.cpp
index 066f258ea3..87f73e1e83 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -93,14 +93,14 @@ QT_BEGIN_NAMESPACE
Specifies the format to apply.
*/
-/*! \fn bool operator==(const FormatRange &lhs, const FormatRange &rhs)
+/*! \fn bool operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
\relates QTextLayout::FormatRange
Returns true if the \c {start}, \c {length}, and \c {format} fields
in \a lhs and \a rhs contain the same values respectively.
*/
-/*! \fn bool operator!=(const FormatRange &lhs, const FormatRange &rhs)
+/*! \fn bool operator!=(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
\relates QTextLayout::FormatRange
Returns true if any of the \c {start}, \c {length}, or \c {format} fields
@@ -2453,7 +2453,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
const qreal lineHeight = line.height().toReal();
QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(),
- lineHeight / 2, QFontMetrics(eng->font()).width(QLatin1Char(' ')));
+ lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(QLatin1Char(' ')));
setPenAndDrawBackground(p, QPen(), selection->format, r);
p->setPen(pen);
}
@@ -2540,7 +2540,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng);
if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) {
QChar visualTab(0x2192);
- int w = QFontMetrics(f).width(visualTab);
+ int w = QFontMetrics(f).horizontalAdvance(visualTab);
qreal x = iterator.itemWidth.toReal() - w; // Right-aligned
if (x < 0)
p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(),
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/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 2a16f50f33..310ced5463 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -404,24 +404,24 @@ QList<QTextOption::Tab> QTextOption::tabs() const
*/
/*!
- \variable Tab::type
+ \variable QTextOption::Tab::type
Determine which type is used.
In a paragraph that has layoutDirection() RightToLeft the type LeftTab will
be interpreted to be a RightTab and vice versa.
*/
/*!
- \variable Tab::delimiter
+ \variable QTextOption::Tab::delimiter
If type is DelimitorTab; tab until this char is found in the text.
*/
/*!
- \fn Tab::Tab()
+ \fn QTextOption::Tab::Tab()
Creates a default left tab with position 80.
*/
/*!
- \fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar())
+ \fn QTextOption::Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar())
Creates a tab with the given position, tab type, and delimiter
(\a pos, \a tabType, \a delim).
@@ -432,27 +432,20 @@ QList<QTextOption::Tab> QTextOption::tabs() const
*/
/*!
- \fn bool Tab::operator==(const Tab &other) const
+ \fn bool QTextOption::Tab::operator==(const QTextOption::Tab &other) const
Returns \c true if tab \a other is equal to this tab;
otherwise returns \c false.
*/
/*!
- \fn bool Tab::operator!=(const Tab &other) const
+ \fn bool QTextOption::Tab::operator!=(const QTextOption::Tab &other) const
Returns \c true if tab \a other is not equal to this tab;
otherwise returns \c false.
*/
/*!
- \fn void setTabs(const QList<Tab> &tabStops)
- Set the Tab properties to \a tabStops.
-
- \sa tabStopDistance(), tabs()
-*/
-
-/*!
\since 4.4
\fn QList<QTextOption::Tab> QTextOption::tabs() const
Returns a list of tab positions defined for the text layout.
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;
diff --git a/src/gui/vulkan/qplatformvulkaninstance.h b/src/gui/vulkan/qplatformvulkaninstance.h
index 9470e2d0b4..9f34803f7b 100644
--- a/src/gui/vulkan/qplatformvulkaninstance.h
+++ b/src/gui/vulkan/qplatformvulkaninstance.h
@@ -88,4 +88,65 @@ QT_END_NAMESPACE
#endif // QT_CONFIG(vulkan)
+#if defined(Q_CLANG_QDOC)
+/*
+ The following include file did not exist for clang-qdoc running
+ in macOS, but the classes are documented in qvulkanfunctions.cpp.
+ clang-qdoc must parse the class declarations in an include file,
+ or else it can't find a place to put the documentation for the
+ classes. Apparently these classes are created at build time if
+ Vulkan is present.
+ */
+#ifndef QVULKANFUNCTIONS_H
+#define QVULKANFUNCTIONS_H
+
+#include <QtGui/qtguiglobal.h>
+
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+
+#ifndef VK_NO_PROTOTYPES
+#define VK_NO_PROTOTYPES
+#endif
+#include <vulkan/vulkan.h>
+
+#include <QtCore/qscopedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVulkanInstance;
+class QVulkanFunctionsPrivate;
+class QVulkanDeviceFunctionsPrivate;
+
+class Q_GUI_EXPORT QVulkanFunctions
+{
+public:
+ ~QVulkanFunctions();
+
+private:
+ Q_DISABLE_COPY(QVulkanFunctions)
+ QVulkanFunctions(QVulkanInstance *inst);
+
+ QScopedPointer<QVulkanFunctionsPrivate> d_ptr;
+ friend class QVulkanInstance;
+};
+
+class Q_GUI_EXPORT QVulkanDeviceFunctions
+{
+public:
+ ~QVulkanDeviceFunctions();
+
+private:
+ Q_DISABLE_COPY(QVulkanDeviceFunctions)
+ QVulkanDeviceFunctions(QVulkanInstance *inst, VkDevice device);
+
+ QScopedPointer<QVulkanDeviceFunctionsPrivate> d_ptr;
+ friend class QVulkanInstance;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#endif // QVULKANFUNCTIONS_H;
+#endif // Q_CLANG_QDOC
+
#endif // QPLATFORMVULKANINSTANCE_H
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp
index 2e03be8151..8236d9625a 100644
--- a/src/gui/vulkan/qvulkaninstance.cpp
+++ b/src/gui/vulkan/qvulkaninstance.cpp
@@ -504,13 +504,13 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
- \fn bool QVulkanInfoVector::contains(const QByteArray &name) const
+ \fn template<typename T> bool QVulkanInfoVector<T>::contains(const QByteArray &name) const
\return true if the vector contains a layer or extension with the given \a name.
*/
/*!
- \fn bool QVulkanInfoVector::contains(const QByteArray &name, int minVersion) const
+ \fn template<typename T> bool QVulkanInfoVector<T>::contains(const QByteArray &name, int minVersion) const
\return true if the vector contains a layer or extension with the given
\a name and a version same as or newer than \a minVersion.