summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp20
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp10
-rw-r--r--src/gui/accessible/qplatformaccessibility.cpp2
-rw-r--r--src/gui/animation/qguivariantanimation.cpp10
-rw-r--r--src/gui/configure.json88
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/image/qbmphandler.cpp4
-rw-r--r--src/gui/image/qicon.cpp16
-rw-r--r--src/gui/image/qiconloader.cpp2
-rw-r--r--src/gui/image/qimage.cpp52
-rw-r--r--src/gui/image/qimage_conversions.cpp285
-rw-r--r--src/gui/image/qimageiohandler.cpp2
-rw-r--r--src/gui/image/qimagereader.cpp14
-rw-r--r--src/gui/image/qimagereaderwriterhelpers.cpp6
-rw-r--r--src/gui/image/qimagewriter.cpp16
-rw-r--r--src/gui/image/qmovie.cpp2
-rw-r--r--src/gui/image/qpaintengine_pic.cpp6
-rw-r--r--src/gui/image/qpicture.cpp22
-rw-r--r--src/gui/image/qpixmap.cpp6
-rw-r--r--src/gui/image/qpixmap_blitter.cpp8
-rw-r--r--src/gui/image/qpixmapcache.cpp14
-rw-r--r--src/gui/image/qplatformpixmap.cpp2
-rw-r--r--src/gui/image/qpnghandler.cpp62
-rw-r--r--src/gui/image/qxpmhandler.cpp4
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp103
-rw-r--r--src/gui/kernel/qclipboard.cpp6
-rw-r--r--src/gui/kernel/qcursor.cpp14
-rw-r--r--src/gui/kernel/qdnd.cpp12
-rw-r--r--src/gui/kernel/qdrag.cpp6
-rw-r--r--src/gui/kernel/qevent.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp120
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qguivariant.cpp16
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h2
-rw-r--r--src/gui/kernel/qkeymapper.cpp2
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp14
-rw-r--r--src/gui/kernel/qopenglcontext.cpp56
-rw-r--r--src/gui/kernel/qopenglwindow.cpp6
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp2
-rw-r--r--src/gui/kernel/qpalette.cpp2
-rw-r--r--src/gui/kernel/qplatformclipboard.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp12
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp22
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp22
-rw-r--r--src/gui/kernel/qplatformintegration.h3
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.cpp2
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp20
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp2
-rw-r--r--src/gui/kernel/qplatformscreen.cpp33
-rw-r--r--src/gui/kernel/qplatformscreen.h23
-rw-r--r--src/gui/kernel/qplatformtheme.cpp16
-rw-r--r--src/gui/kernel/qplatformtheme.h2
-rw-r--r--src/gui/kernel/qscreen.cpp21
-rw-r--r--src/gui/kernel/qscreen.h1
-rw-r--r--src/gui/kernel/qsessionmanager.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp93
-rw-r--r--src/gui/kernel/qsimpledrag.cpp4
-rw-r--r--src/gui/kernel/qstylehints.cpp2
-rw-r--r--src/gui/kernel/qsurface.cpp2
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp2
-rw-r--r--src/gui/kernel/qtestsupport_gui.cpp13
-rw-r--r--src/gui/kernel/qwindow.cpp18
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp12
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h1
-rw-r--r--src/gui/opengl/qopengl.cpp2
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp14
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage.cpp8
-rw-r--r--src/gui/opengl/qopengldebug.cpp24
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp20
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp12
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp6
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp14
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp18
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp22
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp24
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp26
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp28
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp30
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp22
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp34
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp24
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp38
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp26
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp40
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp28
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp42
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp30
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp44
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp32
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp46
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp34
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp48
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp36
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp52
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp38
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp22
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp12
-rw-r--r--src/gui/opengl/qopengltexture.cpp32
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp34
-rw-r--r--src/gui/opengl/qopengltimerquery.cpp26
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglversionfunctionsfactory.cpp2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp16
-rw-r--r--src/gui/painting/WEBGRADIENTS_LICENSE.txt21
-rw-r--r--src/gui/painting/painting.pri5
-rw-r--r--src/gui/painting/qblittable.cpp2
-rw-r--r--src/gui/painting/qbrush.cpp69
-rw-r--r--src/gui/painting/qbrush.h24
-rw-r--r--src/gui/painting/qcolorspace.cpp4
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp6
-rw-r--r--src/gui/painting/qdrawhelper.cpp92
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp2
-rw-r--r--src/gui/painting/qimagescale.cpp4
-rw-r--r--src/gui/painting/qmemrotate.cpp6
-rw-r--r--src/gui/painting/qoutlinemapper.cpp2
-rw-r--r--src/gui/painting/qpagesize.cpp20
-rw-r--r--src/gui/painting/qpaintdevice.cpp6
-rw-r--r--src/gui/painting/qpaintengine.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp96
-rw-r--r--src/gui/painting/qpaintengineex.cpp32
-rw-r--r--src/gui/painting/qpainter.cpp79
-rw-r--r--src/gui/painting/qpainter_p.h20
-rw-r--r--src/gui/painting/qpainterpath.cpp8
-rw-r--r--src/gui/painting/qpathclipper.cpp10
-rw-r--r--src/gui/painting/qpathsimplifier.cpp42
-rw-r--r--src/gui/painting/qpdf.cpp177
-rw-r--r--src/gui/painting/qpdf_p.h21
-rw-r--r--src/gui/painting/qpdfwriter.cpp46
-rw-r--r--src/gui/painting/qpdfwriter.h5
-rw-r--r--src/gui/painting/qpen.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp8
-rw-r--r--src/gui/painting/qplatformbackingstore.h2
-rw-r--r--src/gui/painting/qrasterizer.cpp4
-rw-r--r--src/gui/painting/qregion.cpp74
-rw-r--r--src/gui/painting/qstroker.cpp10
-rw-r--r--src/gui/painting/qt_attribution.json14
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp4
-rw-r--r--src/gui/painting/qtriangulator.cpp28
-rw-r--r--src/gui/painting/webgradients.binaryjsonbin50792 -> 0 bytes
-rw-r--r--src/gui/painting/webgradients.cpp578
-rw-r--r--src/gui/painting/webgradients.css909
-rw-r--r--src/gui/rhi/qrhi.cpp93
-rw-r--r--src/gui/rhi/qrhi_p.h10
-rw-r--r--src/gui/rhi/qrhid3d11.cpp38
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h3
-rw-r--r--src/gui/rhi/qrhigles2.cpp186
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h13
-rw-r--r--src/gui/rhi/qrhimetal.mm223
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h3
-rw-r--r--src/gui/rhi/qrhinull.cpp12
-rw-r--r--src/gui/rhi/qrhinull_p_p.h2
-rw-r--r--src/gui/rhi/qrhivulkan.cpp231
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h12
-rw-r--r--src/gui/rhi/qshader.cpp30
-rw-r--r--src/gui/rhi/qshader_p_p.h6
-rw-r--r--src/gui/rhi/qshaderdescription.cpp152
-rw-r--r--src/gui/rhi/qshaderdescription_p.h40
-rw-r--r--src/gui/rhi/rhi.pri6
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp34
-rw-r--r--src/gui/text/qcssparser_p.h2
-rw-r--r--src/gui/text/qdistancefield.cpp10
-rw-r--r--src/gui/text/qfont.cpp76
-rw-r--r--src/gui/text/qfontdatabase.cpp50
-rw-r--r--src/gui/text/qfontengine.cpp46
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp24
-rw-r--r--src/gui/text/qfontmetrics.cpp90
-rw-r--r--src/gui/text/qglyphrun.cpp2
-rw-r--r--src/gui/text/qglyphrun_p.h3
-rw-r--r--src/gui/text/qharfbuzzng.cpp25
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp2
-rw-r--r--src/gui/text/qrawfont.cpp8
-rw-r--r--src/gui/text/qstatictext.cpp4
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp6
-rw-r--r--src/gui/text/qtextcursor.cpp26
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/gui/text/qtextdocument_p.cpp20
-rw-r--r--src/gui/text/qtextdocument_p.h6
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp16
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp24
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp69
-rw-r--r--src/gui/text/qtextengine_p.h19
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtextimagehandler.cpp2
-rw-r--r--src/gui/text/qtextlayout.cpp8
-rw-r--r--src/gui/text/qtextobject.cpp16
-rw-r--r--src/gui/text/qtextodfwriter.cpp12
-rw-r--r--src/gui/text/qtextoption.cpp8
-rw-r--r--src/gui/text/qzip.cpp16
-rw-r--r--src/gui/util/qdesktopservices.cpp2
-rw-r--r--src/gui/util/qgridlayoutengine.cpp28
-rw-r--r--src/gui/util/qgridlayoutengine_p.h4
-rw-r--r--src/gui/util/qshadergenerator.cpp4
-rw-r--r--src/gui/util/qshadergraphloader.cpp2
-rw-r--r--src/gui/util/qtexturefiledata.cpp2
-rw-r--r--src/gui/util/qvalidator.cpp2
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.cpp5
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.h1
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp17
-rw-r--r--src/gui/vulkan/qvulkaninstance.h1
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp115
-rw-r--r--src/gui/vulkan/qvulkanwindow.h7
-rw-r--r--src/gui/vulkan/qvulkanwindow_p.h3
209 files changed, 3601 insertions, 3132 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index db47a3abc1..7922d6fb06 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -478,15 +478,15 @@ Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
Q_GLOBAL_STATIC(QList<QAccessible::ActivationObserver *>, qAccessibleActivationObservers)
-QAccessible::UpdateHandler QAccessible::updateHandler = 0;
-QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0;
+QAccessible::UpdateHandler QAccessible::updateHandler = nullptr;
+QAccessible::RootObjectHandler QAccessible::rootObjectHandler = nullptr;
static bool cleanupAdded = false;
static QPlatformAccessibility *platformAccessibility()
{
QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
- return pfIntegration ? pfIntegration->accessibility() : 0;
+ return pfIntegration ? pfIntegration->accessibility() : nullptr;
}
/*!
@@ -673,7 +673,7 @@ void QAccessible::removeActivationObserver(ActivationObserver *observer)
QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
{
if (!object)
- return 0;
+ return nullptr;
if (Id id = QAccessibleCache::instance()->objectToId.value(object))
return QAccessibleCache::instance()->interfaceForId(id);
@@ -696,7 +696,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
// Find a QAccessiblePlugin (factory) for the class name. If there's
// no entry in the cache try to create it using the plugin loader.
if (!qAccessiblePlugins()->contains(cn)) {
- QAccessiblePlugin *factory = 0; // 0 means "no plugin found". This is cached as well.
+ QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well.
const int index = loader()->indexOf(cn);
if (index != -1)
factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index));
@@ -724,7 +724,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
return appInterface;
}
- return 0;
+ return nullptr;
}
/*!
@@ -1113,7 +1113,7 @@ QAccessibleInterface::relations(QAccessible::Relation /*match = QAccessible::All
*/
QAccessibleInterface *QAccessibleInterface::focusChild() const
{
- return 0;
+ return nullptr;
}
/*!
@@ -1758,12 +1758,12 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
*/
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
{
- if (m_object == 0)
+ if (m_object == nullptr)
return QAccessible::accessibleInterface(m_uniqueId);
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
if (!iface || !iface->isValid())
- return 0;
+ return nullptr;
if (m_child >= 0) {
QAccessibleInterface *child = iface->child(m_child);
@@ -1791,7 +1791,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
*/
QWindow *QAccessibleInterface::window() const
{
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 2ef8502ad5..771cfda574 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -128,7 +128,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
if (childIface->isValid() && childIface->rect().contains(x,y))
return childIface;
}
- return 0;
+ return nullptr;
}
/*!
@@ -152,7 +152,7 @@ QWindow *QAccessibleApplication::window() const
{
// an application can have several windows, and AFAIK we don't need
// to notify about changes on the application.
- return 0;
+ return nullptr;
}
// all toplevel windows except popups and the desktop
@@ -190,7 +190,7 @@ int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) cons
QAccessibleInterface *QAccessibleApplication::parent() const
{
- return 0;
+ return nullptr;
}
QAccessibleInterface *QAccessibleApplication::child(int index) const
@@ -198,7 +198,7 @@ QAccessibleInterface *QAccessibleApplication::child(int index) const
const QObjectList tlo(topLevelObjects());
if (index >= 0 && index < tlo.count())
return QAccessible::queryAccessibleInterface(tlo.at(index));
- return 0;
+ return nullptr;
}
@@ -207,7 +207,7 @@ QAccessibleInterface *QAccessibleApplication::focusChild() const
{
if (QWindow *window = QGuiApplication::focusWindow())
return window->accessibleRoot();
- return 0;
+ return nullptr;
}
/*! \reimp */
diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp
index 8c806d47b8..4813b83963 100644
--- a/src/gui/accessible/qplatformaccessibility.cpp
+++ b/src/gui/accessible/qplatformaccessibility.cpp
@@ -114,7 +114,7 @@ void QPlatformAccessibility::initialize()
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
const PluginKeyMap keyMap = bridgeloader()->keyMap();
- QAccessibleBridgePlugin *factory = 0;
+ QAccessibleBridgePlugin *factory = nullptr;
int i = -1;
const PluginKeyMapConstIterator cend = keyMap.constEnd();
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index a5b6d8b95c..8afe77ed46 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -75,15 +75,15 @@ static void qUnregisterGuiGetInterpolator()
{
// casts required by Sun CC 5.5
qRegisterAnimationInterpolator<QColor>(
- (QVariant (*)(const QColor &, const QColor &, qreal))0);
+ (QVariant (*)(const QColor &, const QColor &, qreal))nullptr);
qRegisterAnimationInterpolator<QVector2D>(
- (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0);
+ (QVariant (*)(const QVector2D &, const QVector2D &, qreal))nullptr);
qRegisterAnimationInterpolator<QVector3D>(
- (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0);
+ (QVariant (*)(const QVector3D &, const QVector3D &, qreal))nullptr);
qRegisterAnimationInterpolator<QVector4D>(
- (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0);
+ (QVariant (*)(const QVector4D &, const QVector4D &, qreal))nullptr);
qRegisterAnimationInterpolator<QQuaternion>(
- (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0);
+ (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))nullptr);
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator)
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 0202f17b21..4de159d97a 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -41,11 +41,10 @@
"sm": { "type": "boolean", "name": "sessionmanager" },
"tslib": "boolean",
"vulkan": "boolean",
- "xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] },
+ "xcb": "boolean",
+ "bundled-xcb-xinput": "boolean",
"xcb-native-painting": "boolean",
"xcb-xlib": "boolean",
- "xcb-xinput": "boolean",
- "xkb": "boolean",
"xkbcommon": "boolean"
}
},
@@ -574,18 +573,22 @@
]
},
"xcb": {
- "label": "XCB >= 1.9",
+ "label": "XCB >= 1.11",
"test": {
"main": [
"int primaryScreen = 0;",
"(void)xcb_connect(\"\", &primaryScreen);",
- "// This won't compile unless libxcb >= 1.9 which defines XCB_CONN_CLOSED_INVALID_SCREEN.",
- "int xcbScreenError = XCB_CONN_CLOSED_INVALID_SCREEN;"
+ "/* XCB_PACKED define was added in libxcb 1.11 */",
+ "#ifdef XCB_PACKED",
+ " return 0;",
+ "#else",
+ " return -1;",
+ "#endif"
]
},
"headers": "xcb/xcb.h",
"sources": [
- { "type": "pkgConfig", "args": "xcb >= 1.9" },
+ { "type": "pkgConfig", "args": "xcb >= 1.11" },
"-lxcb"
]
},
@@ -692,21 +695,10 @@
"use": "xcb xlib"
},
"xcb_xkb": {
- "label": "XCB XKB >= 1.10",
- "test": {
- "head": [
- "// xkb.h is using a variable called 'explicit', which is a reserved keyword in C++",
- "#define explicit dont_use_cxx_explicit"
- ],
- "tail": "#undef explicit",
- "main": [
- "// This takes more arguments in xcb-xkb < 1.10.",
- "xcb_xkb_get_kbd_by_name_unchecked(NULL, 0, 0, 0, 0);"
- ]
- },
+ "label": "XCB XKB",
"headers": "xcb/xkb.h",
"sources": [
- { "type": "pkgConfig", "args": "xcb-xkb >= 1.10" },
+ { "type": "pkgConfig", "args": "xcb-xkb" },
"-lxcb-xkb"
],
"use": "xcb"
@@ -770,7 +762,7 @@
"xkbcommon_x11": {
"label": "xkbcommon-x11",
"test": {
- "main": "xkb_x11_get_core_keyboard_device_id(nullptr);"
+ "main": "xkb_x11_setup_xkb_extension_flags flag = XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS;"
},
"headers": [ "xkbcommon/xkbcommon-x11.h" ],
"sources": [
@@ -1057,6 +1049,11 @@
"label": "XCB (extensions)",
"type": "compile",
"test": {
+ "head": [
+ "// xkb.h is using a variable called 'explicit', which is a reserved keyword in C++",
+ "#define explicit dont_use_cxx_explicit"
+ ],
+ "tail": "#undef explicit",
"include": [
"xcb/xcb.h",
"xcb/xcb_image.h",
@@ -1069,7 +1066,8 @@
"xcb/xfixes.h",
"xcb/xinerama.h",
"xcb/xcb_icccm.h",
- "xcb/xcb_renderutil.h"
+ "xcb/xcb_renderutil.h",
+ "xcb/xkb.h"
],
"main": [
"int primaryScreen = 0;",
@@ -1083,10 +1081,13 @@
" xcb_render_query_pict_formats_reply(c, formatsCookie, &error);",
"/* RENDERUTIL: xcb_renderutil.h include won't compile unless version >= 0.3.9 */",
- "xcb_render_util_find_standard_format(nullptr, XCB_PICT_STANDARD_ARGB_32);"
+ "xcb_render_util_find_standard_format(nullptr, XCB_PICT_STANDARD_ARGB_32);",
+
+ "/* XKB: This takes more arguments in xcb-xkb < 1.11 */",
+ "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof(nullptr, 0, 0, 0, 0, 0, 0, 0, 0);"
]
},
- "use": "xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb"
+ "use": "xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xcb"
},
"x11prefix": {
"label": "X11 prefix",
@@ -1315,7 +1316,7 @@
},
"opengles3": {
"label": "OpenGL ES 3.0",
- "condition": "features.opengles2 && !features.angle && tests.opengles3 && !config.wasm",
+ "condition": "features.opengles2 && !features.angle && tests.opengles3",
"output": [
"publicFeature",
{ "type": "define", "name": "QT_OPENGL_ES_3" }
@@ -1515,16 +1516,7 @@
"label": "XCB",
"section": "Platform plugins",
"autoDetect": "!config.darwin",
- "enable": "input.xcb == 'system' || input.xcb == 'qt' || input.xcb == 'yes'",
- "condition": "features.thread && features.xkbcommon && libs.xcb",
- "output": [ "privateFeature" ]
- },
- "system-xcb": {
- "label": "Using system-provided XCB libraries",
- "enable": "input.xcb == 'system'",
- "disable": "input.xcb == 'qt'",
- "autoDetect": "!config.darwin",
- "condition": "features.xcb && tests.xcb_syslibs",
+ "condition": "features.thread && libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11",
"output": [ "privateFeature" ]
},
"x11-prefix": {
@@ -1563,12 +1555,6 @@
"condition": "features.xcb-native-painting",
"output": [ "privateFeature" ]
},
- "xkb": {
- "label": "XCB XKB",
- "emitIf": "features.xcb",
- "condition": "(!features.system-xcb || libs.xcb_xkb) && libs.xkbcommon_x11",
- "output": [ "privateFeature" ]
- },
"xcb-xlib": {
"label": "XCB Xlib",
"condition": "features.xlib && libs.xcb_xlib",
@@ -1580,10 +1566,12 @@
"condition": "features.sessionmanager && libs.x11sm",
"output": [ "privateFeature" ]
},
- "xcb-xinput": {
- "label": "XCB XInput",
+ "system-xcb-xinput": {
+ "label": "Using system-provided xcb-xinput",
"emitIf": "features.xcb",
- "condition": "!features.system-xcb || libs.xcb_xinput",
+ "disable": "input.bundled-xcb-xinput == 'yes'",
+ "enable": "input.bundled-xcb-xinput == 'no'",
+ "condition": "libs.xcb_xinput",
"output": [ "privateFeature" ]
},
"xkbcommon": {
@@ -1591,6 +1579,11 @@
"condition": "libs.xkbcommon",
"output": [ "privateFeature" ]
},
+ "xkbcommon-x11": {
+ "label": "xkbcommon-x11",
+ "condition": "features.xkbcommon && libs.xkbcommon_x11",
+ "output": [ "privateFeature" ]
+ },
"xlib": {
"label": "XLib",
"autoDetect": "!config.darwin || features.xcb",
@@ -1832,7 +1825,7 @@
{
"type": "error",
"condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'",
- "message": "XCB plugin requires xkbcommon, but -no-xkbcommon was provided."
+ "message": "XCB plugin requires xkbcommon and xkbcommon-x11, but -no-xkbcommon was provided."
}
],
@@ -1954,7 +1947,8 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"entries": [
"xlib",
"xcb-xlib",
- "egl_x11"
+ "egl_x11",
+ "xkbcommon-x11"
]
}
]
@@ -1987,7 +1981,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "XCB",
"condition": "features.xcb",
"entries": [
- "system-xcb", "xkb", "xcb-xinput", "xcb-native-painting",
+ "system-xcb-xinput", "xcb-native-painting",
{
"section": "GL integrations",
"entries": [
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 45c8c05162..350d4c5ee3 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -99,4 +99,4 @@ qtConfig(egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
TRACEPOINT_PROVIDER = $$PWD/qtgui.tracepoints
-CONFIG += qt_tracepoints
+CONFIG += qt_tracepoints metatypes install_metatypes
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 7f8e072322..32b6131309 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -414,7 +414,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
*p++ = tmp >> 4;
}
if ((((c & 3) + 1) & 2) == 2)
- d->getChar(0); // align on word boundary
+ d->getChar(nullptr); // align on word boundary
x += c;
}
} else { // encoded mode
@@ -494,7 +494,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
if (d->read((char *)p, b) != b)
return false;
if ((b & 1) == 1)
- d->getChar(0); // align on word boundary
+ d->getChar(nullptr); // align on word boundary
x += b;
p += b;
}
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 84e387e317..19be066d23 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -132,7 +132,7 @@ static void qt_cleanup_icon_cache()
if Qt::AA_UseHighDpiPixmaps is not set this function
returns 1.0 to keep non-hihdpi aware code working.
*/
-static qreal qt_effective_device_pixel_ratio(QWindow *window = 0)
+static qreal qt_effective_device_pixel_ratio(QWindow *window = nullptr)
{
if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
return qreal(1.0);
@@ -228,7 +228,7 @@ static QPixmapIconEngineEntry *bestSizeMatch( const QSize &size, QPixmapIconEngi
QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state)
{
- QPixmapIconEngineEntry *pe = 0;
+ QPixmapIconEngineEntry *pe = nullptr;
for (int i = 0; i < pixmaps.count(); ++i)
if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) {
if (pe)
@@ -674,7 +674,7 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
Constructs a null icon.
*/
QIcon::QIcon() noexcept
- : d(0)
+ : d(nullptr)
{
}
@@ -682,7 +682,7 @@ QIcon::QIcon() noexcept
Constructs an icon from a \a pixmap.
*/
QIcon::QIcon(const QPixmap &pixmap)
- :d(0)
+ :d(nullptr)
{
addPixmap(pixmap);
}
@@ -723,7 +723,7 @@ QIcon::QIcon(const QIcon &other)
complete list of the supported file formats.
*/
QIcon::QIcon(const QString &fileName)
- : d(0)
+ : d(nullptr)
{
addFile(fileName);
}
@@ -838,7 +838,7 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
{
if (!d)
return QPixmap();
- return pixmap(0, size, mode, state);
+ return pixmap(nullptr, size, mode, state);
}
/*!
@@ -878,7 +878,7 @@ QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
{
if (!d)
return QSize();
- return actualSize(0, size, mode, state);
+ return actualSize(nullptr, size, mode, state);
}
/*!
@@ -1008,7 +1008,7 @@ void QIcon::detach()
if (d->engine->isNull()) {
if (!d->ref.deref())
delete d;
- d = 0;
+ d = nullptr;
return;
} else if (d->ref.loadRelaxed() != 1) {
QIconPrivate *x = new QIconPrivate(d->engine->clone());
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 27c82bc09f..e67b387981 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -714,7 +714,7 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QThemeIconInfo &in
// Find the minimum distance icon
int minimalSize = INT_MAX;
- QIconLoaderEngineEntry *closestMatch = 0;
+ QIconLoaderEngineEntry *closestMatch = nullptr;
for (int i = 0; i < numEntries; ++i) {
QIconLoaderEngineEntry *entry = info.entries.at(i);
int distance = directorySizeDistance(entry->dir, iconsize, scale);
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d8ed0829af..99d64737c5 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
static inline bool isLocked(QImageData *data)
{
- return data != 0 && data->is_locked;
+ return data != nullptr && data->is_locked;
}
#if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001)
@@ -99,15 +99,15 @@ static int next_qimage_serial_number()
}
QImageData::QImageData()
- : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(0),
+ : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(nullptr),
format(QImage::Format_ARGB32), bytes_per_line(0),
ser_no(next_qimage_serial_number()),
detach_no(0),
dpmx(qt_defaultDpiX() * 100 / qreal(2.54)),
dpmy(qt_defaultDpiY() * 100 / qreal(2.54)),
offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false),
- is_cached(false), is_locked(false), cleanupFunction(0), cleanupInfo(0),
- paintEngine(0)
+ is_cached(false), is_locked(false), cleanupFunction(nullptr), cleanupInfo(nullptr),
+ paintEngine(nullptr)
{
}
@@ -170,7 +170,7 @@ QImageData::~QImageData()
delete paintEngine;
if (data && own_data)
free(data);
- data = 0;
+ data = nullptr;
}
#if defined(_M_ARM)
@@ -746,7 +746,7 @@ bool QImageData::checkForAlphaPixels() const
QImage::QImage() noexcept
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
}
/*!
@@ -955,7 +955,7 @@ QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Forma
QImage::QImage(const QString &fileName, const char *format)
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
load(fileName, format);
}
@@ -981,10 +981,10 @@ extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *so
QImage::QImage(const char * const xpm[])
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
if (!xpm)
return;
- if (!qt_read_xpm_image_or_array(0, xpm, *this))
+ if (!qt_read_xpm_image_or_array(nullptr, xpm, *this))
// Issue: Warning because the constructor may be ambigious
qWarning("QImage::QImage(), XPM is not supported");
}
@@ -1003,7 +1003,7 @@ QImage::QImage(const QImage &image)
: QPaintDevice()
{
if (image.paintingActive() || isLocked(image.d)) {
- d = 0;
+ d = nullptr;
image.copy().swap(*this);
} else {
d = image.d;
@@ -1593,13 +1593,13 @@ void QImage::setColor(int i, QRgb c)
uchar *QImage::scanLine(int i)
{
if (!d)
- return 0;
+ return nullptr;
detach();
// In case detach() ran out of memory
if (!d)
- return 0;
+ return nullptr;
return d->data + i * d->bytes_per_line;
}
@@ -1610,7 +1610,7 @@ uchar *QImage::scanLine(int i)
const uchar *QImage::scanLine(int i) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < height());
return d->data + i * d->bytes_per_line;
@@ -1633,7 +1633,7 @@ const uchar *QImage::scanLine(int i) const
const uchar *QImage::constScanLine(int i) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < height());
return d->data + i * d->bytes_per_line;
@@ -1653,12 +1653,12 @@ const uchar *QImage::constScanLine(int i) const
uchar *QImage::bits()
{
if (!d)
- return 0;
+ return nullptr;
detach();
// In case detach ran out of memory...
if (!d)
- return 0;
+ return nullptr;
return d->data;
}
@@ -1672,7 +1672,7 @@ uchar *QImage::bits()
*/
const uchar *QImage::bits() const
{
- return d ? d->data : 0;
+ return d ? d->data : nullptr;
}
@@ -1688,7 +1688,7 @@ const uchar *QImage::bits() const
*/
const uchar *QImage::constBits() const
{
- return d ? d->data : 0;
+ return d ? d->data : nullptr;
}
/*!
@@ -1912,10 +1912,10 @@ void QImage::invertPixels(InvertMode mode)
// Inverting premultiplied pixels would produce invalid image data.
if (hasAlphaChannel() && qPixelLayouts[d->format].premultiplied) {
if (depth() > 32) {
- if (!d->convertInPlace(QImage::Format_RGBA64, 0))
+ if (!d->convertInPlace(QImage::Format_RGBA64, { }))
*this = convertToFormat(QImage::Format_RGBA64);
} else {
- if (!d->convertInPlace(QImage::Format_ARGB32, 0))
+ if (!d->convertInPlace(QImage::Format_ARGB32, { }))
*this = convertToFormat(QImage::Format_ARGB32);
}
}
@@ -1982,7 +1982,7 @@ void QImage::invertPixels(InvertMode mode)
}
if (originalFormat != d->format) {
- if (!d->convertInPlace(originalFormat, 0))
+ if (!d->convertInPlace(originalFormat, { }))
*this = convertToFormat(originalFormat);
}
}
@@ -3027,11 +3027,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const
while(!done) {
done = true;
ypn = m.scanLine(0);
- ypc = 0;
+ ypc = nullptr;
for (y = 0; y < h; y++) {
ypp = ypc;
ypc = ypn;
- ypn = (y == h-1) ? 0 : m.scanLine(y+1);
+ ypn = (y == h-1) ? nullptr : m.scanLine(y+1);
const QRgb *p = (const QRgb *)scanLine(y);
for (x = 0; x < w; x++) {
// slowness here - it's possible to do six of these tests
@@ -3053,11 +3053,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const
if (!clipTight) {
ypn = m.scanLine(0);
- ypc = 0;
+ ypc = nullptr;
for (y = 0; y < h; y++) {
ypp = ypc;
ypc = ypn;
- ypn = (y == h-1) ? 0 : m.scanLine(y+1);
+ ypn = (y == h-1) ? nullptr : m.scanLine(y+1);
const QRgb *p = (const QRgb *)scanLine(y);
for (x = 0; x < w; x++) {
if ((*p & 0x00ffffff) != background) {
@@ -4122,7 +4122,7 @@ void QImage::setText(const QString &key, const QString &value)
QPaintEngine *QImage::paintEngine() const
{
if (!d)
- return 0;
+ return nullptr;
if (!d->paintEngine) {
QPaintDevice *paintDevice = const_cast<QImage *>(this);
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 97a5f89e68..27088698ec 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -198,7 +198,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
store = destLayout->storeFromRGB32;
}
QDitherInfo dither;
- QDitherInfo *ditherPtr = 0;
+ QDitherInfo *ditherPtr = nullptr;
if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
ditherPtr = &dither;
@@ -212,8 +212,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
buffer = reinterpret_cast<uint *>(destData) + x;
else
l = qMin(l, BufferSize);
- const uint *ptr = fetch(buffer, srcData, x, l, 0, ditherPtr);
- store(destData, ptr, x, l, 0, ditherPtr);
+ const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
+ store(destData, ptr, x, l, nullptr, ditherPtr);
x += l;
}
srcData += src->bytes_per_line;
@@ -257,7 +257,8 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
// Cannot be used with indexed formats or between formats with different pixel depths.
Q_ASSERT(dst_format > QImage::Format_Indexed8);
Q_ASSERT(data->format > QImage::Format_Indexed8);
- if (data->depth != qt_depthForFormat(dst_format))
+ const int destDepth = qt_depthForFormat(dst_format);
+ if (data->depth < destDepth)
return false;
const QPixelLayout *srcLayout = &qPixelLayouts[data->format];
@@ -272,9 +273,16 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
uint buf[BufferSize];
uint *buffer = buf;
uchar *srcData = data->data;
+ uchar *destData = data->data;
+
+ QImageData::ImageSizeParameters params = { data->bytes_per_line, data->nbytes };
+ if (data->depth != destDepth) {
+ params = QImageData::calculateImageParameters(data->width, data->height, destDepth);
+ if (!params.isValid())
+ return false;
+ }
- Q_ASSERT(srcLayout->bpp == destLayout->bpp);
- Q_ASSERT(srcLayout->bpp != QPixelLayout::BPP64);
+ Q_ASSERT(destLayout->bpp != QPixelLayout::BPP64);
FetchAndConvertPixelsFunc fetch = srcLayout->fetchToARGB32PM;
ConvertAndStorePixelsFunc store = destLayout->storeFromARGB32PM;
if (!srcLayout->hasAlphaChannel && destLayout->storeFromRGB32) {
@@ -306,7 +314,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
store = destLayout->storeFromRGB32;
}
QDitherInfo dither;
- QDitherInfo *ditherPtr = 0;
+ QDitherInfo *ditherPtr = nullptr;
if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
ditherPtr = &dither;
@@ -316,15 +324,26 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
while (x < data->width) {
dither.x = x;
int l = data->width - x;
- if (destLayout->bpp == QPixelLayout::BPP32)
+ if (srcLayout->bpp == QPixelLayout::BPP32)
buffer = reinterpret_cast<uint *>(srcData) + x;
else
l = qMin(l, BufferSize);
const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
- store(srcData, ptr, x, l, nullptr, ditherPtr);
+ store(destData, ptr, x, l, nullptr, ditherPtr);
x += l;
}
srcData += data->bytes_per_line;
+ destData += params.bytesPerLine;
+ }
+ if (params.totalSize != data->nbytes) {
+ Q_ASSERT(params.totalSize < data->nbytes);
+ void *newData = realloc(data->data, params.totalSize);
+ if (newData) {
+ data->data = (uchar *)newData;
+ data->nbytes = params.totalSize;
+ }
+ data->bytes_per_line = params.bytesPerLine;
+ data->depth = destDepth;
}
data->format = dst_format;
return true;
@@ -832,240 +851,6 @@ static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConver
return true;
}
-static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
-{
- Q_ASSERT(data->format == QImage::Format_Indexed8);
- Q_ASSERT(data->own_data);
-
- const int depth = 32;
- auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
- if (params.bytesPerLine < 0)
- return false;
- uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
- if (!newData)
- return false;
-
- data->data = newData;
-
- // start converting from the end because the end image is bigger than the source
- uchar *src_data = newData + data->nbytes; // end of src
- quint32 *dest_data = (quint32 *) (newData + params.totalSize); // end of dest > end of src
- const int width = data->width;
- const int src_pad = data->bytes_per_line - width;
- const int dest_pad = (params.bytesPerLine >> 2) - width;
- if (data->colortable.size() == 0) {
- data->colortable.resize(256);
- for (int i = 0; i < 256; ++i)
- data->colortable[i] = qRgb(i, i, i);
- } else {
- for (int i = 0; i < data->colortable.size(); ++i)
- data->colortable[i] = qPremultiply(data->colortable.at(i));
-
- // Fill the rest of the table in case src_data > colortable.size()
- const int oldSize = data->colortable.size();
- const QRgb lastColor = data->colortable.at(oldSize - 1);
- data->colortable.insert(oldSize, 256 - oldSize, lastColor);
- }
-
- for (int i = 0; i < data->height; ++i) {
- src_data -= src_pad;
- dest_data -= dest_pad;
- for (int pixI = 0; pixI < width; ++pixI) {
- --src_data;
- --dest_data;
- *dest_data = data->colortable.at(*src_data);
- }
- }
-
- data->colortable = QVector<QRgb>();
- data->format = QImage::Format_ARGB32_Premultiplied;
- data->bytes_per_line = params.bytesPerLine;
- data->depth = depth;
- data->nbytes = params.totalSize;
-
- return true;
-}
-
-static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)
-{
- Q_ASSERT(data->format == QImage::Format_Indexed8);
- Q_ASSERT(data->own_data);
-
- const int depth = 32;
- auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
- if (params.bytesPerLine < 0)
- return false;
- uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
- if (!newData)
- return false;
-
- data->data = newData;
-
- // start converting from the end because the end image is bigger than the source
- uchar *src_data = newData + data->nbytes;
- quint32 *dest_data = (quint32 *) (newData + params.totalSize);
- const int width = data->width;
- const int src_pad = data->bytes_per_line - width;
- const int dest_pad = (params.bytesPerLine >> 2) - width;
- if (data->colortable.size() == 0) {
- data->colortable.resize(256);
- for (int i = 0; i < 256; ++i)
- data->colortable[i] = qRgb(i, i, i);
- } else {
- // Fill the rest of the table in case src_data > colortable.size()
- const int oldSize = data->colortable.size();
- const QRgb lastColor = data->colortable.at(oldSize - 1);
- data->colortable.insert(oldSize, 256 - oldSize, lastColor);
- }
-
- for (int i = 0; i < data->height; ++i) {
- src_data -= src_pad;
- dest_data -= dest_pad;
- for (int pixI = 0; pixI < width; ++pixI) {
- --src_data;
- --dest_data;
- *dest_data = (quint32) data->colortable.at(*src_data);
- }
- }
-
- data->colortable = QVector<QRgb>();
- data->format = QImage::Format_ARGB32;
- data->bytes_per_line = params.bytesPerLine;
- data->depth = depth;
- data->nbytes = params.totalSize;
-
- return true;
-}
-
-static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags flags)
-{
- Q_ASSERT(data->format == QImage::Format_Indexed8);
- Q_ASSERT(data->own_data);
-
- if (data->has_alpha_clut) {
- for (int i = 0; i < data->colortable.size(); ++i)
- data->colortable[i] |= 0xff000000;
- }
-
- if (!convert_indexed8_to_ARGB_inplace(data, flags))
- return false;
-
- data->format = QImage::Format_RGB32;
- return true;
-}
-
-static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
-{
- Q_ASSERT(data->format == QImage::Format_Indexed8);
- Q_ASSERT(data->own_data);
-
- const int depth = 16;
- auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
- if (params.bytesPerLine < 0)
- return false;
- uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
- if (!newData)
- return false;
-
- data->data = newData;
-
- // start converting from the end because the end image is bigger than the source
- uchar *src_data = newData + data->nbytes;
- quint16 *dest_data = (quint16 *) (newData + params.totalSize);
- const int width = data->width;
- const int src_pad = data->bytes_per_line - width;
- const int dest_pad = (params.bytesPerLine >> 1) - width;
-
- quint16 colorTableRGB16[256];
- const int tableSize = data->colortable.size();
- if (tableSize == 0) {
- for (int i = 0; i < 256; ++i)
- colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
- } else {
- // 1) convert the existing colors to RGB16
- for (int i = 0; i < tableSize; ++i)
- colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
- data->colortable = QVector<QRgb>();
-
- // 2) fill the rest of the table in case src_data > colortable.size()
- const quint16 lastColor = colorTableRGB16[tableSize - 1];
- for (int i = tableSize; i < 256; ++i)
- colorTableRGB16[i] = lastColor;
- }
-
- for (int i = 0; i < data->height; ++i) {
- src_data -= src_pad;
- dest_data -= dest_pad;
- for (int pixI = 0; pixI < width; ++pixI) {
- --src_data;
- --dest_data;
- *dest_data = colorTableRGB16[*src_data];
- }
- }
-
- data->format = QImage::Format_RGB16;
- data->bytes_per_line = params.bytesPerLine;
- data->depth = depth;
- data->nbytes = params.totalSize;
-
- return true;
-}
-
-static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
-{
- Q_ASSERT(data->format == QImage::Format_RGB32);
- Q_ASSERT(data->own_data);
-
- const int depth = 16;
-
- // cannot overflow, since we're shrinking the buffer
- const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
- const qsizetype src_bytes_per_line = data->bytes_per_line;
- quint32 *src_data = (quint32 *) data->data;
- quint16 *dst_data = (quint16 *) data->data;
-
- for (int i = 0; i < data->height; ++i) {
- for (int j = 0; j < data->width; ++j)
- dst_data[j] = qConvertRgb32To16(src_data[j]);
- src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line);
- dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line);
- }
- data->format = QImage::Format_RGB16;
- data->bytes_per_line = dst_bytes_per_line;
- data->depth = depth;
- data->nbytes = dst_bytes_per_line * data->height;
- uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
- if (newData)
- data->data = newData;
-
- // can't fail, since we're shrinking
- return true;
-}
-
-static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src)
-{
- Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied);
- Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_RGBA8888);
- Q_ASSERT(src->width == dest->width);
- Q_ASSERT(src->height == dest->height);
-
- const int src_pad = (src->bytes_per_line >> 2) - src->width;
- const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
- const QRgb *src_data = (QRgb *) src->data;
- QRgb *dest_data = (QRgb *) dest->data;
-
- for (int i = 0; i < src->height; ++i) {
- const QRgb *end = src_data + src->width;
- while (src_data < end) {
- *dest_data = qUnpremultiply(*src_data);
- ++src_data;
- ++dest_data;
- }
- src_data += src_pad;
- dest_data += dest_pad;
- }
-}
-
static void convert_RGBA_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_RGBA8888 || src->format == QImage::Format_RGBX8888);
@@ -1732,7 +1517,7 @@ static void convert_X_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageC
static void convert_ARGB_PM_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)
{
QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32));
- convert_ARGB_PM_to_ARGB(tmp.data(), src);
+ convert_generic(tmp.data(), src, Qt::AutoColor);
dither_to_Mono(dst, tmp.data(), flags, false);
}
@@ -2012,7 +1797,7 @@ static void convert_RGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::
static void convert_ARGB_PM_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)
{
QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32));
- convert_ARGB_PM_to_ARGB(tmp.data(), src);
+ convert_generic(tmp.data(), src, Qt::AutoColor);
convert_RGB_to_Indexed8(dst, tmp.data(), flags);
}
@@ -2991,10 +2776,10 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
- convert_indexed8_to_RGB_inplace,
- convert_indexed8_to_ARGB_inplace,
- convert_indexed8_to_ARGB_PM_inplace,
- convert_indexed8_to_RGB16_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
0,
0,
0,
@@ -3018,7 +2803,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
mask_alpha_converter_inplace<QImage::Format_ARGB32>,
mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>,
- convert_RGB_to_RGB16_inplace,
+ 0,
0,
0,
0,
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index a4f927a462..0c9083a16e 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -288,7 +288,7 @@ public:
QImageIOHandlerPrivate::QImageIOHandlerPrivate(QImageIOHandler *q)
{
- device = 0;
+ device = nullptr;
q_ptr = q;
}
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index dff24b449a..6139cf99c9 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -179,10 +179,10 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
bool ignoresFormatAndExtension)
{
if (!autoDetectImageFormat && format.isEmpty())
- return 0;
+ return nullptr;
QByteArray form = format.toLower();
- QImageIOHandler *handler = 0;
+ QImageIOHandler *handler = nullptr;
QByteArray suffix;
#ifndef QT_NO_IMAGEFORMATPLUGIN
@@ -450,7 +450,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
qDebug("QImageReader::createReadHandler: no handlers found. giving up.");
#endif
// no handler: give up.
- return 0;
+ return nullptr;
}
handler->setDevice(device);
@@ -500,9 +500,9 @@ public:
QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq)
: autoDetectImageFormat(true), ignoresFormatAndExtension(false)
{
- device = 0;
+ device = nullptr;
deleteDevice = false;
- handler = 0;
+ handler = nullptr;
quality = -1;
imageReaderError = QImageReader::UnknownError;
autoTransform = UsePluginDefault;
@@ -571,7 +571,7 @@ bool QImageReaderPrivate::initHandler()
}
// assign a handler
- if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0) {
+ if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == nullptr) {
imageReaderError = QImageReader::UnsupportedFormatError;
errorString = QImageReader::tr("Unsupported image format");
return false;
@@ -1089,7 +1089,7 @@ QList<QByteArray> QImageReader::supportedSubTypes() const
return QList<QByteArray>();
if (d->handler->supportsOption(QImageIOHandler::SupportedSubTypes))
- return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
+ return qvariant_cast<QList<QByteArray> >(d->handler->option(QImageIOHandler::SupportedSubTypes));
return QList<QByteArray>();
}
diff --git a/src/gui/image/qimagereaderwriterhelpers.cpp b/src/gui/image/qimagereaderwriterhelpers.cpp
index a5b7fb6449..dd56d887a7 100644
--- a/src/gui/image/qimagereaderwriterhelpers.cpp
+++ b/src/gui/image/qimagereaderwriterhelpers.cpp
@@ -63,7 +63,7 @@ static void appendImagePluginFormats(QFactoryLoader *loader,
const PluginKeyMap keyMap = loader->keyMap();
const PluginKeyMapConstIterator cend = keyMap.constEnd();
int i = -1;
- QImageIOPlugin *plugin = 0;
+ QImageIOPlugin *plugin = nullptr;
result->reserve(result->size() + keyMap.size());
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
if (it.key() != i) {
@@ -71,7 +71,7 @@ static void appendImagePluginFormats(QFactoryLoader *loader,
plugin = qobject_cast<QImageIOPlugin *>(loader->instance(i));
}
const QByteArray key = it.value().toLatin1();
- if (plugin && (plugin->capabilities(0, key) & cap) != 0)
+ if (plugin && (plugin->capabilities(nullptr, key) & cap) != 0)
result->append(key);
}
}
@@ -92,7 +92,7 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader,
const int keyCount = keys.size();
for (int k = 0; k < keyCount; ++k) {
const QByteArray key = keys.at(k).toString().toLatin1();
- if (plugin && (plugin->capabilities(0, key) & cap) != 0) {
+ if (plugin && (plugin->capabilities(nullptr, key) & cap) != 0) {
result->append(mimeTypes.at(k).toString().toLatin1());
if (resultKeys)
resultKeys->append(key);
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index ec66588ddf..512da5c432 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -139,7 +139,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
{
QByteArray form = format.toLower();
QByteArray suffix;
- QImageIOHandler *handler = 0;
+ QImageIOHandler *handler = nullptr;
#ifndef QT_NO_IMAGEFORMATPLUGIN
typedef QMultiMap<int, QString> PluginKeyMap;
@@ -226,7 +226,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
#endif // QT_NO_IMAGEFORMATPLUGIN
if (!handler)
- return 0;
+ return nullptr;
handler->setDevice(device);
if (!testFormat.isEmpty())
@@ -270,9 +270,9 @@ public:
*/
QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
{
- device = 0;
+ device = nullptr;
deleteDevice = false;
- handler = 0;
+ handler = nullptr;
quality = -1;
compression = -1;
gamma = 0.0;
@@ -304,7 +304,7 @@ bool QImageWriterPrivate::canWriteHelper()
errorString = QImageWriter::tr("Device not writable");
return false;
}
- if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) {
+ if (!handler && (handler = createWriteHandlerHelper(device, format)) == nullptr) {
imageWriterError = QImageWriter::UnsupportedFormatError;
errorString = QImageWriter::tr("Unsupported image format");
return false;
@@ -403,7 +403,7 @@ void QImageWriter::setDevice(QIODevice *device)
d->device = device;
d->deleteDevice = false;
delete d->handler;
- d->handler = 0;
+ d->handler = nullptr;
}
/*!
@@ -561,7 +561,7 @@ QList<QByteArray> QImageWriter::supportedSubTypes() const
{
if (!supportsOption(QImageIOHandler::SupportedSubTypes))
return QList<QByteArray>();
- return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
+ return qvariant_cast<QList<QByteArray> >(d->handler->option(QImageIOHandler::SupportedSubTypes));
}
/*!
@@ -823,7 +823,7 @@ QString QImageWriter::errorString() const
*/
bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
{
- if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) {
+ if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == nullptr) {
d->imageWriterError = QImageWriter::UnsupportedFormatError;
d->errorString = QImageWriter::tr("Unsupported image format");
return false;
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 25fce050a1..79019d0fdf 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -272,7 +272,7 @@ public:
/*! \internal
*/
QMoviePrivate::QMoviePrivate(QMovie *qq)
- : reader(0), speed(100), movieState(QMovie::NotRunning),
+ : reader(nullptr), speed(100), movieState(QMovie::NotRunning),
currentFrameNumber(-1), nextFrameNumber(0), greatestFrameNumber(-1),
nextDelay(0), playCounter(-1),
cacheMode(QMovie::CacheNone), haveReadAll(false), isFirstIteration(true)
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index 6a87a01a87..e89cac452a 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -73,14 +73,14 @@ QPicturePaintEngine::QPicturePaintEngine()
: QPaintEngine(*(new QPicturePaintEnginePrivate), AllFeatures)
{
Q_D(QPicturePaintEngine);
- d->pt = 0;
+ d->pt = nullptr;
}
QPicturePaintEngine::QPicturePaintEngine(QPaintEnginePrivate &dptr)
: QPaintEngine(dptr, AllFeatures)
{
Q_D(QPicturePaintEngine);
- d->pt = 0;
+ d->pt = nullptr;
}
QPicturePaintEngine::~QPicturePaintEngine()
@@ -484,7 +484,7 @@ void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti)
#endif
const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
- if (si.chars == 0)
+ if (si.chars == nullptr)
QPaintEngine::drawTextItem(p, ti); // Draw as path
if (d->pic_d->formatMajor >= 9) {
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 978a07b9f9..3a32cc7f15 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -458,7 +458,7 @@ 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 override { return 0; }
+ QPaintEngine *paintEngine() const override { return nullptr; }
int metric(PaintDeviceMetric m) const override
{
switch(m) {
@@ -709,11 +709,11 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
QFontMetrics fm(fnt);
QPointF pt(p.x(), p.y() - fm.ascent());
- qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0,
- str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter);
+ qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/nullptr,
+ str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter);
} else {
- qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/0,
- str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter);
+ qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/nullptr,
+ str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter);
}
break;
@@ -1369,11 +1369,11 @@ QPictureIO::QPictureIO(const QString &fileName, const char* format)
void QPictureIO::init()
{
d = new QPictureIOData();
- d->parameters = 0;
+ d->parameters = nullptr;
d->quality = -1; // default quality of the current format
d->gamma=0.0f;
d->iostat = 0;
- d->iodev = 0;
+ d->iodev = nullptr;
}
/*!
@@ -1467,7 +1467,7 @@ static QPictureHandler *get_picture_handler(const char *format)
return list->at(i);
}
}
- return 0; // no such handler
+ return nullptr; // no such handler
}
@@ -1887,7 +1887,7 @@ bool QPictureIO::read()
if (picture_format.isEmpty()) {
if (file.isOpen()) { // unknown format
file.close();
- d->iodev = 0;
+ d->iodev = nullptr;
}
return false;
}
@@ -1913,7 +1913,7 @@ bool QPictureIO::read()
if (file.isOpen()) { // picture was read using file
file.close();
- d->iodev = 0;
+ d->iodev = nullptr;
}
return d->iostat == 0; // picture successfully read?
}
@@ -1957,7 +1957,7 @@ bool QPictureIO::write()
(*h->write_picture)(this);
if (file.isOpen()) { // picture was written using file
file.close();
- d->iodev = 0;
+ d->iodev = nullptr;
}
return d->iostat == 0; // picture successfully written?
}
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index b6e41f16a5..3fce64cb20 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -94,7 +94,7 @@ void QPixmap::doInit(int w, int h, int type)
if ((w > 0 && h > 0) || type == QPlatformPixmap::BitmapType)
data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type);
else
- data = 0;
+ data = nullptr;
}
/*!
@@ -780,7 +780,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags)
{
- if (len == 0 || buf == 0) {
+ if (len == 0 || buf == nullptr) {
data.reset();
return false;
}
@@ -1455,7 +1455,7 @@ int QPixmap::metric(PaintDeviceMetric metric) const
*/
QPaintEngine *QPixmap::paintEngine() const
{
- return data ? data->paintEngine() : 0;
+ return data ? data->paintEngine() : nullptr;
}
/*!
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 649a25250c..aeed1e3b34 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -92,8 +92,8 @@ void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable)
void QBlittablePlatformPixmap::resize(int width, int height)
{
- m_blittable.reset(0);
- m_engine.reset(0);
+ m_blittable.reset(nullptr);
+ m_engine.reset(nullptr);
d = QGuiApplication::primaryScreen()->depth();
w = width;
h = height;
@@ -145,8 +145,8 @@ void QBlittablePlatformPixmap::fill(const QColor &color)
// if we could just change the format, e.g. when going from
// RGB32 -> ARGB8888.
if (color.alpha() != 255 && !hasAlphaChannel()) {
- m_blittable.reset(0);
- m_engine.reset(0);
+ m_blittable.reset(nullptr);
+ m_engine.reset(nullptr);
m_alpha = true;
}
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 483d6d79a2..9709df9e0c 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -126,7 +126,7 @@ static inline bool qt_pixmapcache_thread_test()
/*!
Constructs an empty Key object.
*/
-QPixmapCache::Key::Key() : d(0)
+QPixmapCache::Key::Key() : d(nullptr)
{
}
@@ -259,9 +259,9 @@ uint qHash(const QPixmapCache::Key &k)
}
QPMCache::QPMCache()
- : QObject(0),
+ : QObject(nullptr),
QCache<QPixmapCache::Key, QPixmapCacheEntry>(cache_limit_default),
- keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false)
+ keyArray(nullptr), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false)
{
}
QPMCache::~QPMCache()
@@ -325,7 +325,7 @@ QPixmap *QPMCache::object(const QString &key) const
QPixmapCache::Key cacheKey = cacheKeys.value(key);
if (!cacheKey.d || !cacheKey.d->isValid) {
const_cast<QPMCache *>(this)->cacheKeys.remove(key);
- return 0;
+ return nullptr;
}
QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(cacheKey);
//We didn't find the pixmap in the cache, the key is not valid anymore
@@ -453,7 +453,7 @@ void QPMCache::releaseKey(const QPixmapCache::Key &key)
void QPMCache::clear()
{
free(keyArray);
- keyArray = 0;
+ keyArray = nullptr;
freeKey = 0;
keyArraySize = 0;
//Mark all keys as invalid
@@ -539,7 +539,7 @@ bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
QPixmap *ptr = pm_cache()->object(key);
if (ptr && pixmap)
*pixmap = *ptr;
- return ptr != 0;
+ return ptr != nullptr;
}
/*!
@@ -561,7 +561,7 @@ bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
QPixmap *ptr = pm_cache()->object(key);
if (ptr && pixmap)
*pixmap = *ptr;
- return ptr != 0;
+ return ptr != nullptr;
}
/*!
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index a2e01147c4..493f55514e 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -266,7 +266,7 @@ QImage QPlatformPixmap::toImage(const QRect &rect) const
QImage* QPlatformPixmap::buffer()
{
- return 0;
+ return nullptr;
}
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 4ab45337b0..251f09fe52 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -109,7 +109,7 @@ public:
};
QPngHandlerPrivate(QPngHandler *qq)
- : gamma(0.0), fileGamma(0.0), quality(50), compression(50), colorSpaceState(Undefined), png_ptr(0), info_ptr(0), end_info(0), state(Ready), q(qq)
+ : gamma(0.0), fileGamma(0.0), quality(50), compression(50), colorSpaceState(Undefined), png_ptr(nullptr), info_ptr(nullptr), end_info(nullptr), state(Ready), q(qq)
{ }
float gamma;
@@ -134,18 +134,18 @@ public:
struct AllocatedMemoryPointers {
AllocatedMemoryPointers()
- : row_pointers(0), accRow(0), inRow(0), outRow(0)
+ : row_pointers(nullptr), accRow(nullptr), inRow(nullptr), outRow(nullptr)
{ }
void deallocate()
{
delete [] row_pointers;
- row_pointers = 0;
+ row_pointers = nullptr;
delete [] accRow;
- accRow = 0;
+ accRow = nullptr;
delete [] inRow;
- inRow = 0;
+ inRow = nullptr;
delete [] outRow;
- outRow = 0;
+ outRow = nullptr;
}
png_byte **row_pointers;
@@ -174,7 +174,7 @@ public:
void setGamma(float);
bool writeImage(const QImage& img, int x, int y);
- bool writeImage(const QImage& img, volatile int compression_in, const QString &description, int x, int y);
+ bool writeImage(const QImage& img, int compression_in, const QString &description, int x, int y);
bool writeImage(const QImage& img)
{ return writeImage(img, 0, 0); }
bool writeImage(const QImage& img, int compression, const QString &description)
@@ -245,13 +245,13 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
png_uint_32 height = 0;
int bit_depth = 0;
int color_type = 0;
- png_bytep trans_alpha = 0;
- png_color_16p trans_color_p = 0;
+ png_bytep trans_alpha = nullptr;
+ png_color_16p trans_color_p = nullptr;
int num_trans;
- png_colorp palette = 0;
+ png_colorp palette = nullptr;
int num_palette;
int interlace_method = PNG_INTERLACE_LAST;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, nullptr, nullptr);
png_set_interlace_handling(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY) {
@@ -343,7 +343,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
if (bit_depth != 1)
png_set_packing(png_ptr);
png_read_update_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
QImage::Format format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8;
if (image.size() != QSize(width, height) || image.format() != format) {
image = QImage(width, height, format);
@@ -452,7 +452,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
int bit_depth = 0;
int color_type = 0;
int unit_type = PNG_OFFSET_PIXEL;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();
int bpl = outImage->bytesPerLine();
@@ -478,7 +478,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
amp.accRow[i] = rval*amp.inRow[i];
// Accumulate the next input rows
for (rval = iysz-rval; rval > 0; rval-=oysz) {
- png_read_row(png_ptr, amp.inRow, NULL);
+ png_read_row(png_ptr, amp.inRow, nullptr);
quint32 fact = qMin(oysz, quint32(rval));
for (quint32 i=0; i < ibw; i++)
amp.accRow[i] += fact*amp.inRow[i];
@@ -558,11 +558,11 @@ void QPngHandlerPrivate::readPngTexts(png_info *info)
bool QPngHandlerPrivate::readPngHeader()
{
state = Error;
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,nullptr,nullptr,nullptr);
if (!png_ptr)
return false;
- png_set_error_fn(png_ptr, 0, 0, qt_png_warning);
+ png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning);
#if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
// Trade off a little bit of memory for better compatibility with existing images
@@ -572,21 +572,21 @@ bool QPngHandlerPrivate::readPngHeader()
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
- png_destroy_read_struct(&png_ptr, 0, 0);
- png_ptr = 0;
+ png_destroy_read_struct(&png_ptr, nullptr, nullptr);
+ png_ptr = nullptr;
return false;
}
end_info = png_create_info_struct(png_ptr);
if (!end_info) {
- png_destroy_read_struct(&png_ptr, &info_ptr, 0);
- png_ptr = 0;
+ png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
+ png_ptr = nullptr;
return false;
}
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- png_ptr = 0;
+ png_ptr = nullptr;
return false;
}
@@ -670,7 +670,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- png_ptr = 0;
+ png_ptr = nullptr;
amp.deallocate();
state = Error;
return false;
@@ -689,7 +689,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
if (outImage->isNull()) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- png_ptr = 0;
+ png_ptr = nullptr;
amp.deallocate();
state = Error;
return false;
@@ -706,7 +706,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
int bit_depth = 0;
int color_type = 0;
int unit_type = PNG_OFFSET_PIXEL;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();
int bpl = outImage->bytesPerLine();
@@ -747,7 +747,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
outImage->setText(readTexts.at(i), readTexts.at(i+1));
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- png_ptr = 0;
+ png_ptr = nullptr;
amp.deallocate();
state = Ready;
@@ -767,7 +767,7 @@ QImage::Format QPngHandlerPrivate::readImageFormat()
int bit_depth = 0, color_type = 0;
png_colorp palette;
int num_palette;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
if (color_type == PNG_COLOR_TYPE_GRAY) {
// Black & White or grayscale
if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) {
@@ -900,7 +900,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
return writeImage(image, -1, QString(), off_x, off_y);
}
-bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_in, const QString &description,
+bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const QString &description,
int off_x_in, int off_y_in)
{
QPoint offset = image.offset();
@@ -910,16 +910,16 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_i
png_structp png_ptr;
png_infop info_ptr;
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,nullptr,nullptr,nullptr);
if (!png_ptr) {
return false;
}
- png_set_error_fn(png_ptr, 0, 0, qt_png_warning);
+ png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning);
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
- png_destroy_write_struct(&png_ptr, 0);
+ png_destroy_write_struct(&png_ptr, nullptr);
return false;
}
@@ -1022,7 +1022,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_i
png_set_PLTE(png_ptr, info_ptr, palette, num_palette);
if (num_trans) {
- png_set_tRNS(png_ptr, info_ptr, trans, num_trans, 0);
+ png_set_tRNS(png_ptr, info_ptr, trans, num_trans, nullptr);
}
}
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index cf105b250a..f9424b62bb 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1175,7 +1175,7 @@ QXpmHandler::QXpmHandler()
bool QXpmHandler::readHeader()
{
state = Error;
- if (!read_xpm_header(device(), 0, index, buffer, &cpp, &ncols, &width, &height))
+ if (!read_xpm_header(device(), nullptr, index, buffer, &cpp, &ncols, &width, &height))
return false;
state = ReadHeader;
return true;
@@ -1191,7 +1191,7 @@ bool QXpmHandler::readImage(QImage *image)
return false;
}
- if (!read_xpm_body(device(), 0, index, buffer, cpp, ncols, width, height, *image)) {
+ if (!read_xpm_body(device(), nullptr, index, buffer, cpp, ncols, width, height, *image)) {
state = Error;
return false;
}
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 2390c62b9f..9bdc22b49e 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -130,7 +130,7 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item,
}
if (item) {
- if (item->d_func()->parent == 0) {
+ if (item->d_func()->parent == nullptr) {
item->d_func()->setParentAndModel(q, model);
} else {
qWarning("QStandardItem::setChild: Ignoring duplicate insertion of item %p",
@@ -138,10 +138,19 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item,
return;
}
}
+
+ // setting the model to nullptr invalidates the persistent index which we want to avoid
+ if (!item && oldItem)
+ oldItem->d_func()->setModel(nullptr);
+
+ children.replace(index, item);
+
+ // since now indexFromItem() does no longer return a valid index, the persistent index
+ // will not be invalidated anymore
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
- children.replace(index, item);
+
if (item)
item->d_func()->lastKnownIndex = index;
@@ -412,7 +421,7 @@ void QStandardItemPrivate::setModel(QStandardItemModel *mod)
*/
QStandardItemModelPrivate::QStandardItemModelPrivate()
: root(new QStandardItem),
- itemPrototype(0),
+ itemPrototype(nullptr),
sortRole(Qt::DisplayRole)
{
root->setFlags(Qt::ItemIsDropEnabled);
@@ -510,12 +519,12 @@ bool QStandardItemPrivate::insertRows(int row, int count, const QList<QStandardI
for (int i = 0; i < limit; ++i) {
QStandardItem *item = items.at(i);
if (item) {
- if (item->d_func()->parent == 0) {
+ if (item->d_func()->parent == nullptr) {
item->d_func()->setParentAndModel(q, model);
} else {
qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of item %p",
item);
- item = 0;
+ item = nullptr;
}
}
children.replace(index, item);
@@ -555,12 +564,12 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QSta
for (int i = 0; i < limit; ++i) {
QStandardItem *item = items.at(i);
if (item) {
- if (item->d_func()->parent == 0) {
+ if (item->d_func()->parent == nullptr) {
item->d_func()->setParentAndModel(q, model);
} else {
qWarning("QStandardItem::insertColumns: Ignoring duplicate insertion of item %p",
item);
- item = 0;
+ item = nullptr;
}
}
int r = i / count;
@@ -583,7 +592,7 @@ void QStandardItemModelPrivate::itemChanged(QStandardItem *item, const QVector<i
{
Q_Q(QStandardItemModel);
Q_ASSERT(item);
- if (item->d_func()->parent == 0) {
+ if (item->d_func()->parent == nullptr) {
// Header item
int idx = columnHeaderItems.indexOf(item);
if (idx != -1) {
@@ -679,7 +688,7 @@ void QStandardItemModelPrivate::rowsRemoved(QStandardItem *parent,
for (int i = row; i < row + count; ++i) {
QStandardItem *oldItem = rowHeaderItems.at(i);
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
}
rowHeaderItems.remove(row, count);
@@ -698,7 +707,7 @@ void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent,
for (int i = column; i < column + count; ++i) {
QStandardItem *oldItem = columnHeaderItems.at(i);
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
}
columnHeaderItems.remove(column, count);
@@ -870,7 +879,7 @@ QStandardItem::~QStandardItem()
Q_D(QStandardItem);
for (QStandardItem *child : qAsConst(d->children)) {
if (child)
- child->d_func()->setModel(0);
+ child->d_func()->setModel(nullptr);
delete child;
}
d->children.clear();
@@ -890,7 +899,7 @@ QStandardItem *QStandardItem::parent() const
Q_D(const QStandardItem);
if (!d->model || (d->model->d_func()->root.data() != d->parent))
return d->parent;
- return 0;
+ return nullptr;
}
/*!
@@ -1794,7 +1803,7 @@ void QStandardItem::removeRows(int row, int count)
for (int j = i; j < n+i; ++j) {
QStandardItem *oldItem = d->children.at(j);
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
}
d->children.remove(qMax(i, 0), n);
@@ -1821,7 +1830,7 @@ void QStandardItem::removeColumns(int column, int count)
for (int j=i; j<i+count; ++j) {
QStandardItem *oldItem = d->children.at(j);
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
}
d->children.remove(i, count);
@@ -1874,7 +1883,7 @@ QStandardItem *QStandardItem::child(int row, int column) const
Q_D(const QStandardItem);
int index = d->childIndex(row, column);
if (index == -1)
- return 0;
+ return nullptr;
return d->children.at(index);
}
@@ -1891,12 +1900,12 @@ QStandardItem *QStandardItem::child(int row, int column) const
QStandardItem *QStandardItem::takeChild(int row, int column)
{
Q_D(QStandardItem);
- QStandardItem *item = 0;
+ QStandardItem *item = nullptr;
int index = d->childIndex(row, column);
if (index != -1) {
item = d->children.at(index);
if (item)
- item->d_func()->setParentAndModel(0, 0);
+ item->d_func()->setParentAndModel(nullptr, nullptr);
d->children.replace(index, 0);
}
return item;
@@ -1925,7 +1934,7 @@ QList<QStandardItem*> QStandardItem::takeRow(int row)
for (int column = 0; column < col_count; ++column) {
QStandardItem *ch = d->children.at(index + column);
if (ch)
- ch->d_func()->setParentAndModel(0, 0);
+ ch->d_func()->setParentAndModel(nullptr, nullptr);
items.append(ch);
}
d->children.remove(index, col_count);
@@ -1958,7 +1967,7 @@ QList<QStandardItem*> QStandardItem::takeColumn(int column)
int index = d->childIndex(row, column);
QStandardItem *ch = d->children.at(index);
if (ch)
- ch->d_func()->setParentAndModel(0, 0);
+ ch->d_func()->setParentAndModel(nullptr, nullptr);
d->children.remove(index);
items.prepend(ch);
}
@@ -2291,13 +2300,13 @@ QStandardItem *QStandardItemModel::itemFromIndex(const QModelIndex &index) const
{
Q_D(const QStandardItemModel);
if ((index.row() < 0) || (index.column() < 0) || (index.model() != this))
- return 0;
+ return nullptr;
QStandardItem *parent = static_cast<QStandardItem*>(index.internalPointer());
- if (parent == 0)
- return 0;
+ if (parent == nullptr)
+ return nullptr;
QStandardItem *item = parent->child(index.row(), index.column());
// lazy part
- if (item == 0) {
+ if (item == nullptr) {
item = d->createItem();
parent->d_func()->setChild(index.row(), index.column(), item);
}
@@ -2432,7 +2441,7 @@ void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item
return;
if (item) {
- if (item->model() == 0) {
+ if (item->model() == nullptr) {
item->d_func()->setModel(this);
} else {
qWarning("QStandardItem::setHorizontalHeaderItem: Ignoring duplicate insertion of item %p",
@@ -2442,7 +2451,7 @@ void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item
}
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
d->columnHeaderItems.replace(column, item);
@@ -2461,7 +2470,7 @@ QStandardItem *QStandardItemModel::horizontalHeaderItem(int column) const
{
Q_D(const QStandardItemModel);
if ((column < 0) || (column >= columnCount()))
- return 0;
+ return nullptr;
return d->columnHeaderItems.at(column);
}
@@ -2488,7 +2497,7 @@ void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item)
return;
if (item) {
- if (item->model() == 0) {
+ if (item->model() == nullptr) {
item->d_func()->setModel(this);
} else {
qWarning("QStandardItem::setVerticalHeaderItem: Ignoring duplicate insertion of item %p",
@@ -2498,7 +2507,7 @@ void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item)
}
if (oldItem)
- oldItem->d_func()->setModel(0);
+ oldItem->d_func()->setModel(nullptr);
delete oldItem;
d->rowHeaderItems.replace(row, item);
@@ -2517,7 +2526,7 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const
{
Q_D(const QStandardItemModel);
if ((row < 0) || (row >= rowCount()))
- return 0;
+ return nullptr;
return d->rowHeaderItems.at(row);
}
@@ -2757,10 +2766,10 @@ QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column)
{
Q_D(QStandardItemModel);
if ((column < 0) || (column >= columnCount()))
- return 0;
+ return nullptr;
QStandardItem *headerItem = d->columnHeaderItems.at(column);
if (headerItem) {
- headerItem->d_func()->setParentAndModel(0, 0);
+ headerItem->d_func()->setParentAndModel(nullptr, nullptr);
d->columnHeaderItems.replace(column, 0);
}
return headerItem;
@@ -2779,10 +2788,10 @@ QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row)
{
Q_D(QStandardItemModel);
if ((row < 0) || (row >= rowCount()))
- return 0;
+ return nullptr;
QStandardItem *headerItem = d->rowHeaderItems.at(row);
if (headerItem) {
- headerItem->d_func()->setParentAndModel(0, 0);
+ headerItem->d_func()->setParentAndModel(nullptr, nullptr);
d->rowHeaderItems.replace(row, 0);
}
return headerItem;
@@ -2876,7 +2885,7 @@ QVariant QStandardItemModel::headerData(int section, Qt::Orientation orientation
|| ((orientation == Qt::Vertical) && (section >= rowCount()))) {
return QVariant();
}
- QStandardItem *headerItem = 0;
+ QStandardItem *headerItem = nullptr;
if (orientation == Qt::Horizontal)
headerItem = d->columnHeaderItems.at(section);
else if (orientation == Qt::Vertical)
@@ -2902,7 +2911,7 @@ QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex &pa
{
Q_D(const QStandardItemModel);
QStandardItem *parentItem = d->itemFromIndex(parent);
- if ((parentItem == 0)
+ if ((parentItem == nullptr)
|| (row < 0)
|| (column < 0)
|| (row >= parentItem->rowCount())
@@ -2919,7 +2928,7 @@ bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex
{
Q_D(QStandardItemModel);
QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data();
- if (item == 0)
+ if (item == nullptr)
return false;
return item->d_func()->insertColumns(column, count, QList<QStandardItem*>());
}
@@ -2931,7 +2940,7 @@ bool QStandardItemModel::insertRows(int row, int count, const QModelIndex &paren
{
Q_D(QStandardItemModel);
QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data();
- if (item == 0)
+ if (item == nullptr)
return false;
return item->d_func()->insertRows(row, count, QList<QStandardItem*>());
}
@@ -2967,7 +2976,7 @@ bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex
{
Q_D(QStandardItemModel);
QStandardItem *item = d->itemFromIndex(parent);
- if ((item == 0) || (count < 1) || (column < 0) || ((column + count) > item->columnCount()))
+ if ((item == nullptr) || (count < 1) || (column < 0) || ((column + count) > item->columnCount()))
return false;
item->removeColumns(column, count);
return true;
@@ -2980,7 +2989,7 @@ bool QStandardItemModel::removeRows(int row, int count, const QModelIndex &paren
{
Q_D(QStandardItemModel);
QStandardItem *item = d->itemFromIndex(parent);
- if ((item == 0) || (count < 1) || (row < 0) || ((row + count) > item->rowCount()))
+ if ((item == nullptr) || (count < 1) || (row < 0) || ((row + count) > item->rowCount()))
return false;
item->removeRows(row, count);
return true;
@@ -3004,7 +3013,7 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value
if (!index.isValid())
return false;
QStandardItem *item = itemFromIndex(index);
- if (item == 0)
+ if (item == nullptr)
return false;
item->setData(value, role);
return true;
@@ -3047,17 +3056,17 @@ bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation,
|| ((orientation == Qt::Vertical) && (section >= rowCount()))) {
return false;
}
- QStandardItem *headerItem = 0;
+ QStandardItem *headerItem = nullptr;
if (orientation == Qt::Horizontal) {
headerItem = d->columnHeaderItems.at(section);
- if (headerItem == 0) {
+ if (headerItem == nullptr) {
headerItem = d->createItem();
headerItem->d_func()->setModel(this);
d->columnHeaderItems.replace(section, headerItem);
}
} else if (orientation == Qt::Vertical) {
headerItem = d->rowHeaderItems.at(section);
- if (headerItem == 0) {
+ if (headerItem == nullptr) {
headerItem = d->createItem();
headerItem->d_func()->setModel(this);
d->rowHeaderItems.replace(section, headerItem);
@@ -3076,7 +3085,7 @@ bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation,
bool QStandardItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
{
QStandardItem *item = itemFromIndex(index);
- if (item == 0)
+ if (item == nullptr)
return false;
item->d_func()->setItemData(roles);
return true;
@@ -3106,7 +3115,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
{
QMimeData *data = QAbstractItemModel::mimeData(indexes);
if(!data)
- return 0;
+ return nullptr;
const QString format = qStandardItemModelDataListMimeType();
if (!mimeTypes().contains(format))
@@ -3124,7 +3133,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
stack.push(item);
} else {
qWarning("QStandardItemModel::mimeData: No item associated with invalid index");
- return 0;
+ return nullptr;
}
}
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 267c079ad9..db22ef2486 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -461,7 +461,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
const QMimeData* QClipboard::mimeData(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
- if (!clipboard->supportsMode(mode)) return 0;
+ if (!clipboard->supportsMode(mode)) return nullptr;
return clipboard->mimeData(mode);
}
@@ -488,7 +488,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode)
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
if (!clipboard->supportsMode(mode)) {
- if (src != 0) {
+ if (src != nullptr) {
qDebug("Data set on unsupported clipboard mode. QMimeData object will be deleted.");
src->deleteLater();
}
@@ -512,7 +512,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode)
*/
void QClipboard::clear(Mode mode)
{
- setMimeData(0, mode);
+ setMimeData(nullptr, mode);
}
/*!
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index fd912362bf..f5a794b642 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -386,7 +386,7 @@ QDataStream &operator>>(QDataStream &s, QCursor &c)
*/
QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
- : d(0)
+ : d(nullptr)
{
QImage img = pixmap.toImage().convertToFormat(QImage::Format_Indexed8, Qt::ThresholdDither|Qt::AvoidDither);
QBitmap bm = QBitmap::fromImage(img, Qt::ThresholdDither|Qt::AvoidDither);
@@ -442,7 +442,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
*/
QCursor::QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
- : d(0)
+ : d(nullptr)
{
d = QCursorData::setBitmap(bitmap, mask, hotX, hotY, 1.0);
}
@@ -454,7 +454,7 @@ QCursor::QCursor()
{
if (!QCursorData::initialized) {
if (QCoreApplication::startingUp()) {
- d = 0;
+ d = nullptr;
return;
}
QCursorData::initialize();
@@ -472,7 +472,7 @@ QCursor::QCursor()
\sa setShape()
*/
QCursor::QCursor(Qt::CursorShape shape)
- : d(0)
+ : d(nullptr)
{
if (!QCursorData::initialized)
QCursorData::initialize();
@@ -552,7 +552,7 @@ void QCursor::setShape(Qt::CursorShape shape)
{
if (!QCursorData::initialized)
QCursorData::initialize();
- QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : 0;
+ QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : nullptr;
if (!c)
c = qt_cursorTable[0];
c->ref.ref();
@@ -677,7 +677,7 @@ QCursorData *qt_cursorTable[Qt::LastCursor + 1];
bool QCursorData::initialized = false;
QCursorData::QCursorData(Qt::CursorShape s)
- : ref(1), cshape(s), bm(0), bmm(0), hx(0), hy(0)
+ : ref(1), cshape(s), bm(nullptr), bmm(nullptr), hx(0), hy(0)
{
}
@@ -697,7 +697,7 @@ void QCursorData::cleanup()
// In case someone has a static QCursor defined with this shape
if (!qt_cursorTable[shape]->ref.deref())
delete qt_cursorTable[shape];
- qt_cursorTable[shape] = 0;
+ qt_cursorTable[shape] = nullptr;
}
QCursorData::initialized = false;
}
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index dd541af3b8..fe766c900e 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -48,19 +48,19 @@
QT_BEGIN_NAMESPACE
// the universe's only drag manager
-QDragManager *QDragManager::m_instance = 0;
+QDragManager *QDragManager::m_instance = nullptr;
QDragManager::QDragManager()
- : QObject(qApp), m_currentDropTarget(0),
+ : QObject(qApp), m_currentDropTarget(nullptr),
m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()),
- m_object(0)
+ m_object(nullptr)
{
Q_ASSERT(!m_instance);
}
QDragManager::~QDragManager()
{
- m_instance = 0;
+ m_instance = nullptr;
}
QDragManager *QDragManager::self()
@@ -74,7 +74,7 @@ QObject *QDragManager::source() const
{
if (m_object)
return m_object->source();
- return 0;
+ return nullptr;
}
void QDragManager::setCurrentTarget(QObject *target, bool dropped)
@@ -111,7 +111,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
m_object = o;
- m_object->d_func()->target = 0;
+ m_object->d_func()->target = nullptr;
QGuiApplicationPrivate::instance()->notifyDragStarted(m_object.data());
const Qt::DropAction result = m_platformDrag->drag(m_object);
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 8e2f7be23e..3712eace15 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -112,8 +112,8 @@ QDrag::QDrag(QObject *dragSource)
{
Q_D(QDrag);
d->source = dragSource;
- d->target = 0;
- d->data = 0;
+ d->target = nullptr;
+ d->data = nullptr;
d->hotspot = QPoint(-10, -10);
d->executed_action = Qt::IgnoreAction;
d->supported_actions = Qt::IgnoreAction;
@@ -138,7 +138,7 @@ void QDrag::setMimeData(QMimeData *data)
Q_D(QDrag);
if (d->data == data)
return;
- if (d->data != 0)
+ if (d->data != nullptr)
delete d->data;
d->data = data;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f555f4dc05..c69cc8ce6f 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -2950,7 +2950,7 @@ QObject* QDropEvent::source() const
{
if (const QDragManager *manager = QDragManager::self())
return manager->source();
- return 0;
+ return nullptr;
}
@@ -4315,8 +4315,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
- _window(0),
- _target(0),
+ _window(nullptr),
+ _target(nullptr),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
@@ -5008,7 +5008,7 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
The \a startPos is the position of a touch or mouse event that started the scrolling.
*/
QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)
- : QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos)
+ : QEvent(QEvent::ScrollPrepare), m_target(nullptr), m_startPos(startPos)
{
Q_UNUSED(m_target);
}
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d49f349e7a..29ed2af7a5 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -141,7 +141,7 @@ Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
QPointF QGuiApplicationPrivate::lastCursorPosition(qInf(), qInf());
-QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
+QWindow *QGuiApplicationPrivate::currentMouseWindow = nullptr;
QString QGuiApplicationPrivate::styleOverride;
@@ -161,8 +161,8 @@ QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow;
QVector<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints;
-QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
-QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
+QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr;
+QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr;
QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
@@ -177,13 +177,13 @@ enum ApplicationResourceFlags
static unsigned applicationResourceFlags = 0;
-QIcon *QGuiApplicationPrivate::app_icon = 0;
+QIcon *QGuiApplicationPrivate::app_icon = nullptr;
-QString *QGuiApplicationPrivate::platform_name = 0;
-QString *QGuiApplicationPrivate::displayName = 0;
-QString *QGuiApplicationPrivate::desktopFileName = 0;
+QString *QGuiApplicationPrivate::platform_name = nullptr;
+QString *QGuiApplicationPrivate::displayName = nullptr;
+QString *QGuiApplicationPrivate::desktopFileName = nullptr;
-QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
+QPalette *QGuiApplicationPrivate::app_pal = nullptr; // default application palette
ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
@@ -193,30 +193,30 @@ int QGuiApplicationPrivate::mousePressY = 0;
static int mouseDoubleClickDistance = -1;
static int touchDoubleTapDistance = -1;
-QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0;
+QWindow *QGuiApplicationPrivate::currentMousePressWindow = nullptr;
static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto;
static bool force_reverse = false;
-QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
-QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0;
+QGuiApplicationPrivate *QGuiApplicationPrivate::self = nullptr;
+QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = nullptr;
int QGuiApplicationPrivate::m_fakeMouseSourcePointId = 0;
#ifndef QT_NO_CLIPBOARD
-QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
+QClipboard *QGuiApplicationPrivate::qt_clipboard = nullptr;
#endif
QList<QScreen *> QGuiApplicationPrivate::screen_list;
QWindowList QGuiApplicationPrivate::window_list;
-QWindow *QGuiApplicationPrivate::focus_window = 0;
+QWindow *QGuiApplicationPrivate::focus_window = nullptr;
static QBasicMutex applicationFontMutex;
-QFont *QGuiApplicationPrivate::app_font = 0;
+QFont *QGuiApplicationPrivate::app_font = nullptr;
QStyleHints *QGuiApplicationPrivate::styleHints = nullptr;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
-QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
+QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = nullptr;
qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0;
@@ -248,7 +248,7 @@ static void initPalette()
static inline void clearPalette()
{
delete QGuiApplicationPrivate::app_pal;
- QGuiApplicationPrivate::app_pal = 0;
+ QGuiApplicationPrivate::app_pal = nullptr;
}
static void initFontUnlocked()
@@ -266,7 +266,7 @@ static void initFontUnlocked()
static inline void clearFontUnlocked()
{
delete QGuiApplicationPrivate::app_font;
- QGuiApplicationPrivate::app_font = 0;
+ QGuiApplicationPrivate::app_font = nullptr;
}
static void initThemeHints()
@@ -661,16 +661,16 @@ QGuiApplication::~QGuiApplication()
Q_D(QGuiApplication);
d->eventDispatcher->closingDown();
- d->eventDispatcher = 0;
+ d->eventDispatcher = nullptr;
#ifndef QT_NO_CLIPBOARD
delete QGuiApplicationPrivate::qt_clipboard;
- QGuiApplicationPrivate::qt_clipboard = 0;
+ QGuiApplicationPrivate::qt_clipboard = nullptr;
#endif
#ifndef QT_NO_SESSIONMANAGER
delete d->session_manager;
- d->session_manager = 0;
+ d->session_manager = nullptr;
#endif //QT_NO_SESSIONMANAGER
clearPalette();
@@ -681,15 +681,15 @@ QGuiApplication::~QGuiApplication()
#endif
delete QGuiApplicationPrivate::app_icon;
- QGuiApplicationPrivate::app_icon = 0;
+ QGuiApplicationPrivate::app_icon = nullptr;
delete QGuiApplicationPrivate::platform_name;
- QGuiApplicationPrivate::platform_name = 0;
+ QGuiApplicationPrivate::platform_name = nullptr;
delete QGuiApplicationPrivate::displayName;
- QGuiApplicationPrivate::displayName = 0;
+ QGuiApplicationPrivate::displayName = nullptr;
delete QGuiApplicationPrivate::m_inputDeviceManager;
- QGuiApplicationPrivate::m_inputDeviceManager = 0;
+ QGuiApplicationPrivate::m_inputDeviceManager = nullptr;
delete QGuiApplicationPrivate::desktopFileName;
- QGuiApplicationPrivate::desktopFileName = 0;
+ QGuiApplicationPrivate::desktopFileName = nullptr;
QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()};
@@ -707,7 +707,7 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
: QCoreApplicationPrivate(argc, argv, flags),
- inputMethod(0),
+ inputMethod(nullptr),
lastTouchType(QEvent::TouchEnd),
ownGlobalShareContext(false)
{
@@ -800,7 +800,7 @@ QWindow *QGuiApplication::modalWindow()
{
CHECK_QAPP_INSTANCE(nullptr)
if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
- return 0;
+ return nullptr;
return QGuiApplicationPrivate::self->modalWindowList.first();
}
@@ -847,7 +847,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
self->modalWindowList.removeFirst();
QEvent e(QEvent::Leave);
QGuiApplication::sendEvent(currentMouseWindow, &e);
- currentMouseWindow = 0;
+ currentMouseWindow = nullptr;
self->modalWindowList.prepend(modal);
}
}
@@ -877,12 +877,12 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
*/
bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const
{
- QWindow *unused = 0;
+ QWindow *unused = nullptr;
if (!blockingWindow)
blockingWindow = &unused;
if (modalWindowList.isEmpty()) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -892,7 +892,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
// A window is not blocked by another modal window if the two are
// the same, or if the window is a child of the modal window.
if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) {
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -933,7 +933,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
break;
}
}
- *blockingWindow = 0;
+ *blockingWindow = nullptr;
return false;
}
@@ -972,7 +972,7 @@ QObject *QGuiApplication::focusObject()
{
if (focusWindow())
return focusWindow()->focusObject();
- return 0;
+ return nullptr;
}
/*!
@@ -1025,7 +1025,7 @@ QWindowList QGuiApplication::topLevelWindows()
QScreen *QGuiApplication::primaryScreen()
{
if (QGuiApplicationPrivate::screen_list.isEmpty())
- return 0;
+ return nullptr;
return QGuiApplicationPrivate::screen_list.at(0);
}
@@ -1043,7 +1043,9 @@ QList<QScreen *> QGuiApplication::screens()
The \a point is in relation to the virtualGeometry() of each set of virtual
siblings. If the point maps to more than one set of virtual siblings the first
- match is returned.
+ match is returned. If you wish to search only the virtual desktop siblings
+ of a known screen (for example siblings of the screen of your application
+ window \c QWidget::windowHandle()->screen()), use QScreen::virtualSiblingAt().
\since 5.10
*/
@@ -1451,7 +1453,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
if (j < argc) {
- argv[j] = 0;
+ argv[j] = nullptr;
argc = j;
}
@@ -1471,7 +1473,7 @@ void QGuiApplicationPrivate::createEventDispatcher()
{
Q_ASSERT(!eventDispatcher);
- if (platform_integration == 0)
+ if (platform_integration == nullptr)
createPlatformIntegration();
// The platform integration should not mess with the event dispatcher
@@ -1482,7 +1484,7 @@ void QGuiApplicationPrivate::createEventDispatcher()
void QGuiApplicationPrivate::eventDispatcherReady()
{
- if (platform_integration == 0)
+ if (platform_integration == nullptr)
createPlatformIntegration();
platform_integration->initialize();
@@ -1579,7 +1581,7 @@ void QGuiApplicationPrivate::init()
}
if (j < argc) {
- argv[j] = 0;
+ argv[j] = nullptr;
argc = j;
}
@@ -1588,7 +1590,7 @@ void QGuiApplicationPrivate::init()
if (!envPlugins.isEmpty())
pluginList += envPlugins.split(',');
- if (platform_integration == 0)
+ if (platform_integration == nullptr)
createPlatformIntegration();
initPalette();
@@ -1694,22 +1696,16 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
#ifndef QT_NO_OPENGL
if (ownGlobalShareContext) {
delete qt_gl_global_share_context();
- qt_gl_set_global_share_context(0);
+ qt_gl_set_global_share_context(nullptr);
}
#endif
-#ifdef Q_OS_WASM
- EM_ASM(
- // unmount persistent directory as IDBFS
- // see QTBUG-70002
- FS.unmount('/home/web_user');
- );
-#endif
+
platform_integration->destroy();
delete platform_theme;
- platform_theme = 0;
+ platform_theme = nullptr;
delete platform_integration;
- platform_integration = 0;
+ platform_integration = nullptr;
window_list.clear();
screen_list.clear();
@@ -1770,7 +1766,7 @@ Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
*/
Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers()
{
- CHECK_QAPP_INSTANCE(Qt::KeyboardModifiers(0))
+ CHECK_QAPP_INSTANCE(Qt::KeyboardModifiers{})
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->queryKeyboardModifiers();
}
@@ -1800,7 +1796,7 @@ Qt::MouseButtons QGuiApplication::mouseButtons()
QPlatformNativeInterface *QGuiApplication::platformNativeInterface()
{
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
- return pi ? pi->nativeInterface() : 0;
+ return pi ? pi->nativeInterface() : nullptr;
}
/*!
@@ -2151,7 +2147,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
window = currentMousePressWindow;
} else if (currentMousePressWindow) {
window = currentMousePressWindow;
- currentMousePressWindow = 0;
+ currentMousePressWindow = nullptr;
}
QPointF delta = globalPoint - globalPoint.toPoint();
localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta;
@@ -2364,7 +2360,7 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
return;
}
- currentMouseWindow = 0;
+ currentMouseWindow = nullptr;
QEvent event(QEvent::Leave);
QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event);
@@ -2383,7 +2379,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (platformWindow->isAlertState())
platformWindow->setAlertState(false);
- QObject *previousFocusObject = previous ? previous->focusObject() : 0;
+ QObject *previousFocusObject = previous ? previous->focusObject() : nullptr;
if (previous) {
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
@@ -2452,7 +2448,7 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf
if (QScreen *screen = wse->screen.data())
topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */);
else // Fall back to default behavior, and try to find some appropriate screen
- topLevelWindow->setScreen(0);
+ topLevelWindow->setScreen(nullptr);
}
// we may have changed scaling, so trigger resize event if needed
if (window->handle()) {
@@ -2878,7 +2874,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
}
- Q_ASSERT(w.data() != 0);
+ Q_ASSERT(w.data() != nullptr);
// make the *scene* functions return the same as the *screen* functions
// Note: touchPoint is a reference to the one from activeTouchPoints,
@@ -3254,12 +3250,12 @@ QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QM
*/
QClipboard * QGuiApplication::clipboard()
{
- if (QGuiApplicationPrivate::qt_clipboard == 0) {
+ if (QGuiApplicationPrivate::qt_clipboard == nullptr) {
if (!qApp) {
qWarning("QGuiApplication: Must construct a QGuiApplication before accessing a QClipboard");
- return 0;
+ return nullptr;
}
- QGuiApplicationPrivate::qt_clipboard = new QClipboard(0);
+ QGuiApplicationPrivate::qt_clipboard = new QClipboard(nullptr);
}
return QGuiApplicationPrivate::qt_clipboard;
}
@@ -3881,7 +3877,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection()
QCursor *QGuiApplication::overrideCursor()
{
CHECK_QAPP_INSTANCE(nullptr)
- return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first();
+ return qGuiApp->d_func()->cursor_list.isEmpty() ? nullptr : &qGuiApp->d_func()->cursor_list.first();
}
/*!
@@ -3915,7 +3911,7 @@ static inline void unsetCursor(QWindow *w)
{
if (const QScreen *screen = w->screen())
if (QPlatformCursor *cursor = screen->handle()->cursor())
- cursor->changeCursor(0, w);
+ cursor->changeCursor(nullptr, w);
}
static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 26f65b2f16..ee493faa5d 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -116,7 +116,7 @@ public:
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
{
if (QCoreApplication::instance())
- return QCoreApplication::instance()->d_func()->threadData->eventDispatcher.loadRelaxed();
+ return QCoreApplication::instance()->d_func()->threadData.loadRelaxed()->eventDispatcher.loadRelaxed();
else
return nullptr;
}
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index edca8d9423..4ed9d032f6 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -103,13 +103,13 @@ static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
QVariantConstructor<GuiTypesFilter> constructor(x, copy);
- QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
+ QMetaTypeSwitcher::switcher<void>(constructor, type, nullptr);
}
static void clear(QVariant::Private *d)
{
QVariantDestructor<GuiTypesFilter> destructor(d);
- QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0);
+ QMetaTypeSwitcher::switcher<void>(destructor, d->type, nullptr);
}
// This class is a hack that customizes access to QPolygon and QPolygonF
@@ -129,7 +129,7 @@ public:
static bool isNull(const QVariant::Private *d)
{
QGuiVariantIsNull<GuiTypesFilter> isNull(d);
- return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0);
+ return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, nullptr);
}
// This class is a hack that customizes access to QPixmap, QBitmap, QCursor and QIcon
@@ -171,7 +171,7 @@ public:
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
QGuiVariantComparator<GuiTypesFilter> comparator(a, b);
- return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
+ return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, nullptr);
}
static bool convert(const QVariant::Private *d, int t,
@@ -311,7 +311,7 @@ static void streamDebug(QDebug dbg, const QVariant &v)
{
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
QVariantDebugStream<GuiTypesFilter> stream(dbg, d);
- QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
+ QMetaTypeSwitcher::switcher<void>(stream, d->type, nullptr);
}
#endif
@@ -320,12 +320,12 @@ const QVariant::Handler qt_gui_variant_handler = {
clear,
isNull,
#ifndef QT_NO_DATASTREAM
- 0,
- 0,
+ nullptr,
+ nullptr,
#endif
compare,
convert,
- 0,
+ nullptr,
#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index f58944a7d2..3c85481495 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -313,7 +313,7 @@ public:
static inline QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *) { return pos; }
static inline QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
static inline QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
- static inline QDpi logicalDpi() { return QDpi(-1,-1); }
+ static inline QDpi logicalDpi(const QScreen *screen) { return QDpi(-1,-1); }
};
namespace QHighDpi {
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 4893b1d57b..274574f561 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
Constructs a new key mapper.
*/
QKeyMapper::QKeyMapper()
- : QObject(*new QKeyMapperPrivate, 0)
+ : QObject(*new QKeyMapperPrivate, nullptr)
{
}
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index 0cc11ca3bb..c74fe0b3a1 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -99,10 +99,10 @@ public:
QOffscreenSurfacePrivate()
: QObjectPrivate()
, surfaceType(QSurface::OpenGLSurface)
- , platformOffscreenSurface(0)
- , offscreenWindow(0)
+ , platformOffscreenSurface(nullptr)
+ , offscreenWindow(nullptr)
, requestedFormat(QSurfaceFormat::defaultFormat())
- , screen(0)
+ , screen(nullptr)
, size(1, 1)
, nativeHandle(nullptr)
{
@@ -235,11 +235,11 @@ void QOffscreenSurface::destroy()
QGuiApplication::sendEvent(this, &e);
delete d->platformOffscreenSurface;
- d->platformOffscreenSurface = 0;
+ d->platformOffscreenSurface = nullptr;
if (d->offscreenWindow) {
d->offscreenWindow->destroy();
delete d->offscreenWindow;
- d->offscreenWindow = 0;
+ d->offscreenWindow = nullptr;
}
d->nativeHandle = nullptr;
@@ -341,7 +341,7 @@ void QOffscreenSurface::setScreen(QScreen *newScreen)
if (!newScreen)
newScreen = QCoreApplication::instance() ? QGuiApplication::primaryScreen() : nullptr;
if (newScreen != d->screen) {
- const bool wasCreated = d->platformOffscreenSurface != 0 || d->offscreenWindow != 0;
+ const bool wasCreated = d->platformOffscreenSurface != nullptr || d->offscreenWindow != nullptr;
if (wasCreated)
destroy();
if (d->screen)
@@ -385,7 +385,7 @@ void QOffscreenSurface::screenDestroyed(QObject *object)
{
Q_D(QOffscreenSurface);
if (object == static_cast<QObject *>(d->screen))
- setScreen(0);
+ setScreen(nullptr);
}
/*!
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 638eb1d12f..124b39f2a9 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -223,7 +223,7 @@ class QGuiGLThreadContext
{
public:
QGuiGLThreadContext()
- : context(0)
+ : context(nullptr)
{
}
~QGuiGLThreadContext() {
@@ -234,7 +234,7 @@ public:
};
Q_GLOBAL_STATIC(QThreadStorage<QGuiGLThreadContext *>, qwindow_context_storage);
-static QOpenGLContext *global_share_context = 0;
+static QOpenGLContext *global_share_context = nullptr;
#ifndef QT_NO_DEBUG
QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker;
@@ -347,7 +347,7 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context
if (!threadContext) {
if (!QThread::currentThread()) {
qWarning("No QTLS available. currentContext won't work");
- return 0;
+ return nullptr;
}
threadContext = new QGuiGLThreadContext;
qwindow_context_storage()->setLocalData(threadContext);
@@ -372,10 +372,10 @@ int QOpenGLContextPrivate::maxTextureSize()
GLint size;
GLint next = 64;
- funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- QOpenGLFunctions_1_0 *gl1funcs = 0;
- QOpenGLFunctions_3_2_Core *gl3funcs = 0;
+ QOpenGLFunctions_1_0 *gl1funcs = nullptr;
+ QOpenGLFunctions_3_2_Core *gl3funcs = nullptr;
if (q->format().profile() == QSurfaceFormat::CoreProfile)
gl3funcs = q->versionFunctions<QOpenGLFunctions_3_2_Core>();
@@ -398,7 +398,7 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
- funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
if (gl1funcs)
gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
else
@@ -455,7 +455,7 @@ QPlatformOpenGLContext *QOpenGLContext::shareHandle() const
Q_D(const QOpenGLContext);
if (d->shareContext)
return d->shareContext->handle();
- return 0;
+ return nullptr;
}
/*!
@@ -517,8 +517,8 @@ void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object)
{
Q_Q(QOpenGLContext);
if (object == static_cast<QObject *>(screen)) {
- screen = 0;
- q->setScreen(0);
+ screen = nullptr;
+ q->setScreen(nullptr);
}
}
@@ -615,7 +615,7 @@ bool QOpenGLContext::create()
d->platformGLContext->setContext(this);
d->platformGLContext->initialize();
if (!d->platformGLContext->isSharing())
- d->shareContext = 0;
+ d->shareContext = nullptr;
d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;
d->shareGroup->d_func()->addContext(this);
return isValid();
@@ -649,15 +649,15 @@ void QOpenGLContext::destroy()
doneCurrent();
if (d->shareGroup)
d->shareGroup->d_func()->removeContext(this);
- d->shareGroup = 0;
+ d->shareGroup = nullptr;
delete d->platformGLContext;
- d->platformGLContext = 0;
+ d->platformGLContext = nullptr;
delete d->functions;
- d->functions = 0;
+ d->functions = nullptr;
for (QAbstractOpenGLFunctions *func : qAsConst(d->externalVersionFunctions)) {
QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func);
- func_d->owningContext = 0;
+ func_d->owningContext = nullptr;
func_d->initialized = false;
}
d->externalVersionFunctions.clear();
@@ -665,7 +665,7 @@ void QOpenGLContext::destroy()
d->versionFunctions.clear();
delete d->textureFunctions;
- d->textureFunctions = 0;
+ d->textureFunctions = nullptr;
d->nativeHandle = QVariant();
}
@@ -823,7 +823,7 @@ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionP
#ifndef QT_OPENGL_ES_2
if (isOpenGLES()) {
qWarning("versionFunctions: Not supported on OpenGL ES");
- return 0;
+ return nullptr;
}
#endif // QT_OPENGL_ES_2
@@ -838,16 +838,16 @@ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionP
// Check that context is compatible with requested version
const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
if (v < vp.version())
- return 0;
+ return nullptr;
// If this context only offers core profile functions then we can't create
// function objects for legacy or compatibility profile requests
if (((vp.hasProfiles() && vp.profile() != QSurfaceFormat::CoreProfile) || vp.isLegacyVersion())
&& f.profile() == QSurfaceFormat::CoreProfile)
- return 0;
+ return nullptr;
// Create object if suitable one not cached
- QAbstractOpenGLFunctions* funcs = 0;
+ QAbstractOpenGLFunctions* funcs = nullptr;
auto it = d->versionFunctions.constFind(vp);
if (it == d->versionFunctions.constEnd()) {
funcs = QOpenGLVersionFunctionsFactory::create(vp);
@@ -1022,7 +1022,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|| qstrncmp(rendererString, "Adreno 6xx", 8) == 0 // Same as above but without the '(TM)'
|| qstrcmp(rendererString, "GC800 core") == 0
|| qstrcmp(rendererString, "GC1000 core") == 0
- || strstr(rendererString, "GC2000") != 0
+ || strstr(rendererString, "GC2000") != nullptr
|| qstrcmp(rendererString, "Immersion.16") == 0;
}
needsWorkaroundSet = true;
@@ -1053,9 +1053,9 @@ void QOpenGLContext::doneCurrent()
d->shareGroup->d_func()->deletePendingResources(this);
d->platformGLContext->doneCurrent();
- QOpenGLContextPrivate::setCurrentContext(0);
+ QOpenGLContextPrivate::setCurrentContext(nullptr);
- d->surface = 0;
+ d->surface = nullptr;
}
/*!
@@ -1224,8 +1224,8 @@ void QOpenGLContext::deleteQGLContext()
Q_D(QOpenGLContext);
if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
d->qGLContextDeleteFunction(d->qGLContextHandle);
- d->qGLContextDeleteFunction = 0;
- d->qGLContextHandle = 0;
+ d->qGLContextDeleteFunction = nullptr;
+ d->qGLContextHandle = nullptr;
}
}
@@ -1252,7 +1252,7 @@ void *QOpenGLContext::openGLModuleHandle()
Q_ASSERT(ni);
return ni->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
#else
- return 0;
+ return nullptr;
#endif
}
@@ -1438,7 +1438,7 @@ QList<QOpenGLContext *> QOpenGLContextGroup::shares() const
QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup()
{
QOpenGLContext *current = QOpenGLContext::currentContext();
- return current ? current->shareGroup() : 0;
+ return current ? current->shareGroup() : nullptr;
}
void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx)
@@ -1491,7 +1491,7 @@ void QOpenGLContextGroupPrivate::cleanup()
while (it != end) {
(*it)->invalidateResource();
- (*it)->m_group = 0;
+ (*it)->m_group = nullptr;
++it;
}
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 022a47c919..2ea8f43711 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -208,8 +208,8 @@ QOpenGLWindowPrivate::~QOpenGLWindowPrivate()
Q_Q(QOpenGLWindow);
if (q->isValid()) {
q->makeCurrent(); // this works even when the platformwindow is destroyed
- paintDevice.reset(0);
- fbo.reset(0);
+ paintDevice.reset(nullptr);
+ fbo.reset(nullptr);
blitter.destroy();
q->doneCurrent();
}
@@ -692,7 +692,7 @@ QPaintDevice *QOpenGLWindow::redirected(QPoint *) const
Q_D(const QOpenGLWindow);
if (QOpenGLContext::currentContext() == d->context.data())
return d->paintDevice.data();
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index 4521c2f62c..4f45fc5fde 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -219,7 +219,7 @@ QPaintDeviceWindow::QPaintDeviceWindow(QPaintDeviceWindowPrivate &dd, QWindow *p
*/
QPaintEngine *QPaintDeviceWindow::paintEngine() const
{
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 61dccd77ac..fc063bc72c 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -536,7 +536,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
\sa QApplication::setPalette(), QApplication::palette()
*/
QPalette::QPalette()
- : d(0)
+ : d(nullptr)
{
data.current_group = Active;
data.resolve_mask = 0;
diff --git a/src/gui/kernel/qplatformclipboard.cpp b/src/gui/kernel/qplatformclipboard.cpp
index ab2998b901..34c94dca3b 100644
--- a/src/gui/kernel/qplatformclipboard.cpp
+++ b/src/gui/kernel/qplatformclipboard.cpp
@@ -67,7 +67,7 @@ private:
QClipboardData::QClipboardData()
{
- src = 0;
+ src = nullptr;
}
QClipboardData::~QClipboardData()
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index aabf28a727..5a438a54a2 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE
QPlatformCursor::clearOverrideCursor().
*/
-QPlatformCursor::Capabilities QPlatformCursor::m_capabilities = 0;
+QPlatformCursor::Capabilities QPlatformCursor::m_capabilities = { };
/*!
\fn QPlatformCursor::QPlatformCursor()
@@ -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, Qt::NoButton, QEvent::MouseMove);
+ QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove);
}
/*!
@@ -439,7 +439,7 @@ void QPlatformCursorImage::createSystemCursor(int id)
{
if (!systemCursorTableInit) {
for (int i = 0; i <= Qt::LastCursor; i++)
- systemCursorTable[i] = 0;
+ systemCursorTable[i] = nullptr;
systemCursorTableInit = true;
}
switch (id) {
@@ -486,7 +486,7 @@ void QPlatformCursorImage::createSystemCursor(int id)
case Qt::BlankCursor:
systemCursorTable[Qt::BlankCursor] =
- new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
+ new QPlatformCursorImage(nullptr, nullptr, 0, 0, 0, 0);
break;
// 20x20 cursors
@@ -556,14 +556,14 @@ void QPlatformCursorImage::createSystemCursor(int id)
void QPlatformCursorImage::set(Qt::CursorShape id)
{
- QPlatformCursorImage *cursor = 0;
+ QPlatformCursorImage *cursor = nullptr;
if (unsigned(id) <= unsigned(Qt::LastCursor)) {
if (!systemCursorTable[id])
createSystemCursor(id);
cursor = systemCursorTable[id];
}
- if (cursor == 0) {
+ if (cursor == nullptr) {
if (!systemCursorTable[Qt::ArrowCursor])
createSystemCursor(Qt::ArrowCursor);
cursor = systemCursorTable[Qt::ArrowCursor];
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 4bee153489..15ac4acf91 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -186,7 +186,7 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi
class QFontDialogOptionsPrivate : public QSharedData
{
public:
- QFontDialogOptionsPrivate() : options(0) {}
+ QFontDialogOptionsPrivate() = default;
QFontDialogOptions::FontDialogOptions options;
QString windowTitle;
@@ -328,7 +328,7 @@ Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData)
class QColorDialogOptionsPrivate : public QSharedData
{
public:
- QColorDialogOptionsPrivate() : options(0) {}
+ QColorDialogOptionsPrivate() = default;
// Write out settings around destruction of dialogs
~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
@@ -465,24 +465,16 @@ void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOpt
class QFileDialogOptionsPrivate : public QSharedData
{
public:
- QFileDialogOptionsPrivate() : options(0),
- viewMode(QFileDialogOptions::Detail),
- fileMode(QFileDialogOptions::AnyFile),
- acceptMode(QFileDialogOptions::AcceptOpen),
- filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs),
- useDefaultNameFilters(true)
- {}
-
QFileDialogOptions::FileDialogOptions options;
QString windowTitle;
- QFileDialogOptions::ViewMode viewMode;
- QFileDialogOptions::FileMode fileMode;
- QFileDialogOptions::AcceptMode acceptMode;
+ QFileDialogOptions::ViewMode viewMode = QFileDialogOptions::Detail;
+ QFileDialogOptions::FileMode fileMode = QFileDialogOptions::AnyFile;
+ QFileDialogOptions::AcceptMode acceptMode = QFileDialogOptions::AcceptOpen;
QString labels[QFileDialogOptions::DialogLabelCount];
- QDir::Filters filters;
+ QDir::Filters filters = QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs;
QList<QUrl> sidebarUrls;
- bool useDefaultNameFilters;
+ bool useDefaultNameFilters = true;
QStringList nameFilters;
QStringList mimeTypeFilters;
QString defaultSuffix;
diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp
index df7b95d8df..749abaf27a 100644
--- a/src/gui/kernel/qplatforminputcontextfactory.cpp
+++ b/src/gui/kernel/qplatforminputcontextfactory.cpp
@@ -85,7 +85,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
#else
Q_UNUSED(key);
#endif
- return 0;
+ return nullptr;
}
QPlatformInputContext *QPlatformInputContextFactory::create()
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index b3d3db0751..63f66e6bf7 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
*/
QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const
{
- static QPlatformFontDatabase *db = 0;
+ static QPlatformFontDatabase *db = nullptr;
if (!db) {
db = new QPlatformFontDatabase;
}
@@ -86,7 +86,7 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const
QPlatformClipboard *QPlatformIntegration::clipboard() const
{
- static QPlatformClipboard *clipboard = 0;
+ static QPlatformClipboard *clipboard = nullptr;
if (!clipboard) {
clipboard = new QPlatformClipboard;
}
@@ -104,7 +104,7 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const
*/
QPlatformDrag *QPlatformIntegration::drag() const
{
- static QSimpleDrag *drag = 0;
+ static QSimpleDrag *drag = nullptr;
if (!drag) {
drag = new QSimpleDrag;
}
@@ -114,12 +114,12 @@ QPlatformDrag *QPlatformIntegration::drag() const
QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
{
- return 0;
+ return nullptr;
}
QPlatformServices *QPlatformIntegration::services() const
{
- return 0;
+ return nullptr;
}
/*!
@@ -303,7 +303,7 @@ QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenG
{
Q_UNUSED(context);
qWarning("This plugin does not support createPlatformOpenGLContext!");
- return 0;
+ return nullptr;
}
#endif // QT_NO_OPENGL
@@ -315,7 +315,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
{
qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!",
cacheId);
- return 0;
+ return nullptr;
}
/*!
@@ -325,7 +325,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const
{
Q_UNUSED(paintDevice)
- return 0;
+ return nullptr;
}
/*!
@@ -357,7 +357,7 @@ void QPlatformIntegration::destroy()
*/
QPlatformInputContext *QPlatformIntegration::inputContext() const
{
- return 0;
+ return nullptr;
}
#ifndef QT_NO_ACCESSIBILITY
@@ -370,7 +370,7 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const
*/
QPlatformAccessibility *QPlatformIntegration::accessibility() const
{
- static QPlatformAccessibility *accessibility = 0;
+ static QPlatformAccessibility *accessibility = nullptr;
if (Q_UNLIKELY(!accessibility)) {
accessibility = new QPlatformAccessibility;
}
@@ -484,7 +484,7 @@ class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &n
QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
Q_UNUSED(surface)
- return 0;
+ return nullptr;
}
#ifndef QT_NO_SESSIONMANAGER
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d9f349555a..01406958e2 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -106,7 +106,8 @@ public:
ApplicationIcon,
SwitchableWidgetComposition,
TopStackedNativeChildWindows,
- OpenGLOnRasterSurface
+ OpenGLOnRasterSurface,
+ MaximizeUsingFullscreenGeometry
};
virtual ~QPlatformIntegration() { }
diff --git a/src/gui/kernel/qplatformintegrationplugin.cpp b/src/gui/kernel/qplatformintegrationplugin.cpp
index 35e4d2797b..b100eacbb5 100644
--- a/src/gui/kernel/qplatformintegrationplugin.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin.cpp
@@ -54,7 +54,7 @@ QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, con
{
Q_UNUSED(key)
Q_UNUSED(paramList);
- return 0;
+ return nullptr;
}
QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, const QStringList &paramList, int &argc, char **argv)
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index b24541d3ec..8c9e73fbc2 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.cpp
@@ -56,35 +56,35 @@ QT_BEGIN_NAMESPACE
void *QPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
void *QPlatformNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen)
{
Q_UNUSED(resource);
Q_UNUSED(screen);
- return 0;
+ return nullptr;
}
void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
Q_UNUSED(resource);
Q_UNUSED(window);
- return 0;
+ return nullptr;
}
void *QPlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
Q_UNUSED(resource);
Q_UNUSED(context);
- return 0;
+ return nullptr;
}
void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore)
{
Q_UNUSED(resource);
Q_UNUSED(backingStore);
- return 0;
+ return nullptr;
}
#ifndef QT_NO_CURSOR
@@ -99,31 +99,31 @@ void *QPlatformNativeInterface::nativeResourceForCursor(const QByteArray &resour
QPlatformNativeInterface::NativeResourceForIntegrationFunction QPlatformNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForContextFunction QPlatformNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForScreenFunction QPlatformNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForWindowFunction QPlatformNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeInterface::nativeResourceFunctionForBackingStore(const QByteArray &resource)
{
Q_UNUSED(resource);
- return 0;
+ return nullptr;
}
QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &function) const
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index 07b5a0dda6..839ec008aa 100644
--- a/src/gui/kernel/qplatformopenglcontext.cpp
+++ b/src/gui/kernel/qplatformopenglcontext.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
class QPlatformOpenGLContextPrivate
{
public:
- QPlatformOpenGLContextPrivate() : context(0) {}
+ QPlatformOpenGLContextPrivate() : context(nullptr) {}
QOpenGLContext *context;
};
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index f3213bf5ea..7c1e2158b1 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -54,7 +54,7 @@ QPlatformScreen::QPlatformScreen()
: d_ptr(new QPlatformScreenPrivate)
{
Q_D(QPlatformScreen);
- d->screen = 0;
+ d->screen = nullptr;
}
QPlatformScreen::~QPlatformScreen()
@@ -99,7 +99,7 @@ QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const
return w;
}
- return 0;
+ return nullptr;
}
/*!
@@ -310,7 +310,7 @@ QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window
// QTBUG 32681: It can happen during the transition between screens
// when one screen is disconnected that the window doesn't have a screen.
if (!window->screen())
- return 0;
+ return nullptr;
return window->screen()->handle();
}
@@ -395,7 +395,7 @@ QString QPlatformScreen::serialNumber() const
*/
QPlatformCursor *QPlatformScreen::cursor() const
{
- return 0;
+ return nullptr;
}
/*!
@@ -410,15 +410,22 @@ void QPlatformScreen::resizeMaximizedWindows()
const QRect newGeometry = deviceIndependentGeometry();
const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
+ const bool supportsMaximizeUsingFullscreen = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MaximizeUsingFullscreenGeometry);
+
for (QWindow *w : windows()) {
// Skip non-platform windows, e.g., offscreen windows.
if (!w->handle())
continue;
- if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry)
+ if (supportsMaximizeUsingFullscreen
+ && w->windowState() & Qt::WindowMaximized
+ && w->flags() & Qt::MaximizeUsingFullscreenGeometryHint) {
+ w->setGeometry(newGeometry);
+ } else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) {
w->setGeometry(newAvailableGeometry);
- else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry)
+ } else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) {
w->setGeometry(newGeometry);
+ }
}
}
@@ -609,4 +616,18 @@ int QPlatformScreen::preferredMode() const
return 0;
}
+QList<QPlatformScreen *> QPlatformPlaceholderScreen::virtualSiblings() const
+{
+ QList<QPlatformScreen *> siblings;
+
+ if (!m_virtualSibling)
+ return siblings;
+
+ for (QScreen *screen : QGuiApplication::screens()) {
+ if (screen->handle() && screen->handle() != this)
+ siblings << screen->handle();
+ }
+ return siblings;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index d7378aed51..0be7646032 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -105,6 +105,8 @@ public:
QPlatformScreen();
virtual ~QPlatformScreen();
+ virtual bool isPlaceholder() const { return false; }
+
virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
virtual QRect geometry() const = 0;
@@ -172,6 +174,27 @@ private:
friend class QScreenPrivate;
};
+// Qt doesn't currently support running with no platform screen
+// QPA plugins can use this class to create a fake screen
+class Q_GUI_EXPORT QPlatformPlaceholderScreen : public QPlatformScreen {
+public:
+ // virtualSibling can be passed in to make the placeholder a sibling with other screens during
+ // the transitioning phase when the real screen is about to be removed, or the first real screen
+ // is about to be added. This is useful because Qt will currently recreate (but now show!)
+ // windows when they are moved from one virtual desktop to another, so if the last monitor is
+ // unplugged, then plugged in again, windows will be hidden unless the placeholder belongs to
+ // the same virtual desktop as the other screens.
+ QPlatformPlaceholderScreen(bool virtualSibling = true) : m_virtualSibling(virtualSibling) {}
+ bool isPlaceholder() const override { return true; }
+ QRect geometry() const override { return QRect(); }
+ QRect availableGeometry() const override { return QRect(); }
+ int depth() const override { return 32; }
+ QImage::Format format() const override { return QImage::Format::Format_RGB32; }
+ QList<QPlatformScreen *> virtualSiblings() const override;
+private:
+ bool m_virtualSibling = true;
+};
+
QT_END_NAMESPACE
#endif // QPLATFORMSCREEN_H
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index f906f808d8..71521c0339 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -354,7 +354,7 @@ const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePri
#endif
QPlatformThemePrivate::QPlatformThemePrivate()
- : systemPalette(0)
+ : systemPalette(nullptr)
{ }
QPlatformThemePrivate::~QPlatformThemePrivate()
@@ -394,7 +394,7 @@ bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const
QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const
{
Q_UNUSED(type);
- return 0;
+ return nullptr;
}
const QPalette *QPlatformTheme::palette(Palette type) const
@@ -405,13 +405,13 @@ const QPalette *QPlatformTheme::palette(Palette type) const
const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette();
return d->systemPalette;
}
- return 0;
+ return nullptr;
}
const QFont *QPlatformTheme::font(Font type) const
{
Q_UNUSED(type)
- return 0;
+ return nullptr;
}
QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
@@ -569,17 +569,17 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const
{
- return 0;
+ return nullptr;
}
QPlatformMenu *QPlatformTheme::createPlatformMenu() const
{
- return 0;
+ return nullptr;
}
QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const
{
- return 0;
+ return nullptr;
}
#ifndef QT_NO_SYSTEMTRAYICON
@@ -589,7 +589,7 @@ QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const
*/
QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const
{
- return 0;
+ return nullptr;
}
#endif
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 356c4ea3ea..3185fc4541 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -309,7 +309,7 @@ public:
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
virtual QIcon fileIcon(const QFileInfo &fileInfo,
- QPlatformTheme::IconOptions iconOptions = nullptr) const;
+ QPlatformTheme::IconOptions iconOptions = { }) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
#ifndef QT_NO_SHORTCUT
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 7adf3db1b8..9de59f8c7e 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
*/
QScreen::QScreen(QPlatformScreen *screen)
- : QObject(*new QScreenPrivate(), 0)
+ : QObject(*new QScreenPrivate(), nullptr)
{
Q_D(QScreen);
d->setPlatformScreen(screen);
@@ -700,6 +700,25 @@ void QScreenPrivate::updatePrimaryOrientation()
}
/*!
+ Returns the screen at \a point within the set of \l QScreen::virtualSiblings(),
+ or \c nullptr if outside of any screen.
+
+ The \a point is in relation to the virtualGeometry() of each set of virtual
+ siblings.
+
+ \since 5.15
+*/
+QScreen *QScreen::virtualSiblingAt(const QPoint &point)
+{
+ const auto &siblings = virtualSiblings();
+ for (QScreen *sibling : siblings) {
+ if (sibling->geometry().contains(point))
+ return sibling;
+ }
+ return nullptr;
+}
+
+/*!
Creates and returns a pixmap constructed by grabbing the contents
of the given \a window restricted by QRect(\a x, \a y, \a width,
\a height).
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 14392d3036..88925ab731 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -125,6 +125,7 @@ public:
QRect availableGeometry() const;
QList<QScreen *> virtualSiblings() const;
+ QScreen *virtualSiblingAt(const QPoint &point);
QSize virtualSize() const;
QRect virtualGeometry() const;
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index e5e9c624b2..8747e02719 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -135,7 +135,7 @@ QSessionManagerPrivate::QSessionManagerPrivate(const QString &id,
QSessionManagerPrivate::~QSessionManagerPrivate()
{
delete platformSessionManager;
- platformSessionManager = 0;
+ platformSessionManager = nullptr;
}
QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key)
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 0395c1db38..a7ea20266b 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -45,6 +45,7 @@
#include "qvector.h"
#include "qcoreapplication.h"
#include <private/qkeymapper_p.h>
+#include <QtCore/qloggingcategory.h>
#include <algorithm>
@@ -52,8 +53,7 @@
QT_BEGIN_NAMESPACE
-// To enable verbose output uncomment below
-//#define DEBUG_QSHORTCUTMAP
+Q_LOGGING_CATEGORY(lcShortcutMap, "qt.gui.shortcutmap")
/* \internal
Entry data for QShortcutMap
@@ -65,11 +65,11 @@ QT_BEGIN_NAMESPACE
struct QShortcutEntry
{
QShortcutEntry()
- : keyseq(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(0), contextMatcher(0)
+ : keyseq(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
{}
QShortcutEntry(const QKeySequence &k)
- : keyseq(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(0), contextMatcher(0)
+ : keyseq(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
{}
QShortcutEntry(QObject *o, const QKeySequence &k, Qt::ShortcutContext c, int i, bool a, QShortcutMap::ContextMatcher m)
@@ -165,11 +165,9 @@ int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &key, Qt::Short
QShortcutEntry newEntry(owner, key, context, --(d->currentId), true, matcher);
const auto it = std::upper_bound(d->sequences.begin(), d->sequences.end(), newEntry);
d->sequences.insert(it, newEntry); // Insert sorted
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug().nospace()
+ qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::addShortcut(" << owner << ", "
<< key << ", " << context << ") = " << d->currentId;
-#endif
return d->currentId;
}
@@ -186,7 +184,7 @@ int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key
{
Q_D(QShortcutMap);
int itemsRemoved = 0;
- bool allOwners = (owner == 0);
+ bool allOwners = (owner == nullptr);
bool allKeys = key.isEmpty();
bool allIds = id == 0;
@@ -212,11 +210,9 @@ int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key
return itemsRemoved;
--i;
}
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug().nospace()
+ qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::removeShortcut(" << id << ", " << owner << ", "
<< key << ") = " << itemsRemoved;
-#endif
return itemsRemoved;
}
@@ -232,7 +228,7 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const
{
Q_D(QShortcutMap);
int itemsChanged = 0;
- bool allOwners = (owner == 0);
+ bool allOwners = (owner == nullptr);
bool allKeys = key.isEmpty();
bool allIds = id == 0;
@@ -250,11 +246,9 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const
return itemsChanged;
--i;
}
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug().nospace()
+ qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::setShortcutEnabled(" << enable << ", " << id << ", "
<< owner << ", " << key << ") = " << itemsChanged;
-#endif
return itemsChanged;
}
@@ -270,7 +264,7 @@ int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const Q
{
Q_D(QShortcutMap);
int itemsChanged = 0;
- bool allOwners = (owner == 0);
+ bool allOwners = (owner == nullptr);
bool allKeys = key.isEmpty();
bool allIds = id == 0;
@@ -288,11 +282,9 @@ int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const Q
return itemsChanged;
--i;
}
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug().nospace()
+ qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::setShortcutAutoRepeat(" << on << ", " << id << ", "
<< owner << ", " << key << ") = " << itemsChanged;
-#endif
return itemsChanged;
}
@@ -395,9 +387,7 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e)
clearSequence(d->currentSequences);
d->currentState = result;
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug().nospace() << "QShortcutMap::nextState(" << e << ") = " << result;
-#endif
+ qCDebug(lcShortcutMap).nospace() << "QShortcutMap::nextState(" << e << ") = " << result;
return result;
}
@@ -436,9 +426,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
return QKeySequence::NoMatch;
createNewSequences(e, d->newEntries, ignoredModifiers);
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug() << "Possible shortcut key sequences:" << d->newEntries;
-#endif
+ qCDebug(lcShortcutMap) << "Possible shortcut key sequences:" << d->newEntries;
// Should never happen
if (d->newEntries == d->currentSequences) {
@@ -491,15 +479,11 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
// previous list. If this match is equal or better than the last match, append to the list
if (oneKSResult > result) {
okEntries.clear();
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug() << "Found better match (" << d->newEntries << "), clearing key sequence list";
-#endif
+ qCDebug(lcShortcutMap) << "Found better match (" << d->newEntries << "), clearing key sequence list";
}
if (oneKSResult && oneKSResult >= result) {
okEntries << d->newEntries.at(i);
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug() << "Added ok key sequence" << d->newEntries;
-#endif
+ qCDebug(lcShortcutMap) << "Added ok key sequence" << d->newEntries;
}
}
@@ -515,9 +499,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
}
if (result != QKeySequence::NoMatch)
d->currentSequences = okEntries;
-#if defined(DEBUG_QSHORTCUTMAP)
- qDebug() << "Returning shortcut match == " << result;
-#endif
+ qCDebug(lcShortcutMap) << "Returning shortcut match == " << result;
return QKeySequence::SequenceMatch(result);
}
@@ -540,19 +522,16 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl,
{
Q_D(QShortcutMap);
QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
-#if defined(DEBUG_QSHORTCUTMAP)
- {
- QDebug debug = qDebug().nospace();
- debug << __FUNCTION__ << '(' << e << ", ignoredModifiers="
+ if (lcShortcutMap().isDebugEnabled()) {
+ qCDebug(lcShortcutMap).nospace() << __FUNCTION__ << '(' << e << ", ignoredModifiers="
<< Qt::KeyboardModifiers(ignoredModifiers) << "), possibleKeys=(";
for (int i = 0, size = possibleKeys.size(); i < size; ++i) {
if (i)
- debug << ", ";
- debug << QKeySequence(possibleKeys.at(i));
+ qCDebug(lcShortcutMap).nospace() << ", ";
+ qCDebug(lcShortcutMap).nospace() << QKeySequence(possibleKeys.at(i));
}
- debug << ')';
+ qCDebug(lcShortcutMap).nospace() << ')';
}
-#endif // DEBUG_QSHORTCUTMAP
int pkTotal = possibleKeys.count();
if (!pkTotal)
return;
@@ -659,18 +638,15 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
d->prevSequence = curKey;
}
// Find next
- const QShortcutEntry *current = 0, *next = 0;
+ const QShortcutEntry *current = nullptr, *next = nullptr;
int i = 0, enabledShortcuts = 0;
-#if defined(DEBUG_QSHORTCUTMAP)
QVector<const QShortcutEntry*> ambiguousShortcuts;
-#endif
while(i < d->identicals.size()) {
current = d->identicals.at(i);
if (current->enabled || !next){
++enabledShortcuts;
-#if defined(DEBUG_QSHORTCUTMAP)
- ambiguousShortcuts.append(current);
-#endif
+ if (lcShortcutMap().isDebugEnabled())
+ ambiguousShortcuts.append(current);
if (enabledShortcuts > d->ambigCount + 1)
break;
next = current;
@@ -683,19 +659,18 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
if (!next || (e->isAutoRepeat() && !next->autorepeat))
return;
// Dispatch next enabled
-#if defined(DEBUG_QSHORTCUTMAP)
- if (ambiguousShortcuts.size() > 1) {
- qDebug() << "The following shortcuts are about to be activated ambiguously:";
- for (const QShortcutEntry *entry : qAsConst(ambiguousShortcuts)) {
- qDebug().nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")";
+ if (lcShortcutMap().isDebugEnabled()) {
+ if (ambiguousShortcuts.size() > 1) {
+ qCDebug(lcShortcutMap) << "The following shortcuts are about to be activated ambiguously:";
+ for (const QShortcutEntry *entry : qAsConst(ambiguousShortcuts))
+ qCDebug(lcShortcutMap).nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")";
}
- }
- qDebug().nospace()
- << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\""
- << next->keyseq.toString() << "\", " << next->id << ", "
- << (bool)(enabledShortcuts>1) << ") to object(" << next->owner << ')';
-#endif
+ qCDebug(lcShortcutMap).nospace()
+ << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\""
+ << next->keyseq.toString() << "\", " << next->id << ", "
+ << static_cast<bool>(enabledShortcuts>1) << ") to object(" << next->owner << ')';
+ }
QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1);
QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se);
}
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index d3070a3d1a..dec3cc399d 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -76,7 +76,7 @@ static QWindow* topLevelAt(const QPoint &pos)
if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w))
return w;
}
- return 0;
+ return nullptr;
}
/*!
@@ -393,7 +393,7 @@ void QSimpleDrag::startDrag()
static void sendDragLeave(QWindow *window)
{
- QWindowSystemInterface::handleDrag(window, nullptr, QPoint(), Qt::IgnoreAction, 0, 0);
+ QWindowSystemInterface::handleDrag(window, nullptr, QPoint(), Qt::IgnoreAction, { }, { });
}
void QSimpleDrag::cancel()
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 732ede90d0..7b3c70c51b 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -116,7 +116,7 @@ public:
\sa QGuiApplication::styleHints()
*/
QStyleHints::QStyleHints()
- : QObject(*new QStyleHintsPrivate(), 0)
+ : QObject(*new QStyleHintsPrivate(), nullptr)
{
}
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 709f28d431..85c576b21c 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -134,7 +134,7 @@ bool QSurface::supportsOpenGL() const
Creates a surface with the given \a type.
*/
QSurface::QSurface(SurfaceClass type)
- : m_type(type), m_reserved(0)
+ : m_type(type), m_reserved(nullptr)
{
}
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 238886220b..571b820409 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
class QSurfaceFormatPrivate
{
public:
- explicit QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts = 0)
+ explicit QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts = { })
: ref(1)
, opts(_opts)
, redBufferSize(-1)
diff --git a/src/gui/kernel/qtestsupport_gui.cpp b/src/gui/kernel/qtestsupport_gui.cpp
index 7aad4d8c7d..79da26f2ca 100644
--- a/src/gui/kernel/qtestsupport_gui.cpp
+++ b/src/gui/kernel/qtestsupport_gui.cpp
@@ -37,10 +37,15 @@
**
****************************************************************************/
+#include <private/qguiapplication_p.h>
+
+#include <qpa/qplatformintegration.h>
+
#include "qtestsupport_gui.h"
#include "qwindow.h"
#include <QtCore/qtestsupport_core.h>
+#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -55,6 +60,14 @@ QT_BEGIN_NAMESPACE
*/
Q_GUI_EXPORT bool QTest::qWaitForWindowActive(QWindow *window, int timeout)
{
+ if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))) {
+ qWarning() << "qWaitForWindowActive was called on a platform that doesn't support window"
+ << "activation. This means there is an error in the test and it should either"
+ << "check for the WindowActivation platform capability before calling"
+ << "qWaitForWindowActivate, use qWaitForWindowExposed instead, or skip the test."
+ << "Falling back to qWaitForWindowExposed.";
+ return qWaitForWindowExposed(window, timeout);
+ }
return QTest::qWaitFor([&]() { return window->isActive(); }, timeout);
}
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f701755500..c4c7de1b2e 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE
\sa setScreen()
*/
QWindow::QWindow(QScreen *targetScreen)
- : QObject(*new QWindowPrivate(), 0)
+ : QObject(*new QWindowPrivate(), nullptr)
, QSurface(QSurface::Window)
{
Q_D(QWindow);
@@ -223,7 +223,7 @@ QWindow::~QWindow()
// some cases end up becoming the focus window again. Clear it again
// here as a workaround. See QTBUG-75326.
if (QGuiApplicationPrivate::focus_window == this)
- QGuiApplicationPrivate::focus_window = 0;
+ QGuiApplicationPrivate::focus_window = nullptr;
}
void QWindowPrivate::init(QScreen *targetScreen)
@@ -469,7 +469,7 @@ inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const
inline void QWindowPrivate::disconnectFromScreen()
{
if (topLevelScreen)
- topLevelScreen = 0;
+ topLevelScreen = nullptr;
}
void QWindowPrivate::connectToScreen(QScreen *screen)
@@ -732,7 +732,7 @@ void QWindow::setParent(QWindow *parent)
if (parent)
parent->create();
- d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : 0);
+ d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : nullptr);
}
QGuiApplicationPrivate::updateBlockedStatus(this);
@@ -744,7 +744,7 @@ void QWindow::setParent(QWindow *parent)
bool QWindow::isTopLevel() const
{
Q_D(const QWindow);
- return d->parentWindow == 0;
+ return d->parentWindow == nullptr;
}
/*!
@@ -2018,7 +2018,7 @@ void QWindow::setScreen(QScreen *newScreen)
Q_D(QWindow);
if (!newScreen)
newScreen = QGuiApplication::primaryScreen();
- d->setTopLevelScreen(newScreen, newScreen != 0);
+ d->setTopLevelScreen(newScreen, newScreen != nullptr);
}
/*!
@@ -2036,7 +2036,7 @@ void QWindow::setScreen(QScreen *newScreen)
*/
QAccessibleInterface *QWindow::accessibleRoot() const
{
- return 0;
+ return nullptr;
}
/*!
@@ -2696,7 +2696,7 @@ QWindow *QWindow::fromWinId(WId id)
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ForeignWindows)) {
qWarning("QWindow::fromWinId(): platform plugin does not support foreign windows.");
- return 0;
+ return nullptr;
}
QWindow *window = new QWindow;
@@ -2770,7 +2770,7 @@ void QWindow::setCursor(const QCursor &cursor)
void QWindow::unsetCursor()
{
Q_D(QWindow);
- d->setCursor(0);
+ d->setCursor(nullptr);
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 8457282bed..3e7d592016 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -46,7 +46,9 @@
#include <qpa/qplatformintegration.h>
#include <qdebug.h>
#include "qhighdpiscaling_p.h"
+
#include <QtCore/qscopedvaluerollback.h>
+#include <QtCore/private/qlocking_p.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
@@ -179,7 +181,7 @@ void QWindowSystemInterfacePrivate::installWindowSystemEventHandler(QWindowSyste
void QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(QWindowSystemEventHandler *handler)
{
if (eventHandler == handler)
- eventHandler = 0;
+ eventHandler = nullptr;
}
QWindowSystemEventHandler::~QWindowSystemEventHandler()
@@ -623,7 +625,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
static int g_nextPointId = 1;
// map from device-independent point id (arbitrary) to "Qt point" ids
-QMutex QWindowSystemInterfacePrivate::pointIdMapMutex;
+static QBasicMutex pointIdMapMutex;
typedef QMap<quint64, int> PointIdMap;
Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
@@ -641,7 +643,7 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
*/
static int acquireCombinedPointId(quint8 deviceId, int pointId)
{
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
+ const auto locker = qt_scoped_lock(pointIdMapMutex);
quint64 combinedId64 = (quint64(deviceId) << 32) + pointId;
auto it = g_pointIdMap->constFind(combinedId64);
@@ -702,7 +704,7 @@ QList<QTouchEvent::TouchPoint>
}
if (states == Qt::TouchPointReleased) {
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
+ const auto locker = qt_scoped_lock(pointIdMapMutex);
// All points on deviceId have been released.
// Remove all points associated with that device from g_pointIdMap.
@@ -723,7 +725,7 @@ QList<QTouchEvent::TouchPoint>
void QWindowSystemInterfacePrivate::clearPointIdMap()
{
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
+ const auto locker = qt_scoped_lock(pointIdMapMutex);
g_pointIdMap->clear();
g_nextPointId = 1;
}
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 6e4bce607e..dd6f29b41f 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -529,7 +529,6 @@ public:
static QWaitCondition eventsFlushed;
static QMutex flushEventMutex;
- static QMutex pointIdMapMutex;
static QAtomicInt eventAccepted;
static QList<QTouchEvent::TouchPoint>
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 667d16317f..adca536797 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -72,7 +72,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
return;
}
QOpenGLFunctions *funcs = ctx->functions();
- const char *extensionStr = 0;
+ const char *extensionStr = nullptr;
if (ctx->isOpenGLES() || ctx->format().majorVersion() < 3)
extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index 537097c09f..5387cc06e3 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -143,10 +143,10 @@ public:
QOpenGLBufferPrivate(QOpenGLBuffer::Type t)
: ref(1),
type(t),
- guard(0),
+ guard(nullptr),
usagePattern(QOpenGLBuffer::StaticDraw),
actualUsagePattern(QOpenGLBuffer::StaticDraw),
- funcs(0)
+ funcs(nullptr)
{
}
@@ -323,10 +323,10 @@ void QOpenGLBuffer::destroy()
Q_D(QOpenGLBuffer);
if (d->guard) {
d->guard->free();
- d->guard = 0;
+ d->guard = nullptr;
}
delete d->funcs;
- d->funcs = 0;
+ d->funcs = nullptr;
}
/*!
@@ -545,9 +545,9 @@ void *QOpenGLBuffer::map(QOpenGLBuffer::Access access)
qWarning("QOpenGLBuffer::map(): buffer not created");
#endif
if (!d->guard || !d->guard->id())
- return 0;
+ return nullptr;
if (d->funcs->hasOpenGLExtension(QOpenGLExtensions::MapBufferRange)) {
- QOpenGLBuffer::RangeAccessFlags rangeAccess = 0;
+ QOpenGLBuffer::RangeAccessFlags rangeAccess;
switch (access) {
case QOpenGLBuffer::ReadOnly:
rangeAccess = QOpenGLBuffer::RangeRead;
@@ -586,7 +586,7 @@ void *QOpenGLBuffer::mapRange(int offset, int count, QOpenGLBuffer::RangeAccessF
qWarning("QOpenGLBuffer::mapRange(): buffer not created");
#endif
if (!d->guard || !d->guard->id())
- return 0;
+ return nullptr;
return d->funcs->glMapBufferRange(d->type, offset, count, access);
}
diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp
index baa44f86b0..a95a0a5767 100644
--- a/src/gui/opengl/qopenglcustomshaderstage.cpp
+++ b/src/gui/opengl/qopenglcustomshaderstage.cpp
@@ -48,7 +48,7 @@ class QOpenGLCustomShaderStagePrivate
{
public:
QOpenGLCustomShaderStagePrivate() :
- m_manager(0) {}
+ m_manager(nullptr) {}
QPointer<QOpenGLEngineShaderManager> m_manager;
QByteArray m_source;
@@ -110,8 +110,8 @@ void QOpenGLCustomShaderStage::removeFromPainter(QPainter* p)
// Just set the stage to null, don't call removeCustomStage().
// This should leave the program in a compiled/linked state
// if the next custom shader stage is this one again.
- d->m_manager->setCustomStage(0);
- d->m_manager = 0;
+ d->m_manager->setCustomStage(nullptr);
+ d->m_manager = nullptr;
}
QByteArray QOpenGLCustomShaderStage::source() const
@@ -125,7 +125,7 @@ QByteArray QOpenGLCustomShaderStage::source() const
void QOpenGLCustomShaderStage::setInactive()
{
Q_D(QOpenGLCustomShaderStage);
- d->m_manager = 0;
+ d->m_manager = nullptr;
}
void QOpenGLCustomShaderStage::setSource(const QByteArray& s)
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 462a4fdb3b..310006feaf 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -1108,14 +1108,14 @@ public:
\internal
*/
QOpenGLDebugLoggerPrivate::QOpenGLDebugLoggerPrivate()
- : glDebugMessageControl(0),
- glDebugMessageInsert(0),
- glDebugMessageCallback(0),
- glGetDebugMessageLog(0),
- glPushDebugGroup(0),
- glPopDebugGroup(0),
- oldDebugCallbackFunction(0),
- context(0),
+ : glDebugMessageControl(nullptr),
+ glDebugMessageInsert(nullptr),
+ glDebugMessageCallback(nullptr),
+ glGetDebugMessageLog(nullptr),
+ glPushDebugGroup(nullptr),
+ glPopDebugGroup(nullptr),
+ oldDebugCallbackFunction(nullptr),
+ context(nullptr),
maxMessageLength(0),
loggingMode(QOpenGLDebugLogger::AsynchronousLogging),
initialized(false),
@@ -1228,7 +1228,7 @@ void QOpenGLDebugLoggerPrivate::controlDebugMessages(QOpenGLDebugMessage::Source
const GLsizei idCount = ids.count();
// The GL_KHR_debug extension says that if idCount is 0, idPtr must be ignored.
// Unfortunately, some bugged drivers do NOT ignore it, so pass NULL in case.
- const GLuint * const idPtr = idCount ? ids.constData() : 0;
+ const GLuint * const idPtr = idCount ? ids.constData() : nullptr;
for (GLenum source : glSources)
for (GLenum type : glTypes)
@@ -1247,7 +1247,7 @@ void QOpenGLDebugLoggerPrivate::_q_contextAboutToBeDestroyed()
// Save the current context and its surface in case we need to set them back
QOpenGLContext *currentContext = QOpenGLContext::currentContext();
- QSurface *currentSurface = 0;
+ QSurface *currentSurface = nullptr;
QScopedPointer<QOffscreenSurface> offscreenSurface;
@@ -1275,7 +1275,7 @@ void QOpenGLDebugLoggerPrivate::_q_contextAboutToBeDestroyed()
}
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- context = 0;
+ context = nullptr;
initialized = false;
}
@@ -1356,7 +1356,7 @@ bool QOpenGLDebugLogger::initialize()
disconnect(d->context, SIGNAL(aboutToBeDestroyed()), this, SLOT(_q_contextAboutToBeDestroyed()));
d->initialized = false;
- d->context = 0;
+ d->context = nullptr;
if (!context->hasExtension(QByteArrayLiteral("GL_KHR_debug")))
return false;
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 1e5a10c99c..a569975486 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -72,7 +72,7 @@ public:
void invalidateResource() override
{
delete m_shaders;
- m_shaders = 0;
+ m_shaders = nullptr;
}
void freeResource(QOpenGLContext *) override
@@ -94,7 +94,7 @@ public:
shaders = new QOpenGLMultiGroupSharedResource;
QOpenGLEngineSharedShadersResource *resource =
shaders->value<QOpenGLEngineSharedShadersResource>(context);
- return resource ? resource->shaders() : 0;
+ return resource ? resource->shaders() : nullptr;
}
private:
@@ -116,8 +116,8 @@ const char* QOpenGLEngineSharedShaders::qShaderSnippets[] = {
};
QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
- : blitShaderProg(0)
- , simpleShaderProg(0)
+ : blitShaderProg(nullptr)
+ , simpleShaderProg(nullptr)
{
/*
@@ -341,12 +341,12 @@ QOpenGLEngineSharedShaders::~QOpenGLEngineSharedShaders()
if (blitShaderProg) {
delete blitShaderProg;
- blitShaderProg = 0;
+ blitShaderProg = nullptr;
}
if (simpleShaderProg) {
delete simpleShaderProg;
- simpleShaderProg = 0;
+ simpleShaderProg = nullptr;
}
}
@@ -507,8 +507,8 @@ QOpenGLEngineShaderManager::QOpenGLEngineShaderManager(QOpenGLContext* context)
opacityMode(NoOpacity),
maskType(NoMask),
compositionMode(QPainter::CompositionMode_SourceOver),
- customSrcStage(0),
- currentShaderProg(0)
+ customSrcStage(nullptr),
+ currentShaderProg(nullptr)
{
sharedShaders = QOpenGLEngineSharedShaders::shadersForContext(context);
}
@@ -627,7 +627,7 @@ void QOpenGLEngineShaderManager::removeCustomStage()
{
if (customSrcStage)
customSrcStage->setInactive();
- customSrcStage = 0;
+ customSrcStage = nullptr;
shaderProgNeedsChanging = true;
}
@@ -684,7 +684,7 @@ bool QOpenGLEngineShaderManager::useCorrectShaderProg()
if (!shaderProgNeedsChanging)
return false;
- bool useCustomSrc = customSrcStage != 0;
+ bool useCustomSrc = customSrcStage != nullptr;
if (useCustomSrc && srcPixelType != QOpenGLEngineShaderManager::ImageSrc && srcPixelType != Qt::TexturePattern) {
useCustomSrc = false;
qWarning("QOpenGLEngineShaderManager - Ignoring custom shader stage for non image src");
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index bb0dbdc9bd..d7a6d32218 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -551,7 +551,7 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
pixelType = GL_UNSIGNED_SHORT;
funcs.glTexImage2D(target, 0, color.internalFormat, color.size.width(), color.size.height(), 0,
- GL_RGBA, pixelType, NULL);
+ GL_RGBA, pixelType, nullptr);
if (format.mipmap()) {
int width = color.size.width();
int height = color.size.height();
@@ -561,7 +561,7 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
height = qMax(1, height >> 1);
++level;
funcs.glTexImage2D(target, level, color.internalFormat, width, height, 0,
- GL_RGBA, pixelType, NULL);
+ GL_RGBA, pixelType, nullptr);
}
}
funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + idx,
@@ -640,8 +640,8 @@ void QOpenGLFramebufferObjectPrivate::initDepthStencilAttachments(QOpenGLContext
stencil_buffer_guard->free();
}
- depth_buffer_guard = 0;
- stencil_buffer_guard = 0;
+ depth_buffer_guard = nullptr;
+ stencil_buffer_guard = nullptr;
GLuint depth_buffer = 0;
GLuint stencil_buffer = 0;
@@ -1284,7 +1284,7 @@ GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex)
id = guard ? guard->id() : 0;
// Do not call free() on texture_guard, just null it out.
// This way the texture will not be deleted when the guard is destroyed.
- guard = 0;
+ guard = nullptr;
}
return id;
}
@@ -1564,7 +1564,7 @@ bool QOpenGLFramebufferObject::bindDefault()
qWarning("QOpenGLFramebufferObject::bindDefault() called without current context.");
#endif
- return ctx != 0;
+ return ctx != nullptr;
}
/*!
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index bc3a4f7c1d..11ca802ee6 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -182,7 +182,7 @@ struct QOpenGLFunctionsPrivateEx : public QOpenGLExtensionsPrivate, public QOpen
Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource)
-static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = 0)
+static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = nullptr)
{
if (!context)
context = QOpenGLContext::currentContext();
@@ -200,7 +200,7 @@ static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = 0)
\sa initializeOpenGLFunctions()
*/
QOpenGLFunctions::QOpenGLFunctions()
- : d_ptr(0)
+ : d_ptr(nullptr)
{
}
@@ -218,7 +218,7 @@ QOpenGLFunctions::QOpenGLFunctions()
\sa initializeOpenGLFunctions()
*/
QOpenGLFunctions::QOpenGLFunctions(QOpenGLContext *context)
- : d_ptr(0)
+ : d_ptr(nullptr)
{
if (context && QOpenGLContextGroup::currentContextGroup() == context->shareGroup())
d_ptr = qt_gl_functions(context);
@@ -493,7 +493,7 @@ QOpenGLFunctions::OpenGLFeatures QOpenGLFunctions::openGLFeatures() const
{
QOpenGLFunctionsPrivateEx *d = static_cast<QOpenGLFunctionsPrivateEx *>(d_ptr);
if (!d)
- return 0;
+ return { };
if (d->m_features == -1)
d->m_features = qt_gl_resolve_features();
return QOpenGLFunctions::OpenGLFeatures(d->m_features);
@@ -531,7 +531,7 @@ QOpenGLExtensions::OpenGLExtensions QOpenGLExtensions::openGLExtensions()
{
QOpenGLFunctionsPrivateEx *d = static_cast<QOpenGLFunctionsPrivateEx *>(d_ptr);
if (!d)
- return 0;
+ return { };
if (d->m_extensions == -1)
d->m_extensions = qt_gl_resolve_extensions();
return QOpenGLExtensions::OpenGLExtensions(d->m_extensions);
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp
index f017c68fd9..f9d93ce210 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_0.cpp
@@ -67,8 +67,8 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_0::QOpenGLFunctions_1_0()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_0_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
{
}
@@ -98,7 +98,7 @@ bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp
index a819d499f8..b0f7538d48 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_1.cpp
@@ -67,10 +67,10 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
{
}
@@ -108,7 +108,7 @@ bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp
index 61db2b4e0f..5f137b0237 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_2.cpp
@@ -67,12 +67,12 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_2::QOpenGLFunctions_1_2()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
{
}
@@ -118,7 +118,7 @@ bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp
index acc223ea74..0b5ff2fee5 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_3.cpp
@@ -67,14 +67,14 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_3::QOpenGLFunctions_1_3()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
{
}
@@ -128,7 +128,7 @@ bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp
index 8e2349dc08..9419c1aa85 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_4.cpp
@@ -67,16 +67,16 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
{
}
@@ -138,7 +138,7 @@ bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp
index cd81cf8b35..3fa7668a36 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_5.cpp
@@ -67,17 +67,17 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_1_5::QOpenGLFunctions_1_5()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
{
}
@@ -143,7 +143,7 @@ bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
index 97a8c72fa6..29eb055a1d 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_0.cpp
@@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
{
}
@@ -149,7 +149,7 @@ bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
index 00bdc1bbba..8a7170dd7d 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_1.cpp
@@ -67,19 +67,19 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
{
}
@@ -154,7 +154,7 @@ bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
index 2c239dba1f..7d0e900659 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_0.cpp
@@ -67,20 +67,20 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
, m_reserved_3_0_Deprecated(nullptr)
{
@@ -160,7 +160,7 @@ bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp
index f62f555c8e..c25b124af8 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_1.cpp
@@ -67,16 +67,16 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_1::QOpenGLFunctions_3_1()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
{
}
@@ -138,7 +138,7 @@ bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
index ba7be2d893..3e4fd96dc2 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
@@ -67,22 +67,22 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
, m_reserved_3_0_Deprecated(nullptr)
{
@@ -170,7 +170,7 @@ bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
index 4c1e3eb3da..ea89fc9e48 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
@@ -67,17 +67,17 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
{
}
@@ -143,7 +143,7 @@ bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
index c750c6e0cc..a26d7d99b1 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
@@ -67,25 +67,25 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(0)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -179,7 +179,7 @@ bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
index 5723509e32..277ad1eb14 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
@@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
{
}
@@ -148,7 +148,7 @@ bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
index 6ae7643eb5..655f1e6fd4 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
@@ -67,26 +67,26 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(0)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -184,7 +184,7 @@ bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
index cd4fdb8b2b..60453d147c 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
@@ -67,19 +67,19 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
{
}
@@ -153,7 +153,7 @@ bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
index d104c74bc2..bdea8b5ba9 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
@@ -67,27 +67,27 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(0)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -189,7 +189,7 @@ bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
index 7527aba620..b21742d9c1 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
@@ -67,20 +67,20 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
{
}
@@ -158,7 +158,7 @@ bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
index a5b1b37495..41ab9ae762 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
@@ -67,28 +67,28 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(0)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -194,7 +194,7 @@ bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
index 1381236926..38dbe1b596 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
@@ -67,21 +67,21 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
{
}
@@ -163,7 +163,7 @@ bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
index 5c0c711d1c..1b23d08ee2 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
@@ -67,29 +67,29 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
, m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(0)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -199,7 +199,7 @@ bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
index 34460b841e..8a867471b8 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
@@ -67,22 +67,22 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
{
}
@@ -168,7 +168,7 @@ bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
index 907994a3c4..4fc4b50100 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
@@ -67,29 +67,29 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
- , d_4_4_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
- , d_3_3_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
+ , d_4_4_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
+ , d_3_3_Deprecated(nullptr)
{
}
@@ -203,7 +203,7 @@ bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
index 76c0323f6d..6169c7f455 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
@@ -67,23 +67,23 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
- , d_4_4_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
+ , d_4_4_Core(nullptr)
{
}
@@ -173,7 +173,7 @@ bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
index c415bb06ff..02af443498 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
@@ -67,31 +67,31 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
- , d_4_4_Core(0)
- , d_4_5_Core(0)
- , d_1_0_Deprecated(0)
- , d_1_1_Deprecated(0)
- , d_1_2_Deprecated(0)
- , d_1_3_Deprecated(0)
- , d_1_4_Deprecated(0)
- , d_3_3_Deprecated(0)
- , d_4_5_Deprecated(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
+ , d_4_4_Core(nullptr)
+ , d_4_5_Core(nullptr)
+ , d_1_0_Deprecated(nullptr)
+ , d_1_1_Deprecated(nullptr)
+ , d_1_2_Deprecated(nullptr)
+ , d_1_3_Deprecated(nullptr)
+ , d_1_4_Deprecated(nullptr)
+ , d_3_3_Deprecated(nullptr)
+ , d_4_5_Deprecated(nullptr)
{
}
@@ -213,7 +213,7 @@ bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
index 4dfac3579c..9c0369e5f2 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
@@ -67,24 +67,24 @@ QT_BEGIN_NAMESPACE
QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core()
: QAbstractOpenGLFunctions()
- , d_1_0_Core(0)
- , d_1_1_Core(0)
- , d_1_2_Core(0)
- , d_1_3_Core(0)
- , d_1_4_Core(0)
- , d_1_5_Core(0)
- , d_2_0_Core(0)
- , d_2_1_Core(0)
- , d_3_0_Core(0)
- , d_3_1_Core(0)
- , d_3_2_Core(0)
- , d_3_3_Core(0)
- , d_4_0_Core(0)
- , d_4_1_Core(0)
- , d_4_2_Core(0)
- , d_4_3_Core(0)
- , d_4_4_Core(0)
- , d_4_5_Core(0)
+ , d_1_0_Core(nullptr)
+ , d_1_1_Core(nullptr)
+ , d_1_2_Core(nullptr)
+ , d_1_3_Core(nullptr)
+ , d_1_4_Core(nullptr)
+ , d_1_5_Core(nullptr)
+ , d_2_0_Core(nullptr)
+ , d_2_1_Core(nullptr)
+ , d_3_0_Core(nullptr)
+ , d_3_1_Core(nullptr)
+ , d_3_2_Core(nullptr)
+ , d_3_3_Core(nullptr)
+ , d_4_0_Core(nullptr)
+ , d_4_1_Core(nullptr)
+ , d_4_2_Core(nullptr)
+ , d_4_3_Core(nullptr)
+ , d_4_4_Core(nullptr)
+ , d_4_5_Core(nullptr)
{
}
@@ -178,7 +178,7 @@ bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
{
// Associate with private implementation, creating if necessary
// Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = 0;
+ QOpenGLVersionFunctionsBackend* d = nullptr;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 3a0c02feb0..3920a10467 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -171,7 +171,7 @@ QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz)
, dpmy(qt_defaultDpiY() * 100. / 2.54)
, devicePixelRatio(1.0)
, flipped(false)
- , engine(0)
+ , engine(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 47394999c6..a82edbb073 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -881,7 +881,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
Q_ASSERT(cache->ibo == 0);
#else
free(cache->vertices);
- Q_ASSERT(cache->indices == 0);
+ Q_ASSERT(cache->indices == nullptr);
#endif
updateCache = true;
}
@@ -909,7 +909,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
#else
cache->vertices = (float *) malloc(floatSizeInBytes);
memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
- cache->indices = 0;
+ cache->indices = nullptr;
#endif
}
@@ -1359,7 +1359,7 @@ void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return;
QOpenGL2PaintEngineState *s = state();
- if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), 0)) {
+ if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), nullptr)) {
// QTriangulatingStroker class is not meant to support cosmetically sheared strokes.
QPaintEngineEx::stroke(path, pen);
return;
@@ -1427,7 +1427,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);
fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2,
- 0, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode);
+ nullptr, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode);
funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
@@ -1575,7 +1575,7 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c
case QImage::Format_ARGB32:
case QImage::Format_RGBA64:
d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::NonPremultipliedImageSrc);
- bindOption = 0;
+ bindOption = { };
break;
case QImage::Format_Alpha8:
if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) {
@@ -1772,7 +1772,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
QOpenGLTextureGlyphCache *cache =
(QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform);
- if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == 0) {
+ if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == nullptr) {
cache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform);
fe->setGlyphCache(cacheKey, cache);
recreateVertexArrays = true;
@@ -1780,7 +1780,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
if (staticTextItem->userDataNeedsUpdate) {
recreateVertexArrays = true;
- } else if (staticTextItem->userData() == 0) {
+ } else if (staticTextItem->userData() == nullptr) {
recreateVertexArrays = true;
} else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
recreateVertexArrays = true;
@@ -1845,9 +1845,9 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
QOpenGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray;
if (staticTextItem->useBackendOptimizations) {
- QOpenGLStaticTextUserData *userData = 0;
+ QOpenGLStaticTextUserData *userData = nullptr;
- if (staticTextItem->userData() == 0
+ if (staticTextItem->userData() == nullptr
|| staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
userData = new QOpenGLStaticTextUserData();
@@ -2273,12 +2273,12 @@ bool QOpenGL2PaintEngineEx::end()
d->funcs.glUseProgram(0);
d->transferMode(BrushDrawingMode);
- ctx->d_func()->active_engine = 0;
+ ctx->d_func()->active_engine = nullptr;
d->resetGLState();
delete d->shaderManager;
- d->shaderManager = 0;
+ d->shaderManager = nullptr;
d->currentBrush = QBrush();
#ifdef QT_OPENGL_CACHE_AS_VBOS
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 4986ca573d..7e89d9c8d4 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -249,7 +249,7 @@ class QOpenGLShaderPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QOpenGLShader)
public:
QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type)
- : shaderGuard(0)
+ : shaderGuard(nullptr)
, shaderType(type)
, compiled(false)
, glfuncs(new QOpenGLExtraFunctions(ctx))
@@ -374,8 +374,8 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
// Get info and source code lengths
GLint infoLogLength = 0;
GLint sourceCodeLength = 0;
- char *logBuffer = 0;
- char *sourceCodeBuffer = 0;
+ char *logBuffer = nullptr;
+ char *sourceCodeBuffer = nullptr;
// Get the compilation info log
glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
@@ -425,7 +425,7 @@ void QOpenGLShaderPrivate::deleteShader()
{
if (shaderGuard) {
shaderGuard->free();
- shaderGuard = 0;
+ shaderGuard = nullptr;
}
}
@@ -783,13 +783,13 @@ class QOpenGLShaderProgramPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QOpenGLShaderProgram)
public:
QOpenGLShaderProgramPrivate()
- : programGuard(0)
+ : programGuard(nullptr)
, linked(false)
, inited(false)
, removingShaders(false)
, glfuncs(new QOpenGLExtraFunctions)
#ifndef QT_OPENGL_ES_2
- , tessellationFuncs(0)
+ , tessellationFuncs(nullptr)
#endif
, linkBinaryRecursion(false)
{
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 61a6202017..cf4a8dee8d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
QOpenGLTexture *qq)
: q_ptr(qq),
- context(0),
+ context(nullptr),
target(textureTarget),
textureId(0),
format(QOpenGLTexture::NoFormat),
@@ -82,8 +82,8 @@ QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarge
textureView(false),
autoGenerateMipMaps(true),
storageAllocated(false),
- texFuncs(0),
- functions(0)
+ texFuncs(nullptr),
+ functions(nullptr)
{
dimensions[0] = dimensions[1] = dimensions[2] = 1;
@@ -208,8 +208,8 @@ void QOpenGLTexturePrivate::destroy()
functions->glDeleteTextures(1, &textureId);
- context = 0;
- functions = 0;
+ context = nullptr;
+ functions = nullptr;
textureId = 0;
format = QOpenGLTexture::NoFormat;
formatClass = QOpenGLTexture::NoFormatClass;
@@ -231,7 +231,7 @@ void QOpenGLTexturePrivate::destroy()
textureView = false;
autoGenerateMipMaps = true;
storageAllocated = false;
- texFuncs = 0;
+ texFuncs = nullptr;
swizzleMask[0] = QOpenGLTexture::RedValue;
swizzleMask[1] = QOpenGLTexture::GreenValue;
@@ -1141,7 +1141,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format,
mipLevelSize(level, dimensions[0]),
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
} else {
qWarning("1D textures are not supported");
return;
@@ -1156,7 +1156,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[0]),
layers,
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
} else {
qWarning("1D array textures are not supported");
return;
@@ -1170,7 +1170,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[0]),
mipLevelSize(level, dimensions[1]),
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
break;
case QOpenGLTexture::TargetCubeMap: {
@@ -1190,7 +1190,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[0]),
mipLevelSize(level, dimensions[1]),
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
}
}
break;
@@ -1204,7 +1204,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[1]),
layers,
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
} else {
qWarning("Array textures are not supported");
return;
@@ -1220,7 +1220,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[1]),
6 * layers,
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
} else {
qWarning("Cubemap Array textures are not supported");
return;
@@ -1235,7 +1235,7 @@ void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat p
mipLevelSize(level, dimensions[1]),
mipLevelSize(level, dimensions[2]),
0,
- pixelFormat, pixelType, 0);
+ pixelFormat, pixelType, nullptr);
} else {
qWarning("3D textures are not supported");
return;
@@ -1924,7 +1924,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
if (!viewTargetCompatible) {
qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view targets");
- return 0;
+ return nullptr;
}
// Check the formats are compatible
@@ -2057,7 +2057,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
if (!viewFormatCompatible) {
qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view formats");
- return 0;
+ return nullptr;
}
@@ -3387,7 +3387,7 @@ QOpenGLTexture *QOpenGLTexture::createTextureView(Target target,
Q_D(const QOpenGLTexture);
if (!isStorageAllocated()) {
qWarning("Cannot set create a texture view of a texture that does not have storage allocated.");
- return 0;
+ return nullptr;
}
Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel);
Q_ASSERT(maximumLayer >= minimumLayer);
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 490dc99749..41027d26e0 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -55,9 +55,9 @@ static int next_qopengltextureglyphcache_serial_number()
QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color)
: QImageTextureGlyphCache(format, matrix, color)
- , m_textureResource(0)
- , pex(0)
- , m_blitProgram(0)
+ , m_textureResource(nullptr)
+ , pex(nullptr)
+ , m_blitProgram(nullptr)
, m_filterMode(Nearest)
, m_serialNumber(next_qopengltextureglyphcache_serial_number())
, m_buffer(QOpenGLBuffer::VertexBuffer)
@@ -102,7 +102,7 @@ static inline bool isCoreProfile()
void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
{
QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == 0) {
+ if (ctx == nullptr) {
qWarning("QOpenGLTextureGlyphCache::createTextureData: Called with no context");
return;
}
@@ -121,7 +121,7 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
if (m_textureResource && !m_textureResource->m_texture) {
delete m_textureResource;
- m_textureResource = 0;
+ m_textureResource = nullptr;
}
if (!m_textureResource)
@@ -276,7 +276,7 @@ static void load_glyph_image_region_to_texture(QOpenGLContext *ctx,
void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx == 0) {
+ if (ctx == nullptr) {
qWarning("QOpenGLTextureGlyphCache::resizeTextureData: Called with no context");
return;
}
@@ -313,7 +313,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
funcs->glGenTextures(1, &tmp_texture);
funcs->glBindTexture(GL_TEXTURE_2D, tmp_texture);
funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -326,7 +326,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
funcs->glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
funcs->glBindTexture(GL_TEXTURE_2D, oldTexture);
- if (pex != 0)
+ if (pex != nullptr)
pex->transferMode(BrushDrawingMode);
funcs->glDisable(GL_STENCIL_TEST);
@@ -336,9 +336,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
funcs->glViewport(0, 0, oldWidth, oldHeight);
- QOpenGLShaderProgram *blitProgram = 0;
- if (pex == 0) {
- if (m_blitProgram == 0) {
+ QOpenGLShaderProgram *blitProgram = nullptr;
+ if (pex == nullptr) {
+ if (m_blitProgram == nullptr) {
m_blitProgram = new QOpenGLShaderProgram;
const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile;
@@ -408,7 +408,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
- if (pex != 0) {
+ if (pex != nullptr) {
funcs->glViewport(0, 0, pex->width, pex->height);
pex->updateClipScissorTest();
} else {
@@ -424,7 +424,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx == 0) {
+ if (ctx == nullptr) {
qWarning("QOpenGLTextureGlyphCache::fillTexture: Called with no context");
return;
}
@@ -447,7 +447,7 @@ int QOpenGLTextureGlyphCache::glyphPadding() const
int QOpenGLTextureGlyphCache::maxTextureWidth() const
{
QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == 0)
+ if (ctx == nullptr)
return QImageTextureGlyphCache::maxTextureWidth();
else
return ctx->d_func()->maxTextureSize();
@@ -456,7 +456,7 @@ int QOpenGLTextureGlyphCache::maxTextureWidth() const
int QOpenGLTextureGlyphCache::maxTextureHeight() const
{
QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == 0)
+ if (ctx == nullptr)
return QImageTextureGlyphCache::maxTextureHeight();
if (ctx->d_func()->workaround_brokenTexSubImage)
@@ -469,10 +469,10 @@ void QOpenGLTextureGlyphCache::clear()
{
if (m_textureResource)
m_textureResource->free();
- m_textureResource = 0;
+ m_textureResource = nullptr;
delete m_blitProgram;
- m_blitProgram = 0;
+ m_blitProgram = nullptr;
m_w = 0;
m_h = 0;
diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp
index afd2e7887a..a4e10b42f7 100644
--- a/src/gui/opengl/qopengltimerquery.cpp
+++ b/src/gui/opengl/qopengltimerquery.cpp
@@ -77,8 +77,8 @@ class QOpenGLTimerQueryPrivate : public QObjectPrivate
public:
QOpenGLTimerQueryPrivate()
: QObjectPrivate(),
- context(0),
- ext(0),
+ context(nullptr),
+ ext(nullptr),
timeInterval(0),
timer(0)
{
@@ -168,7 +168,7 @@ void QOpenGLTimerQueryPrivate::destroy()
core->glDeleteQueries(1, &timer);
timer = 0;
- context = 0;
+ context = nullptr;
}
// GL_TIME_ELAPSED_EXT is not defined on OS X 10.6
@@ -310,14 +310,14 @@ QOpenGLTimerQuery::~QOpenGLTimerQuery()
QOpenGLContext* ctx = QOpenGLContext::currentContext();
Q_D(QOpenGLTimerQuery);
- QOpenGLContext *oldContext = 0;
+ QOpenGLContext *oldContext = nullptr;
if (d->context != ctx) {
oldContext = ctx;
if (d->context->makeCurrent(oldContext->surface())) {
ctx = d->context;
} else {
qWarning("QOpenGLTimerQuery::~QOpenGLTimerQuery() failed to make query objects's context current");
- ctx = 0;
+ ctx = nullptr;
}
}
@@ -468,9 +468,9 @@ public:
: QObjectPrivate(),
timers(),
timeSamples(),
- context(0),
- core(0),
- ext(0),
+ context(nullptr),
+ core(nullptr),
+ ext(nullptr),
requestedSampleCount(2),
currentSample(-1),
timerQueryActive(false)
@@ -556,10 +556,10 @@ void QOpenGLTimeMonitorPrivate::destroy()
core->glDeleteQueries(timers.size(), timers.data());
timers.clear();
delete core;
- core = 0;
+ core = nullptr;
delete ext;
- ext = 0;
- context = 0;
+ ext = nullptr;
+ context = nullptr;
}
void QOpenGLTimeMonitorPrivate::recordSample()
@@ -701,14 +701,14 @@ QOpenGLTimeMonitor::~QOpenGLTimeMonitor()
QOpenGLContext* ctx = QOpenGLContext::currentContext();
Q_D(QOpenGLTimeMonitor);
- QOpenGLContext *oldContext = 0;
+ QOpenGLContext *oldContext = nullptr;
if (d->context != ctx) {
oldContext = ctx;
if (d->context->makeCurrent(oldContext->surface())) {
ctx = d->context;
} else {
qWarning("QOpenGLTimeMonitor::~QOpenGLTimeMonitor() failed to make time monitor's context current");
- ctx = 0;
+ ctx = nullptr;
}
}
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index a3d3bb6bd1..5a108335a9 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -68,7 +68,7 @@ void CLASS::init() \
}
QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage()
- : backends(0)
+ : backends(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglversionfunctionsfactory.cpp b/src/gui/opengl/qopenglversionfunctionsfactory.cpp
index fff5eea29c..ca7daedf34 100644
--- a/src/gui/opengl/qopenglversionfunctionsfactory.cpp
+++ b/src/gui/opengl/qopenglversionfunctionsfactory.cpp
@@ -153,7 +153,7 @@ QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::create(const QOpenGLVe
else if (major == 1 && minor == 0)
return new QOpenGLFunctions_1_0;
}
- return 0;
+ return nullptr;
#else
Q_UNUSED(versionProfile);
return new QOpenGLFunctions_ES2;
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index f0837aff96..f15fe06ee8 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -101,7 +101,7 @@ public:
QOpenGLVertexArrayObjectPrivate()
: vao(0)
, vaoFuncsType(NotSupported)
- , context(0)
+ , context(nullptr)
{
}
@@ -167,7 +167,7 @@ bool QOpenGLVertexArrayObjectPrivate::create()
vaoFuncs.helper->glGenVertexArrays(1, &vao);
}
} else {
- vaoFuncs.core_3_0 = 0;
+ vaoFuncs.core_3_0 = nullptr;
vaoFuncsType = NotSupported;
QSurfaceFormat format = ctx->format();
#ifndef QT_OPENGL_ES_2
@@ -200,17 +200,17 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
Q_Q(QOpenGLVertexArrayObject);
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLContext *oldContext = 0;
- QSurface *oldContextSurface = 0;
+ QOpenGLContext *oldContext = nullptr;
+ QSurface *oldContextSurface = nullptr;
QScopedPointer<QOffscreenSurface> offscreenSurface;
if (context && context != ctx) {
oldContext = ctx;
- oldContextSurface = ctx ? ctx->surface() : 0;
+ oldContextSurface = ctx ? ctx->surface() : nullptr;
// Before going through the effort of creating an offscreen surface
// check that we are on the GUI thread because otherwise many platforms
// will not able to create that offscreen surface.
if (QThread::currentThread() != qGuiApp->thread()) {
- ctx = 0;
+ ctx = nullptr;
} else {
// Cannot just make the current surface current again with another context.
// The format may be incompatible and some platforms (iOS) may impose
@@ -223,14 +223,14 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
ctx = context;
} else {
qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current");
- ctx = 0;
+ ctx = nullptr;
}
}
}
if (context) {
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- context = 0;
+ context = nullptr;
}
if (vao && ctx) {
diff --git a/src/gui/painting/WEBGRADIENTS_LICENSE.txt b/src/gui/painting/WEBGRADIENTS_LICENSE.txt
deleted file mode 100644
index 1a4d527a4d..0000000000
--- a/src/gui/painting/WEBGRADIENTS_LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 itmeo
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index fcf6488edd..1a0f4f11e4 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -111,13 +111,8 @@ SOURCES += \
painting/qplatformbackingstore.cpp \
painting/qpathsimplifier.cpp
-webgradients.files = painting/webgradients.binaryjson
-webgradients.prefix = qgradient
-webgradients.base = painting
-
RESOURCES += \
painting/qpdf.qrc \
- webgradients
darwin {
HEADERS += painting/qcoregraphics_p.h
diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp
index 8e2013c24f..494104251f 100644
--- a/src/gui/painting/qblittable.cpp
+++ b/src/gui/painting/qblittable.cpp
@@ -46,7 +46,7 @@ class QBlittablePrivate
{
public:
QBlittablePrivate(const QSize &size, QBlittable::Capabilities caps)
- : caps(caps), m_size(size), locked(false), cachedImg(0)
+ : caps(caps), m_size(size), locked(false), cachedImg(nullptr)
{}
QBlittable::Capabilities caps;
QSize m_size;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index abb3268dfa..83032bdc4f 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -179,7 +180,7 @@ struct QTexturedBrushData : public QBrushData
{
QTexturedBrushData() {
m_has_pixmap_texture = false;
- m_pixmap = 0;
+ m_pixmap = nullptr;
}
~QTexturedBrushData() {
delete m_pixmap;
@@ -189,7 +190,7 @@ struct QTexturedBrushData : public QBrushData
delete m_pixmap;
if (pm.isNull()) {
- m_pixmap = 0;
+ m_pixmap = nullptr;
m_has_pixmap_texture = false;
} else {
m_pixmap = new QPixmap(pm);
@@ -202,7 +203,7 @@ struct QTexturedBrushData : public QBrushData
void setImage(const QImage &image) {
m_image = image;
delete m_pixmap;
- m_pixmap = 0;
+ m_pixmap = nullptr;
m_has_pixmap_texture = false;
}
@@ -360,7 +361,7 @@ public:
{
if (!brush->ref.deref())
delete brush;
- brush = 0;
+ brush = nullptr;
}
};
@@ -831,7 +832,7 @@ const QGradient *QBrush::gradient() const
|| d->style == Qt::ConicalGradientPattern) {
return &static_cast<const QGradientBrushData *>(d.data())->gradient;
}
- return 0;
+ return nullptr;
}
Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
@@ -968,7 +969,7 @@ bool QBrush::operator==(const QBrush &b) const
// but does not share the same data in memory. Since equality is likely to
// be used to avoid iterating over the data for a texture update, this should
// still be better than doing an accurate comparison.
- const QPixmap *us = 0, *them = 0;
+ const QPixmap *us = nullptr, *them = nullptr;
qint64 cacheKey1, cacheKey2;
if (qHasPixmapTexture(*this)) {
us = (static_cast<QTexturedBrushData *>(d.data()))->m_pixmap;
@@ -1335,7 +1336,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\internal
*/
QGradient::QGradient()
- : m_type(NoGradient), dummy(0)
+ : m_type(NoGradient), dummy(nullptr)
{
}
@@ -1347,6 +1348,8 @@ QGradient::QGradient()
based on the gradients from https://webgradients.com/.
*/
+#include "webgradients.cpp"
+
/*!
\fn QGradient::QGradient(QGradient::Preset preset)
\since 5.12
@@ -1358,47 +1361,12 @@ QGradient::QGradient()
to be applied to arbitrary object sizes.
*/
QGradient::QGradient(Preset preset)
- : QGradient()
-{
- static QHash<int, QGradient> cachedPresets;
- static QMutex cacheMutex;
- QMutexLocker locker(&cacheMutex);
- if (cachedPresets.contains(preset)) {
- const QGradient &cachedPreset = cachedPresets.value(preset);
- m_type = cachedPreset.m_type;
- m_data = cachedPreset.m_data;
- m_stops = cachedPreset.m_stops;
- m_spread = cachedPreset.m_spread;
- dummy = cachedPreset.dummy;
- } else {
- static QJsonDocument jsonPresets = []() {
- QFile webGradients(QLatin1String(":/qgradient/webgradients.binaryjson"));
- webGradients.open(QFile::ReadOnly);
- return QJsonDocument::fromBinaryData(webGradients.readAll());
- }();
-
- const QJsonValue presetData = jsonPresets[preset - 1];
- if (!presetData.isObject())
- return;
-
- m_type = LinearGradient;
- setCoordinateMode(ObjectMode);
- setSpread(PadSpread);
-
- const QJsonValue start = presetData[QLatin1String("start")];
- const QJsonValue end = presetData[QLatin1String("end")];
- m_data.linear.x1 = start[QLatin1String("x")].toDouble();
- m_data.linear.y1 = start[QLatin1String("y")].toDouble();
- m_data.linear.x2 = end[QLatin1String("x")].toDouble();
- m_data.linear.y2 = end[QLatin1String("y")].toDouble();
-
- for (const QJsonValue &stop : presetData[QLatin1String("stops")].toArray()) {
- setColorAt(stop[QLatin1String("position")].toDouble(),
- QColor(QRgb(stop[QLatin1String("color")].toInt())));
- }
-
- cachedPresets.insert(preset, *this);
- }
+ : m_type(LinearGradient)
+ , m_spread(PadSpread)
+ , m_stops(qt_preset_gradient_stops(preset))
+ , m_data(qt_preset_gradient_data[preset - 1])
+ , dummy(qt_preset_gradient_dummy())
+{
}
/*!
@@ -1408,11 +1376,6 @@ QGradient::~QGradient()
{
}
-QT_END_NAMESPACE
-static void initGradientPresets() { Q_INIT_RESOURCE(qmake_webgradients); }
-Q_CONSTRUCTOR_FUNCTION(initGradientPresets);
-QT_BEGIN_NAMESPACE
-
/*!
\enum QGradient::Type
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 6a4ffab1c5..1d7199782f 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -400,16 +400,7 @@ public:
inline bool operator!=(const QGradient &other) const
{ return !operator==(other); }
-private:
- friend class QLinearGradient;
- friend class QRadialGradient;
- friend class QConicalGradient;
- friend class QBrush;
-
- Type m_type;
- Spread m_spread;
- QGradientStops m_stops;
- union {
+ union QGradientData {
struct {
qreal x1, y1, x2, y2;
} linear;
@@ -419,7 +410,18 @@ private:
struct {
qreal cx, cy, angle;
} conical;
- } m_data;
+ };
+
+private:
+ friend class QLinearGradient;
+ friend class QRadialGradient;
+ friend class QConicalGradient;
+ friend class QBrush;
+
+ Type m_type;
+ Spread m_spread;
+ QGradientStops m_stops;
+ QGradientData m_data;
void *dummy; // ### Qt 6: replace with actual content (CoordinateMode, InterpolationMode, ...)
};
diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp
index 9631fdb416..0fb0e9ee33 100644
--- a/src/gui/painting/qcolorspace.cpp
+++ b/src/gui/painting/qcolorspace.cpp
@@ -422,6 +422,10 @@ QColorSpace::QColorSpace()
*/
QColorSpace::QColorSpace(NamedColorSpace namedColorSpace)
{
+ if (namedColorSpace < QColorSpace::SRgb || namedColorSpace > QColorSpace::ProPhotoRgb) {
+ qWarning() << "QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace: " << int(namedColorSpace);
+ return;
+ }
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::ProPhotoRgb + 1];
if (!predefinedColorspacePrivates[namedColorSpace]) {
predefinedColorspacePrivates[namedColorSpace] = new QColorSpacePrivate(namedColorSpace);
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index fa34c5598e..9012119516 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -225,7 +225,7 @@ static StrokeLine strokeLine(int strokeSelection)
break;
default:
Q_ASSERT(false);
- stroke = 0;
+ stroke = nullptr;
}
return stroke;
}
@@ -252,8 +252,8 @@ void QCosmeticStroker::setup()
const QVector<qreal> &penPattern = state->lastPen.dashPattern();
if (penPattern.isEmpty()) {
Q_ASSERT(!pattern && !reversePattern);
- pattern = 0;
- reversePattern = 0;
+ pattern = nullptr;
+ reversePattern = nullptr;
patternLength = 0;
patternSize = 0;
} else {
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index f8d5914f37..2d4045fe29 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -310,7 +310,7 @@ inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index,
typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index);
static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = {
- 0, // BPPNone
+ nullptr, // BPPNone
fetchPixel<QPixelLayout::BPP1MSB>, // BPP1MSB
fetchPixel<QPixelLayout::BPP1LSB>, // BPP1LSB
fetchPixel<QPixelLayout::BPP8>, // BPP8
@@ -1713,10 +1713,10 @@ static uint *QT_FASTCALL destFetchUndefined(uint *buffer, QRasterBuffer *, int,
static DestFetchProc destFetchProc[QImage::NImageFormats] =
{
- 0, // Format_Invalid
+ nullptr, // Format_Invalid
destFetchMono, // Format_Mono,
destFetchMonoLsb, // Format_MonoLSB
- 0, // Format_Indexed8
+ nullptr, // Format_Indexed8
destFetchARGB32P, // Format_RGB32
destFetch, // Format_ARGB32,
destFetchARGB32P, // Format_ARGB32_Premultiplied
@@ -1764,10 +1764,10 @@ static QRgba64 * QT_FASTCALL destFetch64Undefined(QRgba64 *buffer, QRasterBuffer
static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
{
- 0, // Format_Invalid
- 0, // Format_Mono,
- 0, // Format_MonoLSB
- 0, // Format_Indexed8
+ nullptr, // Format_Invalid
+ nullptr, // Format_Mono,
+ nullptr, // Format_MonoLSB
+ nullptr, // Format_Indexed8
destFetch64, // Format_RGB32
destFetch64, // Format_ARGB32,
destFetch64, // Format_ARGB32_Premultiplied
@@ -1905,13 +1905,13 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con
static DestStoreProc destStoreProc[QImage::NImageFormats] =
{
- 0, // Format_Invalid
+ nullptr, // Format_Invalid
destStoreMono, // Format_Mono,
destStoreMonoLsb, // Format_MonoLSB
- 0, // Format_Indexed8
- 0, // Format_RGB32
+ nullptr, // Format_Indexed8
+ nullptr, // Format_RGB32
destStore, // Format_ARGB32,
- 0, // Format_ARGB32_Premultiplied
+ nullptr, // Format_ARGB32_Premultiplied
destStoreRGB16, // Format_RGB16
destStore, // Format_ARGB8565_Premultiplied
destStore, // Format_RGB666
@@ -1955,10 +1955,10 @@ static void QT_FASTCALL destStore64RGBA64(QRasterBuffer *rasterBuffer, int x, in
static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
{
- 0, // Format_Invalid
- 0, // Format_Mono,
- 0, // Format_MonoLSB
- 0, // Format_Indexed8
+ nullptr, // Format_Invalid
+ nullptr, // Format_Mono,
+ nullptr, // Format_MonoLSB
+ nullptr, // Format_Indexed8
destStore64, // Format_RGB32
destStore64, // Format_ARGB32,
destStore64, // Format_ARGB32_Premultiplied
@@ -1980,9 +1980,9 @@ static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
destStore64, // Format_A2RGB30_Premultiplied
destStore64, // Format_Alpha8
destStore64, // Format_Grayscale8
- 0, // Format_RGBX64
+ nullptr, // Format_RGBX64
destStore64RGBA64, // Format_RGBA64
- 0, // Format_RGBA64_Premultiplied
+ nullptr, // Format_RGBA64_Premultiplied
destStore64, // Format_Grayscale16
destStore64, // Format_BGR888
};
@@ -3627,9 +3627,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
#endif
fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
if (disty)
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
int distx = (fx & 0x0000ffff);
@@ -3662,8 +3662,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
+ layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
int distx = (fx & 0x0000ffff);
@@ -3727,8 +3727,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
fw += fdw;
}
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
+ layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
@@ -3907,7 +3907,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
// FetchUntransformed can have more specialized methods added depending on SIMD features.
static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
- 0, // Invalid
+ nullptr, // Invalid
fetchUntransformed, // Mono
fetchUntransformed, // MonoLsb
fetchUntransformed, // Indexed8
@@ -4348,9 +4348,9 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
switch(data->type) {
case QSpanData::Solid:
solidSource = data->solidColor.isOpaque();
- op.srcFetch = 0;
+ op.srcFetch = nullptr;
#if QT_CONFIG(raster_64bit)
- op.srcFetch64 = 0;
+ op.srcFetch64 = nullptr;
#endif
break;
case QSpanData::LinearGradient:
@@ -4721,7 +4721,7 @@ struct QBlendBase
QBlendBase(QSpanData *d, const Operator &o)
: data(d)
, op(o)
- , dest(0)
+ , dest(nullptr)
{
}
@@ -6401,21 +6401,21 @@ static void qt_rectfill_quint64(QRasterBuffer *rasterBuffer,
DrawHelper qDrawHelper[QImage::NImageFormats] =
{
// Format_Invalid,
- { 0, 0, 0, 0, 0 },
+ { nullptr, nullptr, nullptr, nullptr, nullptr },
// Format_Mono,
{
blend_color_generic,
- 0, 0, 0, 0
+ nullptr, nullptr, nullptr, nullptr
},
// Format_MonoLSB,
{
blend_color_generic,
- 0, 0, 0, 0
+ nullptr, nullptr, nullptr, nullptr
},
// Format_Indexed8,
{
blend_color_generic,
- 0, 0, 0, 0
+ nullptr, nullptr, nullptr, nullptr
},
// Format_RGB32,
{
@@ -6452,7 +6452,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_ARGB8565_Premultiplied
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
@@ -6460,7 +6460,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGB666
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
@@ -6468,7 +6468,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_ARGB6666_Premultiplied
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
@@ -6476,7 +6476,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGB555
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint16
@@ -6484,7 +6484,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_ARGB8555_Premultiplied
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
@@ -6492,7 +6492,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGB888
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
@@ -6500,7 +6500,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGB444
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint16
@@ -6508,7 +6508,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_ARGB4444_Premultiplied
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint16
@@ -6572,7 +6572,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_Alpha8
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_alpha
@@ -6580,7 +6580,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_Grayscale8
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_gray
@@ -6588,7 +6588,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGBX64
{
blend_color_generic_rgb64,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint64
@@ -6596,7 +6596,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGBA64
{
blend_color_generic_rgb64,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint64
@@ -6604,7 +6604,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_RGBA64_Premultiplied
{
blend_color_generic_rgb64,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint64
@@ -6612,7 +6612,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_Grayscale16
{
blend_color_generic_rgb64,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint16
@@ -6620,7 +6620,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
// Format_BGR888
{
blend_color_generic,
- 0,
+ nullptr,
qt_alphamapblit_generic,
qt_alphargbblit_generic,
qt_rectfill_quint24
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 0c0df0fb13..7cd700a84a 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -271,7 +271,7 @@ void QEmulationPaintEngine::fillBGRect(const QRectF &r)
{
qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(),
r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() };
- QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
real_engine->fill(vp, state()->bgBrush);
}
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 0d7205b483..2e2f65b483 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -223,7 +223,7 @@ static QImageScaleInfo* QImageScale::qimageFreeScaleInfo(QImageScaleInfo *isi)
delete[] isi->yapoints;
delete isi;
}
- return 0;
+ return nullptr;
}
static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img,
@@ -238,7 +238,7 @@ static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img,
isi = new QImageScaleInfo;
if (!isi)
- return 0;
+ return nullptr;
isi->xup_yup = (qAbs(dw) >= sw) + ((qAbs(dh) >= sh) << 1);
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 9cb787fb2c..685fbbb37a 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -406,9 +406,9 @@ void qt_memrotate270_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *d
MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] =
// 90, 180, 270
{
- { 0, 0, 0 }, // BPPNone,
- { 0, 0, 0 }, // BPP1MSB,
- { 0, 0, 0 }, // BPP1LSB,
+ { nullptr, nullptr, nullptr }, // BPPNone,
+ { nullptr, nullptr, nullptr }, // BPP1MSB,
+ { nullptr, nullptr, nullptr }, // BPP1LSB,
{ qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // BPP8,
{ qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 }, // BPP16,
{ qt_memrotate90_24, qt_memrotate180_24, qt_memrotate270_24 }, // BPP24
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 2074f98069..67e450986d 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -209,7 +209,7 @@ void QOutlineMapper::endOutline()
elements[i] = m_transform.map(elements[i]);
} else {
const QVectorPath vp((qreal *)elements, m_elements.size(),
- m_element_types.size() ? m_element_types.data() : 0);
+ m_element_types.size() ? m_element_types.data() : nullptr);
QPainterPath path = vp.convertToPainterPath();
path = m_transform.map(path);
if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index c98ca8a1fb..d73a66b790 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -394,7 +394,7 @@ static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
}
// Return id name for PPD Key
-static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = 0)
+static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = nullptr)
{
if (ppdKey.isEmpty())
return QPageSize::Custom;
@@ -415,7 +415,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
}
// Return id name for Windows ID
-static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = 0)
+static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = nullptr)
{
// If outside known values then is Custom
if (windowsId <= DMPAPER_NONE || windowsId > DMPAPER_LAST)
@@ -770,7 +770,7 @@ QPageSizePrivate::QPageSizePrivate(const QSize &pointSize, const QString &name,
m_units(QPageSize::Point)
{
if (pointSize.isValid()) {
- QPageSize::PageSizeId id = qt_idForPointSize(pointSize, matchPolicy, 0);
+ QPageSize::PageSizeId id = qt_idForPointSize(pointSize, matchPolicy, nullptr);
id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
}
}
@@ -782,7 +782,7 @@ QPageSizePrivate::QPageSizePrivate(const QSizeF &size, QPageSize::Unit units,
m_units(QPageSize::Point)
{
if (size.isValid()) {
- QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, 0);
+ QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, nullptr);
id == QPageSize::Custom ? init(size, units, name) : init(id, name);
}
}
@@ -793,10 +793,10 @@ QPageSizePrivate::QPageSizePrivate(const QString &key, const QSize &pointSize, c
m_units(QPageSize::Point)
{
if (!key.isEmpty() && pointSize.isValid()) {
- QPageSize::PageSizeId id = qt_idForPpdKey(key, 0);
+ QPageSize::PageSizeId id = qt_idForPpdKey(key, nullptr);
// If not a known PPD key, check if size is a standard PPD size
if (id == QPageSize::Custom)
- id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0);
+ id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, nullptr);
id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
m_key = key;
}
@@ -808,10 +808,10 @@ QPageSizePrivate::QPageSizePrivate(int windowsId, const QSize &pointSize, const
m_units(QPageSize::Point)
{
if (windowsId > 0 && pointSize.isValid()) {
- QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, 0);
+ QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, nullptr);
// If not a known Windows ID, check if size is a standard PPD size
if (id == QPageSize::Custom)
- id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0);
+ id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, nullptr);
id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
m_windowsId = windowsId;
}
@@ -1753,7 +1753,7 @@ QString QPageSize::name(PageSizeId pageSizeId)
QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, SizeMatchPolicy matchPolicy)
{
- return qt_idForPointSize(pointSize, matchPolicy, 0);
+ return qt_idForPointSize(pointSize, matchPolicy, nullptr);
}
/*!
@@ -1769,7 +1769,7 @@ QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, SizeMatchPolicy matc
QPageSize::PageSizeId QPageSize::id(const QSizeF &size, Unit units,
SizeMatchPolicy matchPolicy)
{
- return qt_idForSize(size, units, matchPolicy, 0);
+ return qt_idForSize(size, units, matchPolicy, nullptr);
}
/*!
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 0ddfba6ee9..4afb89b52e 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
QPaintDevice::QPaintDevice() noexcept
{
- reserved = 0;
+ reserved = nullptr;
painters = 0;
}
@@ -67,7 +67,7 @@ void QPaintDevice::initPainter(QPainter *) const
*/
QPaintDevice *QPaintDevice::redirected(QPoint *) const
{
- return 0;
+ return nullptr;
}
/*!
@@ -75,7 +75,7 @@ QPaintDevice *QPaintDevice::redirected(QPoint *) const
*/
QPainter *QPaintDevice::sharedPainter() const
{
- return 0;
+ return nullptr;
}
Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric)
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index bfe1c9cadf..1785fcd12d 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -305,7 +305,7 @@ void QPaintEngine::syncState()
static_cast<QPaintEngineEx *>(this)->sync();
}
-static QPaintEngine *qt_polygon_recursion = 0;
+static QPaintEngine *qt_polygon_recursion = nullptr;
struct QT_Point {
int x;
int y;
@@ -334,7 +334,7 @@ void QPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDra
p[i].y = qRound(points[i].y());
}
drawPolygon((QPoint *)p.data(), pointCount, mode);
- qt_polygon_recursion = 0;
+ qt_polygon_recursion = nullptr;
}
struct QT_PointF {
@@ -363,7 +363,7 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
p[i].y = points[i].y();
}
drawPolygon((QPointF *)p.data(), pointCount, mode);
- qt_polygon_recursion = 0;
+ qt_polygon_recursion = nullptr;
}
/*!
@@ -691,7 +691,7 @@ void QPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF
*/
QPaintEngine::QPaintEngine(PaintEngineFeatures caps)
- : state(0),
+ : state(nullptr),
gccaps(caps),
active(0),
selfDestruct(false),
@@ -706,7 +706,7 @@ QPaintEngine::QPaintEngine(PaintEngineFeatures caps)
*/
QPaintEngine::QPaintEngine(QPaintEnginePrivate &dptr, PaintEngineFeatures caps)
- : state(0),
+ : state(nullptr),
gccaps(caps),
active(0),
selfDestruct(false),
@@ -728,7 +728,7 @@ QPaintEngine::~QPaintEngine()
*/
QPainter *QPaintEngine::painter() const
{
- return state ? state->painter() : 0;
+ return state ? state->painter() : nullptr;
}
/*!
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 40c822076b..bc65ed56e3 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -115,17 +115,17 @@ public:
pts[7] = bottom;
}
inline QRectVectorPath(const QRect &r)
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
{
set(r);
}
inline QRectVectorPath(const QRectF &r)
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
{
set(r);
}
inline QRectVectorPath()
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ : QVectorPath(pts, 4, nullptr, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
{ }
qreal pts[8];
@@ -433,7 +433,7 @@ void QRasterPaintEngine::init()
break;
default:
qWarning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType());
- d->device = 0;
+ d->device = nullptr;
return;
}
@@ -601,7 +601,7 @@ QRasterPaintEngineState::~QRasterPaintEngineState()
QRasterPaintEngineState::QRasterPaintEngineState()
{
- stroker = 0;
+ stroker = nullptr;
fillFlags = 0;
strokeFlags = 0;
@@ -621,7 +621,7 @@ QRasterPaintEngineState::QRasterPaintEngineState()
flags.tx_noshear = true;
flags.fast_images = true;
- clip = 0;
+ clip = nullptr;
flags.has_clip_ownership = false;
dirty = 0;
@@ -643,8 +643,8 @@ QRasterPaintEngineState::QRasterPaintEngineState(QRasterPaintEngineState &s)
, dirty(s.dirty)
, flag_bits(s.flag_bits)
{
- brushData.tempImage = 0;
- penData.tempImage = 0;
+ brushData.tempImage = nullptr;
+ penData.tempImage = nullptr;
flags.has_clip_ownership = false;
}
@@ -759,7 +759,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
d->dashStroker->setDashOffset(pen.dashOffset());
s->stroker = d->dashStroker.data();
} else {
- s->stroker = 0;
+ s->stroker = nullptr;
}
ensureRasterState(); // needed because of tx_noshear...
@@ -1207,7 +1207,7 @@ static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s)
{
if (s->flags.has_clip_ownership)
delete s->clip;
- s->clip = 0;
+ s->clip = nullptr;
s->flags.has_clip_ownership = false;
}
@@ -1279,14 +1279,14 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
// intersect with, in which case we simplify the operation to
// a replace...
Qt::ClipOperation isectOp = Qt::IntersectClip;
- if (base == 0)
+ if (base == nullptr)
isectOp = Qt::ReplaceClip;
QClipData *newClip = new QClipData(d->rasterBuffer->height());
newClip->initialize();
ClipData clipData = { base, newClip, isectOp };
ensureOutlineMapper();
- d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, 0);
+ d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, nullptr);
newClip->fixup();
@@ -1334,7 +1334,7 @@ bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOpera
QRect clipRect = qrect_normalized(r) & d->deviceRect;
QRasterPaintEngineState *s = state();
- if (op == Qt::ReplaceClip || s->clip == 0) {
+ if (op == Qt::ReplaceClip || s->clip == nullptr) {
// No current clip, hence we intersect with sysclip and be
// done with it...
@@ -1970,7 +1970,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly
}
// Compose polygon fill..,
- QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
+ QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
ensureOutlineMapper();
QT_FT_Outline *outline = d->outlineMapper->convertPath(vp);
@@ -2011,7 +2011,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly
// Do the outline...
if (s->penData.blend) {
- QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
+ QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
@@ -2075,7 +2075,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
QVarLengthArray<qreal> fpoints(count);
for (int i=0; i<count; ++i)
fpoints[i] = ((const int *) points)[i];
- QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode));
+ QVectorPath vp((qreal *) fpoints.data(), pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
@@ -2695,14 +2695,14 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
} else if (depth == 8) {
if (s->penData.alphamapBlit) {
s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor,
- scanline, w, h, bpl, 0, useGammaCorrection);
+ scanline, w, h, bpl, nullptr, useGammaCorrection);
return;
}
} else if (depth == 32) {
// (A)RGB Alpha mask where the alpha component is not used.
if (s->penData.alphaRGBBlit) {
s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor,
- (const uint *) scanline, w, h, bpl / 4, 0, useGammaCorrection);
+ (const uint *) scanline, w, h, bpl / 4, nullptr, useGammaCorrection);
return;
}
}
@@ -2917,10 +2917,10 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat;
QImageTextureGlyphCache *cache =
- static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix, QColor(s->penData.solidColor)));
+ static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(nullptr, glyphFormat, s->matrix, QColor(s->penData.solidColor)));
if (!cache) {
cache = new QImageTextureGlyphCache(glyphFormat, s->matrix, QColor(s->penData.solidColor));
- fontEngine->setGlyphCache(0, cache);
+ fontEngine->setGlyphCache(nullptr, cache);
}
cache->populate(fontEngine, numGlyphs, glyphs, positions);
@@ -3672,7 +3672,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
int rasterPoolSize = MINIMUM_POOL_SIZE;
uchar rasterPoolOnStack[MINIMUM_POOL_SIZE + 0xf];
uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf);
- uchar *rasterPoolOnHeap = 0;
+ uchar *rasterPoolOnHeap = nullptr;
qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
@@ -3684,13 +3684,13 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
deviceRect.y() + deviceRect.height() };
QT_FT_Raster_Params rasterParams;
- rasterParams.target = 0;
+ rasterParams.target = nullptr;
rasterParams.source = outline;
rasterParams.flags = QT_FT_RASTER_FLAG_CLIP;
- rasterParams.gray_spans = 0;
- rasterParams.black_spans = 0;
- rasterParams.bit_test = 0;
- rasterParams.bit_set = 0;
+ rasterParams.gray_spans = nullptr;
+ rasterParams.black_spans = nullptr;
+ rasterParams.bit_test = nullptr;
+ rasterParams.bit_set = nullptr;
rasterParams.user = data;
rasterParams.clip_box = clip_box;
@@ -3843,10 +3843,10 @@ QImage::Format QRasterBuffer::prepare(QImage *image)
QClipData::QClipData(int height)
{
clipSpanHeight = height;
- m_clipLines = 0;
+ m_clipLines = nullptr;
allocated = 0;
- m_spans = 0;
+ m_spans = nullptr;
xmin = xmax = ymin = ymax = 0;
count = 0;
@@ -3890,7 +3890,7 @@ void QClipData::initialize()
const int currMaxY = currMinY + rects[firstInBand].height();
while (y < currMinY) {
- m_clipLines[y].spans = 0;
+ m_clipLines[y].spans = nullptr;
m_clipLines[y].count = 0;
++y;
}
@@ -3922,7 +3922,7 @@ void QClipData::initialize()
Q_ASSERT(count <= allocated);
while (y < clipSpanHeight) {
- m_clipLines[y].spans = 0;
+ m_clipLines[y].spans = nullptr;
m_clipLines[y].count = 0;
++y;
}
@@ -3936,7 +3936,7 @@ void QClipData::initialize()
if (hasRectClip) {
int y = 0;
while (y < ymin) {
- m_clipLines[y].spans = 0;
+ m_clipLines[y].spans = nullptr;
m_clipLines[y].count = 0;
++y;
}
@@ -3957,19 +3957,19 @@ void QClipData::initialize()
}
while (y < clipSpanHeight) {
- m_clipLines[y].spans = 0;
+ m_clipLines[y].spans = nullptr;
m_clipLines[y].count = 0;
++y;
}
}
} QT_CATCH(...) {
free(m_spans); // have to free m_spans again or someone might think that we were successfully initialized.
- m_spans = 0;
+ m_spans = nullptr;
QT_RETHROW;
}
} QT_CATCH(...) {
free(m_clipLines); // same for clipLines
- m_clipLines = 0;
+ m_clipLines = nullptr;
QT_RETHROW;
}
}
@@ -4044,7 +4044,7 @@ void QClipData::setClipRect(const QRect &rect)
if (m_spans) {
free(m_spans);
- m_spans = 0;
+ m_spans = nullptr;
}
// qDebug() << xmin << xmax << ymin << ymax;
@@ -4074,7 +4074,7 @@ void QClipData::setClipRegion(const QRegion &region)
if (m_spans) {
free(m_spans);
- m_spans = 0;
+ m_spans = nullptr;
}
}
@@ -4532,7 +4532,7 @@ void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
bilinear = false;
m11 = m22 = m33 = 1.;
m12 = m13 = m21 = m23 = dx = dy = 0.0;
- clip = pe ? pe->d_func()->clip() : 0;
+ clip = pe ? pe->d_func()->clip() : nullptr;
}
Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
@@ -4668,15 +4668,15 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
void QSpanData::adjustSpanMethods()
{
- bitmapBlit = 0;
- alphamapBlit = 0;
- alphaRGBBlit = 0;
+ bitmapBlit = nullptr;
+ alphamapBlit = nullptr;
+ alphaRGBBlit = nullptr;
- fillRect = 0;
+ fillRect = nullptr;
switch(type) {
case None:
- unclipped_blend = 0;
+ unclipped_blend = nullptr;
break;
case Solid: {
const DrawHelper &drawHelper = qDrawHelper[rasterBuffer->format];
@@ -4695,17 +4695,17 @@ void QSpanData::adjustSpanMethods()
case Texture:
unclipped_blend = qBlendTexture;
if (!texture.imageData)
- unclipped_blend = 0;
+ unclipped_blend = nullptr;
break;
}
// setup clipping
if (!unclipped_blend) {
- blend = 0;
+ blend = nullptr;
} else if (!clip) {
blend = unclipped_blend;
} else if (clip->hasRectClip) {
- blend = clip->clipRect.isEmpty() ? 0 : qt_span_fill_clipRect;
+ blend = clip->clipRect.isEmpty() ? nullptr : qt_span_fill_clipRect;
} else {
blend = qt_span_fill_clipped;
}
@@ -4748,7 +4748,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _
{
const QImageData *d = const_cast<QImage *>(image)->data_ptr();
if (!d || d->height == 0) {
- texture.imageData = 0;
+ texture.imageData = nullptr;
texture.width = 0;
texture.height = 0;
texture.x1 = 0;
@@ -4757,7 +4757,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _
texture.y2 = 0;
texture.bytesPerLine = 0;
texture.format = QImage::Format_Invalid;
- texture.colorTable = 0;
+ texture.colorTable = nullptr;
texture.hasAlpha = alpha != 256;
} else {
texture.imageData = d->data;
@@ -4779,7 +4779,7 @@ void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _
texture.bytesPerLine = d->bytes_per_line;
texture.format = d->format;
- texture.colorTable = (d->format <= QImage::Format_Indexed8 && !d->colortable.isEmpty()) ? &d->colortable : 0;
+ texture.colorTable = (d->format <= QImage::Format_Indexed8 && !d->colortable.isEmpty()) ? &d->colortable : nullptr;
texture.hasAlpha = image->hasAlphaChannel() || alpha != 256;
}
texture.const_alpha = alpha;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 8314e8bc8a..5d8f89eadd 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -115,7 +115,7 @@ QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void
qvectorpath_cache_cleanup cleanup) const{
Q_ASSERT(!lookupCacheData(engine));
if ((m_hints & IsCachedHint) == 0) {
- m_cache = 0;
+ m_cache = nullptr;
m_hints |= IsCachedHint;
}
CacheEntry *e = new CacheEntry;
@@ -162,8 +162,8 @@ struct StrokeHandler {
QPaintEngineExPrivate::QPaintEngineExPrivate()
: dasher(&stroker),
- strokeHandler(0),
- activeStroker(0),
+ strokeHandler(nullptr),
+ activeStroker(nullptr),
strokerPen(Qt::NoPen)
{
}
@@ -211,7 +211,7 @@ void QPaintEngineExPrivate::replayClipOperations()
right, info.rectf.y(),
right, bottom,
info.rectf.x(), bottom };
- QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
q->clip(vp, info.operation);
break;
}
@@ -418,7 +418,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
if (style == Qt::SolidLine) {
d->activeStroker = &d->stroker;
} else if (style == Qt::NoPen) {
- d->activeStroker = 0;
+ d->activeStroker = nullptr;
} else {
d->dasher.setDashPattern(pen.dashPattern());
d->dasher.setDashOffset(pen.dashOffset());
@@ -616,7 +616,7 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op)
right, bottom,
qreal(r.x()), bottom,
qreal(r.x()), qreal(r.y()) };
- QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint);
clip(vp, op);
}
@@ -687,7 +687,7 @@ void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
void QPaintEngineEx::clip(const QPainterPath &path, Qt::ClipOperation op)
{
if (path.isEmpty()) {
- QVectorPath vp(0, 0);
+ QVectorPath vp(nullptr, 0);
clip(vp, op);
} else {
clip(qtVectorPathForPath(path), op);
@@ -698,7 +698,7 @@ void QPaintEngineEx::fillRect(const QRectF &r, const QBrush &brush)
{
qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(),
r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() };
- QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
fill(vp, brush);
}
@@ -719,7 +719,7 @@ void QPaintEngineEx::drawRects(const QRect *rects, int rectCount)
right, bottom,
qreal(r.x()), bottom,
qreal(r.x()), qreal(r.y()) };
- QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint);
draw(vp);
}
}
@@ -735,7 +735,7 @@ void QPaintEngineEx::drawRects(const QRectF *rects, int rectCount)
right, bottom,
r.x(), bottom,
r.x(), r.y() };
- QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 5, nullptr, QVectorPath::RectangleHint);
draw(vp);
}
}
@@ -871,7 +871,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)
} else {
for (int i=0; i<pointCount; ++i) {
qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + qreal(1/63.), points[i].y() };
- QVectorPath path(pts, 2, 0);
+ QVectorPath path(pts, 2, nullptr);
stroke(path, pen);
}
}
@@ -903,7 +903,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
for (int i=0; i<pointCount; ++i) {
qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()),
qreal(points[i].x() +1/63.), qreal(points[i].y()) };
- QVectorPath path(pts, 2, 0);
+ QVectorPath path(pts, 2, nullptr);
stroke(path, pen);
}
}
@@ -912,7 +912,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
- QVectorPath path((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
+ QVectorPath path((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (mode == PolylineMode)
stroke(path, state()->pen);
@@ -928,7 +928,7 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr
for (int i=0; i<count; ++i)
pts[i] = ((const int *) points)[i];
- QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode));
+ QVectorPath path(pts.data(), pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (mode == PolylineMode)
stroke(path, state()->pen);
@@ -960,7 +960,7 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con
r.x() + r.width(), r.y() + r.height(),
r.x(), r.y() + r.height() };
- QVectorPath path(pts, 4, 0, QVectorPath::RectangleHint);
+ QVectorPath path(pts, 4, nullptr, QVectorPath::RectangleHint);
fill(path, brush);
}
@@ -1061,7 +1061,7 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
QFontEngine *fontEngine = staticTextItem->fontEngine();
fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions,
- staticTextItem->numGlyphs, &path, 0);
+ staticTextItem->numGlyphs, &path, { });
if (!path.isEmpty()) {
QPainterState *s = state();
QPainter::RenderHints oldHints = s->renderHints;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 3ce54c20be..f70bbbd7d2 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -330,7 +330,7 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q)
original = new QPainterPrivate(q);
}
- d_ptrs[refcount - 1] = 0;
+ d_ptrs[refcount - 1] = nullptr;
q->restore();
q->d_ptr.take();
q->d_ptr.reset(original);
@@ -338,7 +338,7 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q)
if (emulationEngine) {
extended = emulationEngine->real_engine;
delete emulationEngine;
- emulationEngine = 0;
+ emulationEngine = nullptr;
}
}
@@ -1485,9 +1485,9 @@ QPainter::QPainter()
*/
QPainter::QPainter(QPaintDevice *pd)
- : d_ptr(0)
+ : d_ptr(nullptr)
{
- Q_ASSERT(pd != 0);
+ Q_ASSERT(pd != nullptr);
if (!QPainterPrivate::attachPainterPrivate(this, pd)) {
d_ptr.reset(new QPainterPrivate(this));
begin(pd);
@@ -1718,9 +1718,9 @@ static inline void qt_cleanup_painter_state(QPainterPrivate *d)
{
qDeleteAll(d->states);
d->states.clear();
- d->state = 0;
- d->engine = 0;
- d->device = 0;
+ d->state = nullptr;
+ d->engine = nullptr;
+ d->device = nullptr;
}
bool QPainter::begin(QPaintDevice *pd)
@@ -1769,13 +1769,13 @@ bool QPainter::begin(QPaintDevice *pd)
d->device = pd;
- d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : 0;
+ d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : nullptr;
if (d->emulationEngine)
d->emulationEngine->real_engine = d->extended;
// Setup new state...
Q_ASSERT(!d->state);
- d->state = d->extended ? d->extended->createState(0) : new QPainterState;
+ d->state = d->extended ? d->extended->createState(nullptr) : new QPainterState;
d->state->painter = this;
d->states.push_back(d->state);
@@ -1915,11 +1915,11 @@ bool QPainter::end()
if (d->engine->isActive()) {
ended = d->engine->end();
- d->updateState(0);
+ d->updateState(nullptr);
--d->device->painters;
if (d->device->painters == 0) {
- d->engine->setPaintDevice(0);
+ d->engine->setPaintDevice(nullptr);
d->engine->setActive(false);
}
}
@@ -1935,11 +1935,11 @@ bool QPainter::end()
if (d->emulationEngine) {
delete d->emulationEngine;
- d->emulationEngine = 0;
+ d->emulationEngine = nullptr;
}
if (d->extended) {
- d->extended = 0;
+ d->extended = nullptr;
}
qt_cleanup_painter_state(d);
@@ -2761,7 +2761,7 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op)
right, rect.y(),
right, bottom,
rect.x(), bottom };
- QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
+ QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
d->state->clipEnabled = true;
d->extended->clip(vp, op);
if (op == Qt::ReplaceClip || op == Qt::NoClip)
@@ -5642,7 +5642,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
QFixed width = rightMost - leftMost;
- if (extended != 0 && state->matrix.isAffine()) {
+ if (extended != nullptr && state->matrix.isAffine()) {
QStaticTextItem staticTextItem;
staticTextItem.color = state->pen.color();
staticTextItem.font = state->font;
@@ -5685,7 +5685,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
drawTextItemDecoration(q, QPointF(leftMost.toReal(), baseLine.toReal()),
fontEngine,
- 0, // textEngine
+ nullptr, // textEngine
(underline
? QTextCharFormat::SingleUnderline
: QTextCharFormat::NoUnderline),
@@ -5781,7 +5781,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
// If we don't have an extended paint engine, if the painter is projected,
// or if the font engine does not support the matrix, we go through standard
// code path
- if (d->extended == 0
+ if (d->extended == nullptr
|| !d->state->matrix.isAffine()
|| !fe->supportsTransformation(d->state->matrix)) {
staticText_d->paintText(topLeftPosition, this, pen().color());
@@ -5902,7 +5902,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(len);
QFontEngine *fontEngine = d->state->font.d->engineForScript(QChar::Script_Common);
- if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0))
+ if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, { }))
Q_UNREACHABLE();
QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine);
@@ -5981,7 +5981,7 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
d->updateState(d->state);
QRectF bounds;
- qt_format_text(d->state->font, r, flags, 0, str, br ? &bounds : 0, 0, 0, 0, this);
+ qt_format_text(d->state->font, r, flags, nullptr, str, br ? &bounds : nullptr, 0, nullptr, 0, this);
if (br)
*br = bounds.toAlignedRect();
}
@@ -6067,7 +6067,7 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
if (!d->extended)
d->updateState(d->state);
- qt_format_text(d->state->font, r, flags, 0, str, br, 0, 0, 0, this);
+ qt_format_text(d->state->font, r, flags, nullptr, str, br, 0, nullptr, 0, this);
}
/*!
@@ -6185,7 +6185,7 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
if (!d->extended)
d->updateState(d->state);
- qt_format_text(d->state->font, r, 0, &o, text, 0, 0, 0, 0, this);
+ qt_format_text(d->state->font, r, 0, &o, text, nullptr, 0, nullptr, 0, this);
}
/*!
@@ -6404,7 +6404,7 @@ Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t
}
QFixed width = rightMost - leftMost;
- QTextItem::RenderFlags flags = 0;
+ QTextItem::RenderFlags flags;
if (font.underline())
flags |= QTextItem::Underline;
@@ -6415,7 +6415,7 @@ Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t
drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()),
fontEngine,
- 0, // textEngine
+ nullptr, // textEngine
font.underline() ? QTextCharFormat::SingleUnderline
: QTextCharFormat::NoUnderline, flags,
width.toReal(), charFormat);
@@ -6425,7 +6425,7 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti)
{
Q_D(QPainter);
- d->drawTextItem(p, ti, static_cast<QTextEngine *>(0));
+ d->drawTextItem(p, ti, static_cast<QTextEngine *>(nullptr));
}
void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine)
@@ -6682,7 +6682,7 @@ QRectF QPainter::boundingRect(const QRectF &r, const QString &text, const QTextO
return QRectF(r.x(),r.y(), 0,0);
QRectF br;
- qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, 0, 0, this);
+ qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, nullptr, 0, this);
return br;
}
@@ -7213,7 +7213,7 @@ QPainter::RenderHints QPainter::renderHints() const
Q_D(const QPainter);
if (!d->engine)
- return 0;
+ return { };
return d->state->renderHints;
}
@@ -7429,7 +7429,7 @@ void QPainter::setRedirected(const QPaintDevice *device,
QPaintDevice *replacement,
const QPoint &offset)
{
- Q_ASSERT(device != 0);
+ Q_ASSERT(device != nullptr);
Q_UNUSED(device)
Q_UNUSED(replacement)
Q_UNUSED(offset)
@@ -7480,7 +7480,7 @@ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
{
Q_UNUSED(device)
Q_UNUSED(offset)
- return 0;
+ return nullptr;
}
#endif
@@ -7490,7 +7490,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
QPainter *painter)
{
qt_format_text(fnt, _r,
- tf, 0, str, brect,
+ tf, nullptr, str, brect,
tabstops, ta, tabarraylen,
painter);
}
@@ -7500,7 +7500,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
QPainter *painter)
{
- Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=0) ); // we either have an option or flags
+ Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=nullptr) ); // we either have an option or flags
if (option) {
tf |= option->alignment();
@@ -7786,16 +7786,9 @@ QPainterState::QPainterState(const QPainterState *s)
}
QPainterState::QPainterState()
- : brushOrigin(0, 0), bgBrush(Qt::white), clipOperation(Qt::NoClip),
- renderHints(0),
- wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0),
- opacity(1), WxF(false), VxF(false), clipEnabled(true),
- bgMode(Qt::TransparentMode), painter(0),
- layoutDirection(QGuiApplication::layoutDirection()),
- composition_mode(QPainter::CompositionMode_SourceOver),
- emulationSpecifier(0), changeFlags(0)
+ : brushOrigin(0, 0), WxF(false), VxF(false), clipEnabled(true),
+ layoutDirection(QGuiApplication::layoutDirection())
{
- dirtyFlags = 0;
}
QPainterState::~QPainterState()
@@ -7824,9 +7817,9 @@ void QPainterState::init(QPainter *p) {
layoutDirection = QGuiApplication::layoutDirection();
composition_mode = QPainter::CompositionMode_SourceOver;
emulationSpecifier = 0;
- dirtyFlags = 0;
+ dirtyFlags = { };
changeFlags = 0;
- renderHints = 0;
+ renderHints = { };
opacity = 1;
}
@@ -7883,7 +7876,7 @@ void QPainterState::init(QPainter *p) {
/*!
\fn void QPainter::drawImage(const QPointF &point, const QImage &image, const QRectF &source,
- Qt::ImageConversionFlags flags = 0)
+ Qt::ImageConversionFlags flags = Qt::AutoColor)
\overload
@@ -7893,7 +7886,7 @@ void QPainterState::init(QPainter *p) {
/*!
\fn void QPainter::drawImage(const QPoint &point, const QImage &image, const QRect &source,
- Qt::ImageConversionFlags flags = 0)
+ Qt::ImageConversionFlags flags = Qt::AutoColor)
\overload
Draws the rectangular portion \a source of the given \a image with
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 29d4880eb9..285bd90502 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -154,29 +154,29 @@ public:
QFont deviceFont;
QPen pen;
QBrush brush;
- QBrush bgBrush; // background brush
+ QBrush bgBrush = Qt::white; // background brush
QRegion clipRegion;
QPainterPath clipPath;
- Qt::ClipOperation clipOperation;
+ Qt::ClipOperation clipOperation = Qt::NoClip;
QPainter::RenderHints renderHints;
QVector<QPainterClipInfo> clipInfo; // ### Make me smaller and faster to copy around...
QTransform worldMatrix; // World transformation matrix, not window and viewport
QTransform matrix; // Complete transformation matrix,
QTransform redirectionMatrix;
- int wx, wy, ww, wh; // window rectangle
- int vx, vy, vw, vh; // viewport rectangle
- qreal opacity;
+ int wx = 0, wy = 0, ww = 0, wh = 0; // window rectangle
+ int vx = 0, vy = 0, vw = 0, vh = 0; // viewport rectangle
+ qreal opacity = 1;
uint WxF:1; // World transformation
uint VxF:1; // View transformation
uint clipEnabled:1;
- Qt::BGMode bgMode;
- QPainter *painter;
+ Qt::BGMode bgMode = Qt::TransparentMode;
+ QPainter *painter = nullptr;
Qt::LayoutDirection layoutDirection;
- QPainter::CompositionMode composition_mode;
- uint emulationSpecifier;
- uint changeFlags;
+ QPainter::CompositionMode composition_mode = QPainter::CompositionMode_SourceOver;
+ uint emulationSpecifier = 0;
+ uint changeFlags = 0;
};
struct QPainterDummyState
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 1fb37ece56..17d8b863ab 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -546,7 +546,7 @@ void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
Constructs an empty QPainterPath object.
*/
QPainterPath::QPainterPath() noexcept
- : d_ptr(0)
+ : d_ptr(nullptr)
{
}
@@ -602,7 +602,7 @@ void QPainterPath::ensureData_helper()
QPainterPath::Element e = { 0, 0, QPainterPath::MoveToElement };
data->elements << e;
d_ptr.reset(data);
- Q_ASSERT(d_ptr != 0);
+ Q_ASSERT(d_ptr != nullptr);
}
/*!
@@ -1036,7 +1036,7 @@ void QPainterPath::arcMoveTo(const QRectF &rect, qreal angle)
return;
QPointF pt;
- qt_find_ellipse_coords(rect, angle, 0, &pt, 0);
+ qt_find_ellipse_coords(rect, angle, 0, &pt, nullptr);
moveTo(pt);
}
@@ -1253,7 +1253,7 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
fe->addOutlineToPath(x, y, glyphs, this,
si.analysis.bidiLevel % 2
? QTextItem::RenderFlags(QTextItem::RightToLeft)
- : QTextItem::RenderFlags(0));
+ : QTextItem::RenderFlags{});
const qreal lw = fe->lineThickness().toReal();
if (f.d->underline) {
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 924d332452..1a1b2d76e2 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -690,12 +690,12 @@ int QKdPointTree::build(int begin, int end, int depth)
if (last > begin)
m_nodes.at(last).left = &m_nodes.at(build(begin, last, depth + 1));
else
- m_nodes.at(last).left = 0;
+ m_nodes.at(last).left = nullptr;
if (last + 1 < end)
m_nodes.at(last).right = &m_nodes.at(build(last + 1, end, depth + 1));
else
- m_nodes.at(last).right = 0;
+ m_nodes.at(last).right = nullptr;
return last;
}
@@ -811,7 +811,7 @@ void QWingedEdge::intersectAndAdd()
if (isect->next) {
isect += isect->next;
} else {
- isect = 0;
+ isect = nullptr;
}
}
@@ -1535,8 +1535,8 @@ QPainterPath QPathClipper::clip(Operation operation)
if (subjectPath == clipPath)
return op == BoolSub ? QPainterPath() : subjectPath;
- bool subjectIsRect = pathToRect(subjectPath, 0);
- bool clipIsRect = pathToRect(clipPath, 0);
+ bool subjectIsRect = pathToRect(subjectPath, nullptr);
+ bool clipIsRect = pathToRect(clipPath, nullptr);
const QRectF clipBounds = clipPath.boundingRect();
const QRectF subjectBounds = subjectPath.boundingRect();
diff --git a/src/gui/painting/qpathsimplifier.cpp b/src/gui/painting/qpathsimplifier.cpp
index 4251840bbc..256a2fefe7 100644
--- a/src/gui/painting/qpathsimplifier.cpp
+++ b/src/gui/painting/qpathsimplifier.cpp
@@ -378,8 +378,8 @@ private:
};
inline PathSimplifier::BoundingVolumeHierarchy::BoundingVolumeHierarchy()
- : root(0)
- , nodeBlock(0)
+ : root(nullptr)
+ , nodeBlock(nullptr)
, blockSize(0)
, firstFree(0)
{
@@ -392,7 +392,7 @@ inline PathSimplifier::BoundingVolumeHierarchy::~BoundingVolumeHierarchy()
inline void PathSimplifier::BoundingVolumeHierarchy::allocate(int nodeCount)
{
- Q_ASSERT(nodeBlock == 0);
+ Q_ASSERT(nodeBlock == nullptr);
Q_ASSERT(firstFree == 0);
nodeBlock = new Node[blockSize = nodeCount];
}
@@ -401,9 +401,9 @@ inline void PathSimplifier::BoundingVolumeHierarchy::free()
{
freeNode(root);
delete[] nodeBlock;
- nodeBlock = 0;
+ nodeBlock = nullptr;
firstFree = blockSize = 0;
- root = 0;
+ root = nullptr;
}
inline PathSimplifier::BVHNode *PathSimplifier::BoundingVolumeHierarchy::newNode()
@@ -427,7 +427,7 @@ inline void PathSimplifier::BoundingVolumeHierarchy::freeNode(Node *n)
}
inline PathSimplifier::ElementAllocator::ElementAllocator()
- : blocks(0)
+ : blocks(nullptr)
{
}
@@ -442,11 +442,11 @@ inline PathSimplifier::ElementAllocator::~ElementAllocator()
inline void PathSimplifier::ElementAllocator::allocate(int count)
{
- Q_ASSERT(blocks == 0);
+ Q_ASSERT(blocks == nullptr);
Q_ASSERT(count > 0);
blocks = (ElementBlock *)malloc(sizeof(ElementBlock) + (count - 1) * sizeof(Element));
blocks->blockSize = count;
- blocks->next = 0;
+ blocks->next = nullptr;
blocks->firstFree = 0;
}
@@ -479,7 +479,7 @@ inline void PathSimplifier::Element::flip()
qSwap(indices[i], indices[degree - i]);
}
pointingUp = !pointingUp;
- Q_ASSERT(next == 0 && previous == 0);
+ Q_ASSERT(next == nullptr && previous == nullptr);
}
PathSimplifier::PathSimplifier(const QVectorPath &path, QDataBuffer<QPoint> &vertices,
@@ -685,9 +685,9 @@ void PathSimplifier::connectElements()
QDataBuffer<Event> events(m_elements.size() * 2);
for (int i = 0; i < m_elements.size(); ++i) {
Element *element = m_elements.at(i);
- element->next = element->previous = 0;
+ element->next = element->previous = nullptr;
element->winding = 0;
- element->edgeNode = 0;
+ element->edgeNode = nullptr;
const QPoint &u = m_points->at(element->indices[0]);
const QPoint &v = m_points->at(element->indices[element->degree]);
if (u != v) {
@@ -730,7 +730,7 @@ void PathSimplifier::connectElements()
Element *element2 = event2->element;
element->edgeNode->data = event2->element;
element2->edgeNode = element->edgeNode;
- element->edgeNode = 0;
+ element->edgeNode = nullptr;
events.pop_back();
events.pop_back();
@@ -783,8 +783,8 @@ void PathSimplifier::connectElements()
Element *upperElement = m_elementAllocator.newElement();
*upperElement = *element;
upperElement->lowerIndex() = element->upperIndex() = pointIndex;
- upperElement->edgeNode = 0;
- element->next = element->previous = 0;
+ upperElement->edgeNode = nullptr;
+ element->next = element->previous = nullptr;
if (upperElement->next)
upperElement->next->previous = upperElement;
else if (upperElement->previous)
@@ -805,7 +805,7 @@ void PathSimplifier::connectElements()
RBNode *left = findElementLeftOf(event->element, bounds);
RBNode *node = m_elementList.newNode();
node->data = event->element;
- Q_ASSERT(event->element->edgeNode == 0);
+ Q_ASSERT(event->element->edgeNode == nullptr);
event->element->edgeNode = node;
m_elementList.attachAfter(left, node);
} else {
@@ -814,7 +814,7 @@ void PathSimplifier::connectElements()
Element *element = event->element;
Q_ASSERT(element->edgeNode);
m_elementList.deleteNode(element->edgeNode);
- Q_ASSERT(element->edgeNode == 0);
+ Q_ASSERT(element->edgeNode == nullptr);
}
events.pop_back();
}
@@ -870,8 +870,8 @@ void PathSimplifier::connectElements()
Q_ASSERT(i + 1 < orderedElements.size());
Element *next = orderedElements.at(i);
Element *previous = orderedElements.at(i + 1);
- Q_ASSERT(next->previous == 0);
- Q_ASSERT(previous->next == 0);
+ Q_ASSERT(next->previous == nullptr);
+ Q_ASSERT(previous->next == nullptr);
next->previous = previous;
previous->next = next;
}
@@ -893,7 +893,7 @@ void PathSimplifier::fillIndices()
m_elements.at(i)->processed = false;
for (int i = 0; i < m_elements.size(); ++i) {
Element *element = m_elements.at(i);
- if (element->processed || element->next == 0)
+ if (element->processed || element->next == nullptr)
continue;
do {
m_indices->add(element->indices[0]);
@@ -1395,13 +1395,13 @@ PathSimplifier::RBNode *PathSimplifier::findElementLeftOf(const Element *element
const QPair<RBNode *, RBNode *> &bounds)
{
if (!m_elementList.root)
- return 0;
+ return nullptr;
RBNode *current = bounds.first;
Q_ASSERT(!current || !elementIsLeftOf(element, current->data));
if (!current)
current = m_elementList.front(m_elementList.root);
Q_ASSERT(current);
- RBNode *result = 0;
+ RBNode *result = nullptr;
while (current != bounds.second && !elementIsLeftOf(element, current->data)) {
result = current;
current = m_elementList.next(current);
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index f560e1f0f0..de9fc13331 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -439,8 +439,8 @@ QByteArray QPdf::generateDashes(const QPen &pen)
static const char* const pattern_for_brush[] = {
- 0, // NoBrush
- 0, // SolidPattern
+ nullptr, // NoBrush
+ nullptr, // SolidPattern
"0 J\n"
"6 w\n"
"[] 0 d\n"
@@ -637,7 +637,7 @@ static void cubicToHook(qfixed c1x, qfixed c1y,
}
QPdf::Stroker::Stroker()
- : stream(0),
+ : stream(nullptr),
first(true),
dashStroker(&basicStroker)
{
@@ -652,7 +652,7 @@ QPdf::Stroker::Stroker()
void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
{
if (pen.style() == Qt::NoPen) {
- stroker = 0;
+ stroker = nullptr;
return;
}
qreal w = pen.widthF();
@@ -1390,6 +1390,18 @@ void QPdfEngine::setPdfVersion(PdfVersion version)
d->pdfVersion = version;
}
+void QPdfEngine::setDocumentXmpMetadata(const QByteArray &xmpMetadata)
+{
+ Q_D(QPdfEngine);
+ d->xmpDocumentMetadata = xmpMetadata;
+}
+
+QByteArray QPdfEngine::documentXmpMetadata() const
+{
+ Q_D(const QPdfEngine);
+ return d->xmpDocumentMetadata;
+}
+
void QPdfEngine::setPageLayout(const QPageLayout &pageLayout)
{
Q_D(QPdfEngine);
@@ -1469,7 +1481,7 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
QPdfEnginePrivate::QPdfEnginePrivate()
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
pdfVersion(QPdfEngine::Version_1_4),
- outDevice(0), ownsDevice(false),
+ outDevice(nullptr), ownsDevice(false),
embedFonts(true),
grayscale(false),
m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10))
@@ -1477,8 +1489,8 @@ QPdfEnginePrivate::QPdfEnginePrivate()
initResources();
resolution = 1200;
currentObject = 1;
- currentPage = 0;
- stroker.stream = 0;
+ currentPage = nullptr;
+ stroker.stream = nullptr;
streampos = 0;
@@ -1520,6 +1532,8 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
d->xrefPositions.clear();
d->pageRoot = 0;
+ d->embeddedfilesRoot = 0;
+ d->namesRoot = 0;
d->catalog = 0;
d->info = 0;
d->graphicsState = 0;
@@ -1547,18 +1561,26 @@ bool QPdfEngine::end()
qDeleteAll(d->fonts);
d->fonts.clear();
delete d->currentPage;
- d->currentPage = 0;
+ d->currentPage = nullptr;
if (d->outDevice && d->ownsDevice) {
d->outDevice->close();
delete d->outDevice;
- d->outDevice = 0;
+ d->outDevice = nullptr;
}
+ d->fileCache.clear();
+
setActive(false);
return true;
}
+void QPdfEngine::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType)
+{
+ Q_D(QPdfEngine);
+ d->fileCache.push_back({fileName, data, mimeType});
+}
+
QPdfEnginePrivate::~QPdfEnginePrivate()
{
qDeleteAll(fonts);
@@ -1586,13 +1608,19 @@ void QPdfEnginePrivate::writeHeader()
int metaDataObj = -1;
int outputIntentObj = -1;
+ if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty()) {
+ metaDataObj = writeXmpDcumentMetaData();
+ }
if (pdfVersion == QPdfEngine::Version_A1b) {
- metaDataObj = writeXmpMetaData();
outputIntentObj = writeOutputIntent();
}
catalog = addXrefEntry(-1);
pageRoot = requestObject();
+ if (!fileCache.isEmpty()) {
+ namesRoot = requestObject();
+ embeddedfilesRoot = requestObject();
+ }
// catalog
{
@@ -1602,10 +1630,15 @@ void QPdfEnginePrivate::writeHeader()
<< "/Type /Catalog\n"
<< "/Pages " << pageRoot << "0 R\n";
- if (pdfVersion == QPdfEngine::Version_A1b) {
- s << "/OutputIntents [" << outputIntentObj << "0 R]\n";
+ // Embedded files, if any
+ if (!fileCache.isEmpty())
+ s << "/Names " << embeddedfilesRoot << "0 R\n";
+
+ if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty())
s << "/Metadata " << metaDataObj << "0 R\n";
- }
+
+ if (pdfVersion == QPdfEngine::Version_A1b)
+ s << "/OutputIntents [" << outputIntentObj << "0 R]\n";
s << ">>\n"
<< "endobj\n";
@@ -1613,6 +1646,12 @@ void QPdfEnginePrivate::writeHeader()
write(catalog);
}
+ if (!fileCache.isEmpty()) {
+ addXrefEntry(embeddedfilesRoot);
+ xprintf("<</EmbeddedFiles %d 0 R>>\n"
+ "endobj\n", namesRoot);
+ }
+
// graphics state
graphicsState = addXrefEntry(-1);
xprintf("<<\n"
@@ -1664,39 +1703,45 @@ void QPdfEnginePrivate::writeInfo()
"endobj\n");
}
-int QPdfEnginePrivate::writeXmpMetaData()
+int QPdfEnginePrivate::writeXmpDcumentMetaData()
{
const int metaDataObj = addXrefEntry(-1);
+ QByteArray metaDataContent;
+
+ if (xmpDocumentMetadata.isEmpty()) {
+ const QString producer(QString::fromLatin1("Qt " QT_VERSION_STR));
+
+ const QDateTime now = QDateTime::currentDateTime();
+ const QDate date = now.date();
+ const QTime time = now.time();
+ const QString timeStr =
+ QString::asprintf("%d-%02d-%02dT%02d:%02d:%02d",
+ date.year(), date.month(), date.day(),
+ time.hour(), time.minute(), time.second());
+
+ const int offset = now.offsetFromUtc();
+ const int hours = (offset / 60) / 60;
+ const int mins = (offset / 60) % 60;
+ QString tzStr;
+ if (offset < 0)
+ tzStr = QString::asprintf("-%02d:%02d", -hours, -mins);
+ else if (offset > 0)
+ tzStr = QString::asprintf("+%02d:%02d", hours , mins);
+ else
+ tzStr = QLatin1String("Z");
- const QString producer(QString::fromLatin1("Qt " QT_VERSION_STR));
-
- const QDateTime now = QDateTime::currentDateTime();
- const QDate date = now.date();
- const QTime time = now.time();
- const QString timeStr =
- QString::asprintf("%d-%02d-%02dT%02d:%02d:%02d",
- date.year(), date.month(), date.day(),
- time.hour(), time.minute(), time.second());
+ const QString metaDataDate = timeStr + tzStr;
- const int offset = now.offsetFromUtc();
- const int hours = (offset / 60) / 60;
- const int mins = (offset / 60) % 60;
- QString tzStr;
- if (offset < 0)
- tzStr = QString::asprintf("-%02d:%02d", -hours, -mins);
- else if (offset > 0)
- tzStr = QString::asprintf("+%02d:%02d", hours , mins);
+ QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml"));
+ metaDataFile.open(QIODevice::ReadOnly);
+ metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
+ title.toHtmlEscaped(),
+ creator.toHtmlEscaped(),
+ metaDataDate).toUtf8();
+ }
else
- tzStr = QLatin1String("Z");
+ metaDataContent = xmpDocumentMetadata;
- const QString metaDataDate = timeStr + tzStr;
-
- QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml"));
- metaDataFile.open(QIODevice::ReadOnly);
- const QByteArray metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
- title.toHtmlEscaped(),
- creator.toHtmlEscaped(),
- metaDataDate).toUtf8();
xprintf("<<\n"
"/Type /Metadata /Subtype /XML\n"
"/Length %d\n"
@@ -1774,6 +1819,56 @@ void QPdfEnginePrivate::writePageRoot()
"endobj\n");
}
+void QPdfEnginePrivate::writeAttachmentRoot()
+{
+ if (fileCache.isEmpty())
+ return;
+
+ QVector<int> attachments;
+ const int size = fileCache.size();
+ for (int i = 0; i < size; ++i) {
+ auto attachment = fileCache.at(i);
+ const int attachmentID = addXrefEntry(-1);
+ xprintf("<<\n");
+ if (do_compress)
+ xprintf("/Filter /FlateDecode\n");
+
+ const int lenobj = requestObject();
+ xprintf("/Length %d 0 R\n", lenobj);
+ int len = 0;
+ xprintf(">>\nstream\n");
+ len = writeCompressed(attachment.data);
+ xprintf("\nendstream\n"
+ "endobj\n");
+ addXrefEntry(lenobj);
+ xprintf("%d\n"
+ "endobj\n", len);
+
+ attachments.push_back(addXrefEntry(-1));
+ xprintf("<<\n"
+ "/F (%s)", attachment.fileName.toLatin1().constData());
+
+ xprintf("\n/EF <</F %d 0 R>>\n"
+ "/Type/Filespec\n"
+ , attachmentID);
+ if (!attachment.mimeType.isEmpty())
+ xprintf("/Subtype/%s\n",
+ attachment.mimeType.replace(QLatin1String("/"),
+ QLatin1String("#2F")).toLatin1().constData());
+ xprintf(">>\nendobj\n");
+ }
+
+ // names
+ addXrefEntry(namesRoot);
+ xprintf("<</Names[");
+ for (int i = 0; i < size; ++i) {
+ auto attachment = fileCache.at(i);
+ printString(attachment.fileName);
+ xprintf("%d 0 R\n", attachments.at(i));
+ }
+ xprintf("]>>\n"
+ "endobj\n");
+}
void QPdfEnginePrivate::embedFont(QFontSubset *font)
{
@@ -2031,6 +2126,8 @@ void QPdfEnginePrivate::writeTail()
writePage();
writeFonts();
writePageRoot();
+ writeAttachmentRoot();
+
addXrefEntry(xrefPositions.size(),false);
xprintf("xref\n"
"0 %d\n"
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 89e549614a..57d70db442 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -187,6 +187,11 @@ public:
void setPdfVersion(PdfVersion version);
+ void setDocumentXmpMetadata(const QByteArray &xmpMetadata);
+ QByteArray documentXmpMetadata() const;
+
+ void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType);
+
// reimplementations QPaintEngine
bool begin(QPaintDevice *pdev) override;
bool end() override;
@@ -297,9 +302,10 @@ private:
int createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha);
void writeInfo();
- int writeXmpMetaData();
+ int writeXmpDcumentMetaData();
int writeOutputIntent();
void writePageRoot();
+ void writeAttachmentRoot();
void writeFonts();
void embedFont(QFontSubset *font);
qreal calcUserUnit() const;
@@ -324,11 +330,22 @@ private:
inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.length()); }
int writeCompressed(QIODevice *dev);
+ struct AttachmentInfo
+ {
+ AttachmentInfo (const QString &fileName, const QByteArray &data, const QString &mimeType)
+ : fileName(fileName), data(data), mimeType(mimeType) {}
+ QString fileName;
+ QByteArray data;
+ QString mimeType;
+ };
+
// various PDF objects
- int pageRoot, catalog, info, graphicsState, patternColorSpace;
+ int pageRoot, embeddedfilesRoot, namesRoot, catalog, info, graphicsState, patternColorSpace;
QVector<uint> pages;
QHash<qint64, uint> imageCache;
QHash<QPair<uint, uint>, uint > alphaCache;
+ QVector<AttachmentInfo> fileCache;
+ QByteArray xmpDocumentMetadata;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index bf7e2d3dca..4f70fe6ad2 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -55,7 +55,7 @@ public:
: QObjectPrivate()
{
engine = new QPdfEngine();
- output = 0;
+ output = nullptr;
pdfVersion = QPdfWriter::PdfVersion_1_4;
}
~QPdfWriterPrivate()
@@ -266,6 +266,50 @@ int QPdfWriter::resolution() const
return d->engine->resolution();
}
+/*!
+ \since 5.15
+
+ Sets the document metadata. This metadata is not influenced by the setTitle / setCreator methods,
+ so is up to the user to keep it consistent.
+ \a xmpMetadata contains XML formatted metadata to embed into the PDF file.
+
+ \sa documentXmpMetadata()
+*/
+
+void QPdfWriter::setDocumentXmpMetadata(const QByteArray &xmpMetadata)
+{
+ Q_D(const QPdfWriter);
+ d->engine->setDocumentXmpMetadata(xmpMetadata);
+}
+
+/*!
+ \since 5.15
+
+ Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata. It will not
+ return the default metadata.
+
+ \sa setDocumentXmpMetadata()
+*/
+
+QByteArray QPdfWriter::documentXmpMetadata() const
+{
+ Q_D(const QPdfWriter);
+ return d->engine->documentXmpMetadata();
+}
+
+/*!
+ \since 5.15
+
+ Adds \a fileName attachment to the PDF with (optional) \a mimeType
+ \a data contains the raw file data to embed into the PDF file.
+*/
+
+void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType)
+{
+ Q_D(QPdfWriter);
+ d->engine->addFileAttachment(fileName, data, mimeType);
+}
+
// Defined in QPagedPaintDevice but non-virtual, add QPdfWriter specific doc here
#ifdef Q_QDOC
/*!
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 668081e008..04039a0104 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -75,6 +75,11 @@ public:
void setResolution(int resolution);
int resolution() const;
+ void setDocumentXmpMetadata(const QByteArray &xmpMetadata);
+ QByteArray documentXmpMetadata() const;
+
+ void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString());
+
#ifdef Q_QDOC
bool setPageLayout(const QPageLayout &pageLayout);
bool setPageSize(const QPageSize &pageSize);
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index dc6e3e04d0..1a940443d1 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -254,7 +254,7 @@ public:
{
if (!pen->ref.deref())
delete pen;
- pen = 0;
+ pen = nullptr;
}
};
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 45e90bd99b..c092a7153f 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -87,10 +87,10 @@ class QPlatformBackingStorePrivate
public:
QPlatformBackingStorePrivate(QWindow *w)
: window(w)
- , backingStore(0)
+ , backingStore(nullptr)
#ifndef QT_NO_OPENGL
, textureId(0)
- , blitter(0)
+ , blitter(nullptr)
#endif
{
}
@@ -427,7 +427,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
origin = QOpenGLTextureBlitter::OriginBottomLeft;
textureId = d_ptr->textureId;
} else {
- TextureFlags flags = 0;
+ TextureFlags flags;
textureId = toTexture(deviceRegion(region, window, offset), &d_ptr->textureSize, &flags);
d_ptr->needsSwizzle = (flags & TextureSwizzle) != 0;
d_ptr->premultiplied = (flags & TexturePremultiplied) != 0;
@@ -534,7 +534,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
GLuint pixelType = GL_UNSIGNED_BYTE;
bool needsConversion = false;
- *flags = 0;
+ *flags = { };
switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
*flags |= TexturePremultiplied;
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 4f08b0092f..7aa054f1e2 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -100,7 +100,7 @@ public:
bool isLocked() const;
void appendTexture(void *source, GLuint textureId, const QRect &geometry,
- const QRect &clipRect = QRect(), Flags flags = nullptr);
+ const QRect &clipRect = QRect(), Flags flags = { });
void clear();
Q_SIGNALS:
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index b4014272f4..cd31d75f83 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -209,7 +209,7 @@ QScanConverter::QScanConverter()
: m_lines(0)
, m_alloc(0)
, m_size(0)
- , m_intersections(0)
+ , m_intersections(nullptr)
, m_active(0)
{
}
@@ -442,7 +442,7 @@ void QScanConverter::end()
free(m_intersections);
m_alloc = 0;
m_size = 0;
- m_intersections = 0;
+ m_intersections = nullptr;
}
if (m_lines.size() > 1024)
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 82f5be2b65..783b02fb93 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1128,7 +1128,7 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion &region)
segments.resize(4 * (end - rect));
int lastRowSegmentCount = 0;
- Segment *lastRowSegments = 0;
+ Segment *lastRowSegments = nullptr;
int lastSegment = 0;
int lastY = 0;
@@ -1380,10 +1380,10 @@ void QRegionPrivate::intersect(const QRect &rect)
extents.setRight(qMax(extents.right(), dest->right()));
extents.setBottom(qMax(extents.bottom(), dest->bottom()));
- const QRect *nextToLast = (numRects > 1 ? dest - 2 : 0);
+ const QRect *nextToLast = (numRects > 1 ? dest - 2 : nullptr);
// mergeFromBelow inlined and optimized
- if (canMergeFromBelow(dest - 1, dest, nextToLast, 0)) {
+ if (canMergeFromBelow(dest - 1, dest, nextToLast, nullptr)) {
if (!n || src->y() != dest->y() || src->left() > r.right()) {
QRect *prev = dest - 1;
prev->setBottom(dest->bottom());
@@ -1408,11 +1408,11 @@ void QRegionPrivate::append(const QRect *r)
QRect *myLast = (numRects == 1 ? &extents : rects.data() + (numRects - 1));
if (mergeFromRight(myLast, r)) {
if (numRects > 1) {
- const QRect *nextToTop = (numRects > 2 ? myLast - 2 : 0);
- if (mergeFromBelow(myLast - 1, myLast, nextToTop, 0))
+ const QRect *nextToTop = (numRects > 2 ? myLast - 2 : nullptr);
+ if (mergeFromBelow(myLast - 1, myLast, nextToTop, nullptr))
--numRects;
}
- } else if (mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : 0), 0)) {
+ } else if (mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : nullptr), nullptr)) {
// nothing
} else {
vectorize();
@@ -1451,18 +1451,18 @@ void QRegionPrivate::append(const QRegionPrivate *r)
{
const QRect *rFirst = srcRect;
QRect *myLast = destRect - 1;
- const QRect *nextToLast = (numRects > 1 ? myLast - 1 : 0);
+ const QRect *nextToLast = (numRects > 1 ? myLast - 1 : nullptr);
if (mergeFromRight(myLast, rFirst)) {
++srcRect;
--numAppend;
- const QRect *rNextToFirst = (numAppend > 1 ? rFirst + 2 : 0);
+ const QRect *rNextToFirst = (numAppend > 1 ? rFirst + 2 : nullptr);
if (mergeFromBelow(myLast, rFirst + 1, nextToLast, rNextToFirst)) {
++srcRect;
--numAppend;
}
if (numRects > 1) {
- nextToLast = (numRects > 2 ? myLast - 2 : 0);
- rNextToFirst = (numAppend > 0 ? srcRect : 0);
+ nextToLast = (numRects > 2 ? myLast - 2 : nullptr);
+ rNextToFirst = (numAppend > 0 ? srcRect : nullptr);
if (mergeFromBelow(myLast - 1, myLast, nextToLast, rNextToFirst)) {
--destRect;
--numRects;
@@ -1522,20 +1522,20 @@ void QRegionPrivate::prepend(const QRegionPrivate *r)
// try merging
{
QRect *myFirst = rects.data();
- const QRect *nextToFirst = (numRects > 1 ? myFirst + 1 : 0);
+ const QRect *nextToFirst = (numRects > 1 ? myFirst + 1 : nullptr);
const QRect *rLast = r->rects.constData() + r->numRects - 1;
- const QRect *rNextToLast = (r->numRects > 1 ? rLast - 1 : 0);
+ const QRect *rNextToLast = (r->numRects > 1 ? rLast - 1 : nullptr);
if (mergeFromLeft(myFirst, rLast)) {
--numPrepend;
--rLast;
- rNextToLast = (numPrepend > 1 ? rLast - 1 : 0);
+ rNextToLast = (numPrepend > 1 ? rLast - 1 : nullptr);
if (mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)) {
--numPrepend;
--rLast;
}
if (numRects > 1) {
- nextToFirst = (numRects > 2? myFirst + 2 : 0);
- rNextToLast = (numPrepend > 0 ? rLast : 0);
+ nextToFirst = (numRects > 2? myFirst + 2 : nullptr);
+ rNextToLast = (numPrepend > 0 ? rLast : nullptr);
if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, rNextToLast)) {
--numRects;
++numSkip;
@@ -1585,14 +1585,14 @@ void QRegionPrivate::prepend(const QRect *r)
QRect *myFirst = (numRects == 1 ? &extents : rects.data());
if (mergeFromLeft(myFirst, r)) {
if (numRects > 1) {
- const QRect *nextToFirst = (numRects > 2 ? myFirst + 2 : 0);
- if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, 0)) {
+ const QRect *nextToFirst = (numRects > 2 ? myFirst + 2 : nullptr);
+ if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, nullptr)) {
--numRects;
memmove(rects.data(), rects.constData() + 1,
numRects * sizeof(QRect));
}
}
- } else if (mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : 0), 0)) {
+ } else if (mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : nullptr), nullptr)) {
// nothing
} else {
vectorize();
@@ -2324,14 +2324,14 @@ static void miRegionOp(QRegionPrivate &dest,
top = qMax(r1->top(), ybot + 1);
bot = qMin(r1->bottom(), r2->top() - 1);
- if (nonOverlap1Func != 0 && bot >= top)
+ if (nonOverlap1Func != nullptr && bot >= top)
(*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot);
ytop = r2->top();
} else if (r2->top() < r1->top()) {
top = qMax(r2->top(), ybot + 1);
bot = qMin(r2->bottom(), r1->top() - 1);
- if (nonOverlap2Func != 0 && bot >= top)
+ if (nonOverlap2Func != nullptr && bot >= top)
(*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot);
ytop = r1->top();
} else {
@@ -2374,7 +2374,7 @@ static void miRegionOp(QRegionPrivate &dest,
*/
curBand = dest.numRects;
if (r1 != r1End) {
- if (nonOverlap1Func != 0) {
+ if (nonOverlap1Func != nullptr) {
do {
r1BandEnd = r1;
while (r1BandEnd < r1End && r1BandEnd->top() == r1->top())
@@ -2383,7 +2383,7 @@ static void miRegionOp(QRegionPrivate &dest,
r1 = r1BandEnd;
} while (r1 != r1End);
}
- } else if ((r2 != r2End) && (nonOverlap2Func != 0)) {
+ } else if ((r2 != r2End) && (nonOverlap2Func != nullptr)) {
do {
r2BandEnd = r2;
while (r2BandEnd < r2End && r2BandEnd->top() == r2->top())
@@ -2698,7 +2698,7 @@ static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS,
Q_ASSERT(!regS->contains(*regM));
Q_ASSERT(!EqualRegion(regM, regS));
- miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, 0);
+ miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, nullptr);
/*
* Can't alter dest's extents before we call miRegionOp because
@@ -3235,14 +3235,14 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
(ScanLineListBlock *)malloc(sizeof(ScanLineListBlock));
Q_CHECK_PTR(tmpSLLBlock);
(*SLLBlock)->next = tmpSLLBlock;
- tmpSLLBlock->next = (ScanLineListBlock *)NULL;
+ tmpSLLBlock->next = (ScanLineListBlock *)nullptr;
*SLLBlock = tmpSLLBlock;
*iSLLBlock = 0;
}
pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
pSLL->next = pPrevSLL->next;
- pSLL->edgelist = (EdgeTableEntry *)NULL;
+ pSLL->edgelist = (EdgeTableEntry *)nullptr;
pPrevSLL->next = pSLL;
}
pSLL->scanline = scanline;
@@ -3250,7 +3250,7 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
/*
* now insert the edge in the right bucket
*/
- prev = 0;
+ prev = nullptr;
start = pSLL->edgelist;
while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) {
prev = start;
@@ -3306,18 +3306,18 @@ static void CreateETandAET(int count, const QPoint *pts,
/*
* initialize the Active Edge Table
*/
- AET->next = 0;
- AET->back = 0;
- AET->nextWETE = 0;
+ AET->next = nullptr;
+ AET->back = nullptr;
+ AET->nextWETE = nullptr;
AET->bres.minor_axis = SMALL_COORDINATE;
/*
* initialize the Edge Table.
*/
- ET->scanlines.next = 0;
+ ET->scanlines.next = nullptr;
ET->ymax = SMALL_COORDINATE;
ET->ymin = LARGE_COORDINATE;
- pSLLBlock->next = 0;
+ pSLLBlock->next = nullptr;
PrevPt = &pts[count - 1];
@@ -3426,7 +3426,7 @@ static void computeWAET(EdgeTableEntry *AET)
int inside = 1;
int isInside = 0;
- AET->nextWETE = 0;
+ AET->nextWETE = nullptr;
pWETE = AET;
AET = AET->next;
while (AET) {
@@ -3442,7 +3442,7 @@ static void computeWAET(EdgeTableEntry *AET)
}
AET = AET->next;
}
- pWETE->nextWETE = 0;
+ pWETE->nextWETE = nullptr;
}
/*
@@ -3672,7 +3672,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count)))) {
delete region;
- return 0;
+ return nullptr;
}
region->vectorize();
@@ -3692,7 +3692,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
#endif
delete AET;
delete region;
- return 0;
+ return nullptr;
}
@@ -3808,7 +3808,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
curPtBlock = tmpPtBlock;
}
free(pETEs);
- return 0; // this function returns 0 in case of an error
+ return nullptr; // this function returns 0 in case of an error
}
FreeStorage(SLLBlock.next);
@@ -4185,7 +4185,7 @@ QRegion QRegion::intersected(const QRegion &r) const
QRegion result;
result.detach();
- miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, 0, 0);
+ miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, nullptr, nullptr);
/*
* Can't alter dest's extents before we call miRegionOp because
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 271d3ba6bf..22302f9790 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -185,10 +185,10 @@ QStrokerOps::QStrokerOps()
: m_elements(0)
, m_curveThreshold(qt_real_to_fixed(0.25))
, m_dashThreshold(qt_real_to_fixed(0.25))
- , m_customData(0)
- , m_moveTo(0)
- , m_lineTo(0)
- , m_cubicTo(0)
+ , m_customData(nullptr)
+ , m_moveTo(nullptr)
+ , m_lineTo(nullptr)
+ , m_cubicTo(nullptr)
{
}
@@ -219,7 +219,7 @@ void QStrokerOps::end()
{
if (m_elements.size() > 1)
processCurrentSubpath();
- m_customData = 0;
+ m_customData = nullptr;
}
/*!
diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json
index 7b16e8c211..e2326a56c1 100644
--- a/src/gui/painting/qt_attribution.json
+++ b/src/gui/painting/qt_attribution.json
@@ -29,20 +29,6 @@
(C) Willem Monsuwe <willem@stack.nl>"
},
{
- "Id": "webgradients",
- "Name": "WebGradients",
- "QDocModule": "qtgui",
- "QtUsage": "Used in Qt GUI to provide presets for QGradient.",
- "Files": "webgradients.css",
-
- "Description": "WebGradients is a free collection of 180 linear gradients.",
- "Homepage": "https://webgradients.com/",
- "License": "MIT License",
- "LicenseId": "MIT",
- "LicenseFile": "WEBGRADIENTS_LICENSE.txt",
- "Copyright": "Copyright (c) 2017 itmeo"
- },
- {
"Id": "xserverhelper",
"Name": "X Server helper",
"QDocModule": "qtgui",
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 7a3dd04965..f40ca9d8b4 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -127,7 +127,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
QFixed subPixelPosition;
if (supportsSubPixelPositions) {
- QFixed x = positions != 0 ? positions[i].x : QFixed();
+ QFixed x = positions != nullptr ? positions[i].x : QFixed();
subPixelPosition = fontEngine->subPixelPositionForX(x);
}
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index b1b07f9699..8e0308f268 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -150,7 +150,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
m_cos_theta = qFastCos(Q_PI / m_roundness);
const qreal *endPts = pts + (count<<1);
- const qreal *startPts = 0;
+ const qreal *startPts = nullptr;
Qt::PenCapStyle cap = m_cap_style;
@@ -510,7 +510,7 @@ static void qdashprocessor_cubicTo(qreal, qreal, qreal, qreal, qreal, qreal, voi
QDashedStrokeProcessor::QDashedStrokeProcessor()
: m_points(0), m_types(0),
- m_dash_stroker(0), m_inv_scale(1)
+ m_dash_stroker(nullptr), m_inv_scale(1)
{
m_dash_stroker.setMoveToHook(qdashprocessor_moveTo);
m_dash_stroker.setLineToHook(qdashprocessor_lineTo);
diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 9be3eeaffd..ec3ab8ff8f 100644
--- a/src/gui/painting/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -958,7 +958,7 @@ void QTriangulator<T>::ComplexToSimple::initEdges()
} else {
Q_ASSERT(i + 1 < m_parent->m_indices.size());
// {node, from, to, next, previous, winding, mayIntersect, pointingUp, originallyPointingUp}
- Edge edge = {0, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false};
+ Edge edge = {nullptr, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false};
m_edges.add(edge);
}
}
@@ -1029,7 +1029,7 @@ template <typename T>
QRBTree<int>::Node *QTriangulator<T>::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const
{
QRBTree<int>::Node *current = m_edgeList.root;
- QRBTree<int>::Node *result = 0;
+ QRBTree<int>::Node *result = nullptr;
while (current) {
if (edgeIsLeftOfEdge(edgeIndex, current->data)) {
current = current->left;
@@ -1072,7 +1072,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim
}
current = (d < 0 ? current->left : current->right);
}
- if (current == 0)
+ if (current == nullptr)
return result;
current = result.first->left;
@@ -1273,7 +1273,7 @@ void QTriangulator<T>::ComplexToSimple::fillPriorityQueue()
m_events.reserve(m_edges.size() * 2);
for (int i = 0; i < m_edges.size(); ++i) {
Q_ASSERT(m_edges.at(i).previous == -1 && m_edges.at(i).next == -1);
- Q_ASSERT(m_edges.at(i).node == 0);
+ Q_ASSERT(m_edges.at(i).node == nullptr);
Q_ASSERT(m_edges.at(i).pointingUp == m_edges.at(i).originallyPointingUp);
Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from)));
// Ignore zero-length edges.
@@ -1296,7 +1296,7 @@ void QTriangulator<T>::ComplexToSimple::calculateIntersections()
fillPriorityQueue();
Q_ASSERT(m_topIntersection.empty());
- Q_ASSERT(m_edgeList.root == 0);
+ Q_ASSERT(m_edgeList.root == nullptr);
// Find all intersection points.
while (!m_events.isEmpty()) {
@@ -1305,7 +1305,7 @@ void QTriangulator<T>::ComplexToSimple::calculateIntersections()
// Find all edges in the edge list that contain the current vertex and mark them to be split later.
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> range = bounds(event.point);
- QRBTree<int>::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0;
+ QRBTree<int>::Node *leftNode = range.first ? m_edgeList.previous(range.first) : nullptr;
int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower());
QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point);
@@ -1361,7 +1361,7 @@ int QTriangulator<T>::ComplexToSimple::splitEdge(int splitIndex)
{
const Split &split = m_splits.at(splitIndex);
Edge &lowerEdge = m_edges.at(split.edge);
- Q_ASSERT(lowerEdge.node == 0);
+ Q_ASSERT(lowerEdge.node == nullptr);
Q_ASSERT(lowerEdge.previous == -1 && lowerEdge.next == -1);
if (lowerEdge.from == split.vertex)
@@ -1439,7 +1439,7 @@ void QTriangulator<T>::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray
template <typename T>
void QTriangulator<T>::ComplexToSimple::removeUnwantedEdgesAndConnect()
{
- Q_ASSERT(m_edgeList.root == 0);
+ Q_ASSERT(m_edgeList.root == nullptr);
// Initialize priority queue.
fillPriorityQueue();
@@ -1772,7 +1772,7 @@ void QTriangulator<T>::SimpleToMonotone::setupDataStructures()
{
int i = 0;
Edge e;
- e.node = 0;
+ e.node = nullptr;
e.twin = -1;
while (i + 3 <= m_parent->m_indices.size()) {
@@ -1862,7 +1862,7 @@ template <typename T>
QRBTree<int>::Node *QTriangulator<T>::SimpleToMonotone::searchEdgeLeftOfEdge(int edgeIndex) const
{
QRBTree<int>::Node *current = m_edgeList.root;
- QRBTree<int>::Node *result = 0;
+ QRBTree<int>::Node *result = nullptr;
while (current) {
if (edgeIsLeftOfEdge(edgeIndex, current->data)) {
current = current->left;
@@ -1879,7 +1879,7 @@ template <typename T>
QRBTree<int>::Node *QTriangulator<T>::SimpleToMonotone::searchEdgeLeftOfPoint(int pointIndex) const
{
QRBTree<int>::Node *current = m_edgeList.root;
- QRBTree<int>::Node *result = 0;
+ QRBTree<int>::Node *result = nullptr;
while (current) {
const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower());
const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper());
@@ -2038,7 +2038,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
j = m_edges.at(i).previous;
Q_ASSERT(j < m_edges.size());
- QRBTree<int>::Node *leftEdgeNode = 0;
+ QRBTree<int>::Node *leftEdgeNode = nullptr;
switch (m_edges.at(i).type) {
case RegularVertex:
@@ -2049,7 +2049,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(i).helper));
m_edges.at(j).node = m_edges.at(i).node;
- m_edges.at(i).node = 0;
+ m_edges.at(i).node = nullptr;
m_edges.at(j).node->data = j;
m_edges.at(j).helper = i;
} else if (m_edges.at(j).node) {
@@ -2057,7 +2057,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
if (m_edges.at(m_edges.at(j).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(j).helper));
m_edges.at(i).node = m_edges.at(j).node;
- m_edges.at(j).node = 0;
+ m_edges.at(j).node = nullptr;
m_edges.at(i).node->data = i;
m_edges.at(i).helper = i;
} else {
diff --git a/src/gui/painting/webgradients.binaryjson b/src/gui/painting/webgradients.binaryjson
deleted file mode 100644
index 75edd487be..0000000000
--- a/src/gui/painting/webgradients.binaryjson
+++ /dev/null
Binary files differ
diff --git a/src/gui/painting/webgradients.cpp b/src/gui/painting/webgradients.cpp
new file mode 100644
index 0000000000..b4d297450b
--- /dev/null
+++ b/src/gui/painting/webgradients.cpp
@@ -0,0 +1,578 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This file is auto-generated by gradientgen. DO NOT EDIT!
+
+static QArrayDataPointerRef<QGradientStop> qt_preset_gradient_stops(QGradient::Preset preset)
+{
+ Q_ASSERT(preset < QGradient::NumPresets);
+ switch (preset) {
+ case QGradient::WarmFlame:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(250, 208, 196, 255)));
+ case QGradient::NightFade:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 140, 209, 255)), QGradientStop(1, QColor(251, 194, 235, 255)));
+ case QGradient::SpringWarmth:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 208, 196, 255)), QGradientStop(0.01, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(255, 209, 255, 255)));
+ case QGradient::JuicyPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 236, 210, 255)), QGradientStop(1, QColor(252, 182, 159, 255)));
+ case QGradient::YoungPassion:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 129, 119, 255)), QGradientStop(0, QColor(255, 134, 122, 255)), QGradientStop(0.21, QColor(255, 140, 127, 255)), QGradientStop(0.52, QColor(249, 145, 133, 255)), QGradientStop(0.78, QColor(207, 85, 108, 255)), QGradientStop(1, QColor(177, 42, 91, 255)));
+ case QGradient::LadyLips:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(254, 207, 239, 255)), QGradientStop(1, QColor(254, 207, 239, 255)));
+ case QGradient::SunnyMorning:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(246, 211, 101, 255)), QGradientStop(1, QColor(253, 160, 133, 255)));
+ case QGradient::RainyAshville:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(251, 194, 235, 255)), QGradientStop(1, QColor(166, 193, 238, 255)));
+ case QGradient::FrozenDreams:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 203, 241, 255)), QGradientStop(0.01, QColor(253, 203, 241, 255)), QGradientStop(1, QColor(230, 222, 233, 255)));
+ case QGradient::WinterNeva:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 196, 253, 255)), QGradientStop(1, QColor(194, 233, 251, 255)));
+ case QGradient::DustyGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 252, 121, 255)), QGradientStop(1, QColor(150, 230, 161, 255)));
+ case QGradient::TemptingAzure:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(132, 250, 176, 255)), QGradientStop(1, QColor(143, 211, 244, 255)));
+ case QGradient::HeavyRain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(207, 217, 223, 255)), QGradientStop(1, QColor(226, 235, 240, 255)));
+ case QGradient::AmyCrisp:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(166, 192, 254, 255)), QGradientStop(1, QColor(246, 128, 132, 255)));
+ case QGradient::MeanFruit:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 203, 144, 255)), QGradientStop(1, QColor(213, 126, 235, 255)));
+ case QGradient::DeepBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(224, 195, 252, 255)), QGradientStop(1, QColor(142, 197, 252, 255)));
+ case QGradient::RipeMalinka:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(240, 147, 251, 255)), QGradientStop(1, QColor(245, 87, 108, 255)));
+ case QGradient::CloudyKnoxville:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 251, 251, 255)), QGradientStop(1, QColor(235, 237, 238, 255)));
+ case QGradient::MalibuBeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 172, 254, 255)), QGradientStop(1, QColor(0, 242, 254, 255)));
+ case QGradient::NewLife:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 233, 123, 255)), QGradientStop(1, QColor(56, 249, 215, 255)));
+ case QGradient::TrueSunset:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 112, 154, 255)), QGradientStop(1, QColor(254, 225, 64, 255)));
+ case QGradient::MorpheusDen:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(48, 207, 208, 255)), QGradientStop(1, QColor(51, 8, 103, 255)));
+ case QGradient::RareWind:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 237, 234, 255)), QGradientStop(1, QColor(254, 214, 227, 255)));
+ case QGradient::NearMoon:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(94, 231, 223, 255)), QGradientStop(1, QColor(180, 144, 202, 255)));
+ case QGradient::WildApple:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(210, 153, 194, 255)), QGradientStop(1, QColor(254, 249, 215, 255)));
+ case QGradient::SaintPetersburg:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(245, 247, 250, 255)), QGradientStop(1, QColor(195, 207, 226, 255)));
+ case QGradient::PlumPlate:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(102, 126, 234, 255)), QGradientStop(1, QColor(118, 75, 162, 255)));
+ case QGradient::EverlastingSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 252, 251, 255)), QGradientStop(1, QColor(226, 209, 195, 255)));
+ case QGradient::HappyFisher:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(137, 247, 254, 255)), QGradientStop(1, QColor(102, 166, 255, 255)));
+ case QGradient::Blessing:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 219, 146, 255)), QGradientStop(1, QColor(209, 253, 255, 255)));
+ case QGradient::SharpeyeEagle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(152, 144, 227, 255)), QGradientStop(1, QColor(177, 244, 207, 255)));
+ case QGradient::LadogaBottom:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 192, 253, 255)), QGradientStop(1, QColor(217, 222, 216, 255)));
+ case QGradient::LemonGate:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 251, 196, 255)), QGradientStop(1, QColor(249, 245, 134, 255)));
+ case QGradient::ItmeoBranding:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(42, 245, 152, 255)), QGradientStop(1, QColor(0, 158, 253, 255)));
+ case QGradient::ZeusMiracle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(205, 156, 242, 255)), QGradientStop(1, QColor(246, 243, 255, 255)));
+ case QGradient::OldHat:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(228, 175, 203, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0.3, QColor(226, 197, 139, 255)), QGradientStop(0.64, QColor(194, 206, 156, 255)), QGradientStop(1, QColor(126, 219, 220, 255)));
+ case QGradient::StarWine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(180, 101, 218, 255)), QGradientStop(0.33, QColor(207, 108, 201, 255)), QGradientStop(0.66, QColor(238, 96, 156, 255)), QGradientStop(1, QColor(238, 96, 156, 255)));
+ case QGradient::HappyAcid:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(55, 236, 186, 255)), QGradientStop(1, QColor(114, 175, 211, 255)));
+ case QGradient::AwesomePine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 187, 167, 255)), QGradientStop(1, QColor(207, 199, 248, 255)));
+ case QGradient::NewYork:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 241, 235, 255)), QGradientStop(1, QColor(172, 224, 249, 255)));
+ case QGradient::ShyRainbow:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 162, 162, 255)), QGradientStop(0.19, QColor(187, 193, 191, 255)), QGradientStop(0.42, QColor(87, 198, 225, 255)), QGradientStop(0.79, QColor(180, 159, 218, 255)), QGradientStop(1, QColor(122, 197, 216, 255)));
+ case QGradient::MixedHopes:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 113, 245, 255)), QGradientStop(1, QColor(250, 113, 205, 255)));
+ case QGradient::FlyHigh:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(72, 198, 239, 255)), QGradientStop(1, QColor(111, 134, 214, 255)));
+ case QGradient::StrongBliss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 140, 160, 255)), QGradientStop(0.19, QColor(249, 116, 143, 255)), QGradientStop(0.6, QColor(253, 134, 140, 255)), QGradientStop(1, QColor(254, 154, 139, 255)));
+ case QGradient::FreshMilk:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(254, 173, 166, 255)), QGradientStop(1, QColor(245, 239, 239, 255)));
+ case QGradient::SnowAgain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 233, 240, 255)), QGradientStop(1, QColor(238, 241, 245, 255)));
+ case QGradient::FebruaryInk:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 203, 238, 255)), QGradientStop(1, QColor(231, 240, 253, 255)));
+ case QGradient::KindSteel:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(233, 222, 250, 255)), QGradientStop(1, QColor(251, 252, 219, 255)));
+ case QGradient::SoftGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 223, 196, 255)), QGradientStop(1, QColor(222, 236, 221, 255)));
+ case QGradient::GrownEarly:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(11, 163, 96, 255)), QGradientStop(1, QColor(60, 186, 146, 255)));
+ case QGradient::SharpBlues:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 198, 251, 255)), QGradientStop(1, QColor(0, 91, 234, 255)));
+ case QGradient::ShadyWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(116, 235, 213, 255)), QGradientStop(1, QColor(159, 172, 230, 255)));
+ case QGradient::DirtyBeauty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(106, 133, 182, 255)), QGradientStop(1, QColor(186, 200, 224, 255)));
+ case QGradient::GreatWhale:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(163, 189, 237, 255)), QGradientStop(1, QColor(105, 145, 199, 255)));
+ case QGradient::TeenNotebook:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(151, 149, 240, 255)), QGradientStop(1, QColor(251, 200, 212, 255)));
+ case QGradient::PoliteRumors:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(167, 166, 203, 255)), QGradientStop(0.52, QColor(137, 137, 186, 255)), QGradientStop(1, QColor(137, 137, 186, 255)));
+ case QGradient::SweetPeriod:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(63, 81, 177, 255)), QGradientStop(0.13, QColor(90, 85, 174, 255)), QGradientStop(0.25, QColor(123, 95, 172, 255)), QGradientStop(0.38, QColor(143, 106, 174, 255)), QGradientStop(0.5, QColor(168, 106, 164, 255)), QGradientStop(0.62, QColor(204, 107, 142, 255)), QGradientStop(0.75, QColor(241, 130, 113, 255)), QGradientStop(0.87, QColor(243, 164, 105, 255)), QGradientStop(1, QColor(247, 201, 120, 255)));
+ case QGradient::WideMatrix:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 197, 228, 255)), QGradientStop(0.15, QColor(253, 163, 75, 255)), QGradientStop(0.35, QColor(255, 120, 130, 255)), QGradientStop(0.52, QColor(200, 105, 158, 255)), QGradientStop(0.71, QColor(112, 70, 170, 255)), QGradientStop(0.87, QColor(12, 29, 184, 255)), QGradientStop(1, QColor(2, 15, 117, 255)));
+ case QGradient::SoftCherish:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(219, 220, 215, 255)), QGradientStop(0.24, QColor(221, 220, 215, 255)), QGradientStop(0.3, QColor(226, 201, 204, 255)), QGradientStop(0.46, QColor(231, 98, 125, 255)), QGradientStop(0.59, QColor(184, 35, 90, 255)), QGradientStop(0.71, QColor(128, 19, 87, 255)), QGradientStop(0.84, QColor(61, 22, 53, 255)), QGradientStop(1, QColor(28, 26, 39, 255)));
+ case QGradient::RedSalvation:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(244, 59, 71, 255)), QGradientStop(1, QColor(69, 58, 148, 255)));
+ case QGradient::BurningSpring:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 181, 118, 255)), QGradientStop(0.3, QColor(68, 196, 137, 255)), QGradientStop(0.46, QColor(40, 169, 174, 255)), QGradientStop(0.59, QColor(40, 162, 183, 255)), QGradientStop(0.71, QColor(76, 119, 136, 255)), QGradientStop(0.86, QColor(108, 79, 99, 255)), QGradientStop(1, QColor(67, 44, 57, 255)));
+ case QGradient::NightParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(2, 80, 197, 255)), QGradientStop(1, QColor(212, 63, 141, 255)));
+ case QGradient::SkyGlider:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(136, 211, 206, 255)), QGradientStop(1, QColor(110, 69, 226, 255)));
+ case QGradient::HeavenPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(217, 175, 217, 255)), QGradientStop(1, QColor(151, 217, 225, 255)));
+ case QGradient::PurpleDivision:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 40, 228, 255)), QGradientStop(1, QColor(229, 178, 202, 255)));
+ case QGradient::AquaSplash:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(19, 84, 122, 255)), QGradientStop(1, QColor(128, 208, 199, 255)));
+ case QGradient::SpikyNaga:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 82, 133, 255)), QGradientStop(0.12, QColor(88, 94, 146, 255)), QGradientStop(0.25, QColor(101, 104, 159, 255)), QGradientStop(0.37, QColor(116, 116, 176, 255)), QGradientStop(0.5, QColor(126, 126, 187, 255)), QGradientStop(0.62, QColor(131, 137, 199, 255)), QGradientStop(0.75, QColor(151, 149, 212, 255)), QGradientStop(0.87, QColor(162, 161, 220, 255)), QGradientStop(1, QColor(181, 174, 228, 255)));
+ case QGradient::LoveKiss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 8, 68, 255)), QGradientStop(1, QColor(255, 177, 153, 255)));
+ case QGradient::CleanMirror:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255)));
+ case QGradient::PremiumDark:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 67, 67, 255)), QGradientStop(1, QColor(0, 0, 0, 255)));
+ case QGradient::ColdEvening:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(12, 52, 131, 255)), QGradientStop(1, QColor(162, 182, 223, 255)), QGradientStop(1, QColor(107, 140, 206, 255)), QGradientStop(1, QColor(162, 182, 223, 255)));
+ case QGradient::CochitiLake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255)));
+ case QGradient::SummerGames:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(146, 254, 157, 255)), QGradientStop(1, QColor(0, 201, 255, 255)));
+ case QGradient::PassionateBed:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 117, 140, 255)), QGradientStop(1, QColor(255, 126, 179, 255)));
+ case QGradient::MountainRock:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(134, 143, 150, 255)), QGradientStop(1, QColor(89, 97, 100, 255)));
+ case QGradient::DesertHump:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 144, 129, 255)), QGradientStop(1, QColor(223, 165, 121, 255)));
+ case QGradient::JungleDay:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(139, 170, 170, 255)), QGradientStop(1, QColor(174, 139, 156, 255)));
+ case QGradient::PhoenixStart:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(248, 54, 0, 255)), QGradientStop(1, QColor(249, 212, 35, 255)));
+ case QGradient::OctoberSilence:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 33, 255, 255)), QGradientStop(1, QColor(33, 212, 253, 255)));
+ case QGradient::FarawayRiver:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(110, 69, 226, 255)), QGradientStop(1, QColor(136, 211, 206, 255)));
+ case QGradient::AlchemistLab:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 88, 200, 255)), QGradientStop(1, QColor(36, 210, 146, 255)));
+ case QGradient::OverSun:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(171, 236, 214, 255)), QGradientStop(1, QColor(251, 237, 150, 255)));
+ case QGradient::PremiumWhite:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 212, 208, 255)), QGradientStop(0.01, QColor(213, 212, 208, 255)), QGradientStop(0.31, QColor(238, 238, 236, 255)), QGradientStop(0.75, QColor(239, 238, 236, 255)), QGradientStop(1, QColor(233, 233, 231, 255)));
+ case QGradient::MarsParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(95, 114, 189, 255)), QGradientStop(1, QColor(155, 35, 234, 255)));
+ case QGradient::EternalConstance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(9, 32, 63, 255)), QGradientStop(1, QColor(83, 120, 149, 255)));
+ case QGradient::JapanBlush:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(221, 214, 243, 255)), QGradientStop(1, QColor(250, 172, 168, 255)), QGradientStop(1, QColor(250, 172, 168, 255)));
+ case QGradient::SmilingRain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(220, 176, 237, 255)), QGradientStop(1, QColor(153, 201, 156, 255)));
+ case QGradient::CloudyApple:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(243, 231, 233, 255)), QGradientStop(0.99, QColor(227, 238, 255, 255)), QGradientStop(1, QColor(227, 238, 255, 255)));
+ case QGradient::BigMango:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 29, 111, 255)), QGradientStop(1, QColor(208, 150, 147, 255)));
+ case QGradient::HealthyWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 222, 218, 255)), QGradientStop(1, QColor(80, 201, 195, 255)));
+ case QGradient::AmourAmour:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 112, 98, 255)), QGradientStop(1, QColor(254, 81, 150, 255)));
+ case QGradient::RiskyConcrete:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 197, 199, 255)), QGradientStop(0.52, QColor(220, 221, 223, 255)), QGradientStop(1, QColor(235, 235, 235, 255)));
+ case QGradient::StrongStick:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 202, 186, 255)), QGradientStop(1, QColor(93, 65, 87, 255)));
+ case QGradient::ViciousStance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(41, 50, 60, 255)), QGradientStop(1, QColor(72, 85, 99, 255)));
+ case QGradient::PaloAlto:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(22, 160, 133, 255)), QGradientStop(1, QColor(244, 208, 63, 255)));
+ case QGradient::HappyMemories:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 88, 88, 255)), QGradientStop(1, QColor(240, 152, 25, 255)));
+ case QGradient::MidnightBloom:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(43, 88, 118, 255)), QGradientStop(1, QColor(78, 67, 118, 255)));
+ case QGradient::Crystalline:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 205, 172, 255)), QGradientStop(1, QColor(141, 218, 213, 255)));
+ case QGradient::PartyBliss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255)));
+ case QGradient::ConfidentCloud:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(218, 212, 236, 255)), QGradientStop(0.01, QColor(218, 212, 236, 255)), QGradientStop(1, QColor(243, 231, 233, 255)));
+ case QGradient::LeCocktail:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(135, 77, 162, 255)), QGradientStop(1, QColor(196, 58, 48, 255)));
+ case QGradient::RiverCity:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255)));
+ case QGradient::FrozenBerry:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(232, 25, 139, 255)), QGradientStop(1, QColor(199, 234, 253, 255)));
+ case QGradient::ChildCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 148, 164, 255)), QGradientStop(1, QColor(253, 214, 189, 255)));
+ case QGradient::FlyingLemon:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(100, 179, 244, 255)), QGradientStop(1, QColor(194, 229, 156, 255)));
+ case QGradient::NewRetrowave:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(59, 65, 197, 255)), QGradientStop(0.49, QColor(169, 129, 187, 255)), QGradientStop(1, QColor(255, 200, 169, 255)));
+ case QGradient::HiddenJaguar:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(15, 216, 80, 255)), QGradientStop(1, QColor(249, 240, 71, 255)));
+ case QGradient::AboveTheSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(211, 211, 211, 255)), QGradientStop(0.01, QColor(211, 211, 211, 255)), QGradientStop(0.26, QColor(224, 224, 224, 255)), QGradientStop(0.48, QColor(239, 239, 239, 255)), QGradientStop(0.75, QColor(217, 217, 217, 255)), QGradientStop(1, QColor(188, 188, 188, 255)));
+ case QGradient::Nega:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 156, 167, 255)), QGradientStop(1, QColor(255, 221, 225, 255)));
+ case QGradient::DenseWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(58, 181, 176, 255)), QGradientStop(0.31, QColor(61, 153, 190, 255)), QGradientStop(1, QColor(86, 49, 122, 255)));
+ case QGradient::Seashore:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 156, 255, 255)), QGradientStop(1, QColor(104, 224, 207, 255)));
+ case QGradient::MarbleWall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(189, 194, 232, 255)), QGradientStop(0.01, QColor(189, 194, 232, 255)), QGradientStop(1, QColor(230, 222, 233, 255)));
+ case QGradient::CheerfulCaramel:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 185, 128, 255)), QGradientStop(1, QColor(234, 205, 163, 255)));
+ case QGradient::NightSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(30, 60, 114, 255)), QGradientStop(0.01, QColor(30, 60, 114, 255)), QGradientStop(1, QColor(42, 82, 152, 255)));
+ case QGradient::MagicLake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 222, 231, 255)), QGradientStop(0, QColor(255, 175, 189, 255)), QGradientStop(1, QColor(201, 255, 191, 255)));
+ case QGradient::YoungGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(155, 225, 93, 255)), QGradientStop(1, QColor(0, 227, 174, 255)));
+ case QGradient::ColorfulPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255)));
+ case QGradient::GentleCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 195, 160, 255)), QGradientStop(1, QColor(255, 175, 189, 255)));
+ case QGradient::PlumBath:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(204, 32, 142, 255)), QGradientStop(1, QColor(103, 19, 210, 255)));
+ case QGradient::HappyUnicorn:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(179, 255, 171, 255)), QGradientStop(1, QColor(18, 255, 247, 255)));
+ case QGradient::AfricanField:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 189, 96, 255)), QGradientStop(0.25, QColor(90, 193, 168, 255)), QGradientStop(0.5, QColor(62, 198, 237, 255)), QGradientStop(0.75, QColor(183, 221, 183, 255)), QGradientStop(1, QColor(254, 243, 129, 255)));
+ case QGradient::SolidStone:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(36, 57, 73, 255)), QGradientStop(1, QColor(81, 127, 164, 255)));
+ case QGradient::OrangeJuice:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 96, 118, 255)), QGradientStop(1, QColor(255, 154, 68, 255)));
+ case QGradient::GlassWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 233, 243, 255)), QGradientStop(1, QColor(255, 255, 255, 255)));
+ case QGradient::NorthMiracle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 219, 222, 255)), QGradientStop(1, QColor(252, 0, 255, 255)));
+ case QGradient::FruitBlend:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(249, 212, 35, 255)), QGradientStop(1, QColor(255, 78, 80, 255)));
+ case QGradient::MillenniumPine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 204, 127, 255)), QGradientStop(1, QColor(245, 209, 0, 255)));
+ case QGradient::HighFlight:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(10, 207, 254, 255)), QGradientStop(1, QColor(73, 90, 255, 255)));
+ case QGradient::MoleHall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(97, 97, 97, 255)), QGradientStop(1, QColor(155, 197, 195, 255)));
+ case QGradient::SpaceShift:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 51, 147, 255)), QGradientStop(0.37, QColor(43, 118, 185, 255)), QGradientStop(0.65, QColor(44, 172, 209, 255)), QGradientStop(1, QColor(53, 235, 147, 255)));
+ case QGradient::ForestInei:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 137, 181, 255)), QGradientStop(1, QColor(191, 217, 254, 255)));
+ case QGradient::RoyalGarden:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255)));
+ case QGradient::RichMetal:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(215, 210, 204, 255)), QGradientStop(1, QColor(48, 67, 82, 255)));
+ case QGradient::JuicyCake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(225, 79, 173, 255)), QGradientStop(1, QColor(249, 212, 35, 255)));
+ case QGradient::SmartIndigo:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(178, 36, 239, 255)), QGradientStop(1, QColor(117, 121, 255, 255)));
+ case QGradient::SandStrike:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(1, QColor(212, 212, 177, 255)));
+ case QGradient::NorseBeauty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(236, 119, 171, 255)), QGradientStop(1, QColor(120, 115, 245, 255)));
+ case QGradient::AquaGuidance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 122, 223, 255)), QGradientStop(1, QColor(0, 236, 188, 255)));
+ case QGradient::SunVeggie:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 226, 215, 255)), QGradientStop(1, QColor(249, 254, 165, 255)));
+ case QGradient::SeaLord:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.56, QColor(197, 193, 255, 255)), QGradientStop(1, QColor(255, 186, 195, 255)));
+ case QGradient::BlackSea:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.48, QColor(107, 141, 214, 255)), QGradientStop(1, QColor(142, 55, 215, 255)));
+ case QGradient::GrassShampoo:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 255, 205, 255)), QGradientStop(0.48, QColor(144, 249, 196, 255)), QGradientStop(1, QColor(57, 243, 187, 255)));
+ case QGradient::LandingAircraft:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(93, 159, 255, 255)), QGradientStop(0.48, QColor(184, 220, 255, 255)), QGradientStop(1, QColor(107, 187, 255, 255)));
+ case QGradient::WitchDance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 191, 255, 255)), QGradientStop(1, QColor(136, 77, 128, 255)));
+ case QGradient::SleeplessNight:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(82, 113, 196, 255)), QGradientStop(0.48, QColor(177, 159, 255, 255)), QGradientStop(1, QColor(236, 161, 254, 255)));
+ case QGradient::AngelCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 226, 159, 255)), QGradientStop(0.48, QColor(255, 169, 159, 255)), QGradientStop(1, QColor(255, 113, 154, 255)));
+ case QGradient::CrystalRiver:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(34, 225, 255, 255)), QGradientStop(0.48, QColor(29, 143, 225, 255)), QGradientStop(1, QColor(98, 94, 177, 255)));
+ case QGradient::SoftLipstick:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(182, 206, 232, 255)), QGradientStop(1, QColor(245, 120, 220, 255)));
+ case QGradient::SaltMountain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 254, 255, 255)), QGradientStop(1, QColor(215, 255, 254, 255)));
+ case QGradient::PerfectWhite:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(227, 253, 245, 255)), QGradientStop(1, QColor(255, 230, 250, 255)));
+ case QGradient::FreshOasis:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(125, 226, 252, 255)), QGradientStop(1, QColor(185, 182, 229, 255)));
+ case QGradient::StrictNovember:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(203, 186, 204, 255)), QGradientStop(1, QColor(37, 128, 179, 255)));
+ case QGradient::MorningSalad:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 248, 219, 255)), QGradientStop(1, QColor(80, 167, 194, 255)));
+ case QGradient::DeepRelief:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 133, 182, 255)), QGradientStop(0.5, QColor(135, 167, 217, 255)), QGradientStop(1, QColor(222, 243, 248, 255)));
+ case QGradient::SeaStrike:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 255, 210, 255)), QGradientStop(0.48, QColor(98, 151, 219, 255)), QGradientStop(1, QColor(30, 236, 255, 255)));
+ case QGradient::NightCall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 50, 228, 255)), QGradientStop(0.48, QColor(121, 24, 242, 255)), QGradientStop(1, QColor(72, 1, 255, 255)));
+ case QGradient::SupremeSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 255, 236, 255)), QGradientStop(0.48, QColor(87, 242, 204, 255)), QGradientStop(1, QColor(69, 150, 251, 255)));
+ case QGradient::LightBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(158, 251, 211, 255)), QGradientStop(0.48, QColor(87, 233, 242, 255)), QGradientStop(1, QColor(69, 212, 251, 255)));
+ case QGradient::MindCrawl:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(71, 59, 123, 255)), QGradientStop(0.51, QColor(53, 132, 167, 255)), QGradientStop(1, QColor(48, 210, 190, 255)));
+ case QGradient::LilyMeadow:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 55, 155, 255)), QGradientStop(0.53, QColor(136, 106, 234, 255)), QGradientStop(1, QColor(100, 87, 198, 255)));
+ case QGradient::SugarLollipop:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(164, 69, 178, 255)), QGradientStop(0.52, QColor(212, 24, 114, 255)), QGradientStop(1, QColor(255, 0, 102, 255)));
+ case QGradient::SweetDessert:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 66, 178, 255)), QGradientStop(0.52, QColor(241, 128, 255, 255)), QGradientStop(1, QColor(253, 139, 217, 255)));
+ case QGradient::MagicRay:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 60, 172, 255)), QGradientStop(0.52, QColor(86, 43, 124, 255)), QGradientStop(1, QColor(43, 134, 197, 255)));
+ case QGradient::TeenParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.5, QColor(141, 11, 147, 255)), QGradientStop(1, QColor(50, 21, 117, 255)));
+ case QGradient::FrozenHeat:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.48, QColor(124, 100, 213, 255)), QGradientStop(1, QColor(76, 195, 255, 255)));
+ case QGradient::GagarinView:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(105, 234, 203, 255)), QGradientStop(0.48, QColor(234, 204, 248, 255)), QGradientStop(1, QColor(102, 84, 241, 255)));
+ case QGradient::FabledSunset:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(35, 21, 87, 255)), QGradientStop(0.29, QColor(68, 16, 122, 255)), QGradientStop(0.67, QColor(255, 19, 97, 255)), QGradientStop(1, QColor(255, 248, 0, 255)));
+ case QGradient::PerfectBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 78, 129, 255)), QGradientStop(0.48, QColor(87, 83, 201, 255)), QGradientStop(1, QColor(110, 127, 243, 255)));
+ case QGradient::NumPresets:
+ Q_UNREACHABLE();
+ }
+ Q_UNREACHABLE();
+ return {};
+}
+
+static Q_CONSTEXPR QGradient::QGradientData qt_preset_gradient_data[] = {
+ { { 0, 1, 1, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 0, 0.5, 1 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.341506, 1.09151, 0.658494, -0.0915064 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 1.09151, 0.841506, -0.0915064, 0.158494 } },
+ { { 1.09151, 0.841506, -0.0915064, 0.158494 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0, 0, 0, 0 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+};
+
+static void *qt_preset_gradient_dummy()
+{
+ union {void *p; uint i;};
+ p = 0;
+ i |= uint(QGradient::ObjectMode);
+ return p;
+}
diff --git a/src/gui/painting/webgradients.css b/src/gui/painting/webgradients.css
deleted file mode 100644
index 870866bb46..0000000000
--- a/src/gui/painting/webgradients.css
+++ /dev/null
@@ -1,909 +0,0 @@
-/*001 Warm Flame*/
-.warm_flame{
- background-image: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
-}
-
-/*002 Night Fade*/
-.night_fade{
- background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
-}
-
-/*003 Spring Warmth*/
-.spring_warmth{
- background-image: linear-gradient(to top, #fad0c4 0%, #fad0c4 1%, #ffd1ff 100%);
-}
-
-/*004 Juicy Peach*/
-.juicy_peach{
- background-image: linear-gradient(to right, #ffecd2 0%, #fcb69f 100%);
-}
-
-/*005 Young Passion*/
-.young_passion{
- background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
-}
-
-/*006 Lady Lips*/
-.lady_lips{
- background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
-}
-
-/*007 Sunny Morning*/
-.sunny_morning{
- background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
-}
-
-/*008 Rainy Ashville*/
-.rainy_ashville{
- background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);
-}
-
-/*009 Frozen Dreams*/
-.frozen_dreams{
- background-image: linear-gradient(to top, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%);
-}
-
-/*010 Winter Neva*/
-.winter_neva{
- background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
-}
-
-/*011 Dusty Grass*/
-.dusty_grass{
- background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%);
-}
-
-/*012 Tempting Azure*/
-.tempting_azure{
- background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
-}
-
-/*013 Heavy Rain*/
-.heavy_rain{
- background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
-}
-
-/*014 Amy Crisp*/
-.amy_crisp{
- background-image: linear-gradient(120deg, #a6c0fe 0%, #f68084 100%);
-}
-
-/*015 Mean Fruit*/
-.mean_fruit{
- background-image: linear-gradient(120deg, #fccb90 0%, #d57eeb 100%);
-}
-
-/*016 Deep Blue*/
-.deep_blue{
- background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
-}
-
-/*017 Ripe Malinka*/
-.ripe_malinka{
- background-image: linear-gradient(120deg, #f093fb 0%, #f5576c 100%);
-}
-
-/*018 Cloudy Knoxville*/
-.cloudy_knoxville{
- background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
-}
-
-/*019 Malibu Beach*/
-.malibu_beach{
- background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
-}
-
-/*020 New Life*/
-.new_life{
- background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%);
-}
-
-/*021 True Sunset*/
-.true_sunset{
- background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%);
-}
-
-/*022 Morpheus Den*/
-.morpheus_den{
- background-image: linear-gradient(to top, #30cfd0 0%, #330867 100%);
-}
-
-/*023 Rare Wind*/
-.rare_wind{
- background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%);
-}
-
-/*024 Near Moon*/
-.near_moon{
- background-image: linear-gradient(to top, #5ee7df 0%, #b490ca 100%);
-}
-
-/*025 Wild Apple*/
-.wild_apple{
- background-image: linear-gradient(to top, #d299c2 0%, #fef9d7 100%);
-}
-
-/*026 Saint Petersburg*/
-.saint_petersburg{
- background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
-}
-
-/*027 Arielle's Smile*/
-.arielles_smile{
- background-image: radial-gradient(circle 248px at center, #16d9e3 0%, #30c7ec 47%, #46aef7 100%);
-}
-
-/*028 Plum Plate*/
-.plum_plate{
- background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-}
-
-/*029 Everlasting Sky*/
-.everlasting_sky{
- background-image: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%);
-}
-
-/*030 Happy Fisher*/
-.happy_fisher{
- background-image: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%);
-}
-
-/*031 Blessing*/
-.blessing{
- background-image: linear-gradient(to top, #fddb92 0%, #d1fdff 100%);
-}
-
-/*032 Sharpeye Eagle*/
-.sharpeye_eagle{
- background-image: linear-gradient(to top, #9890e3 0%, #b1f4cf 100%);
-}
-
-/*033 Ladoga Bottom*/
-.ladoga_bottom{
- background-image: linear-gradient(to top, #ebc0fd 0%, #d9ded8 100%);
-}
-
-/*034 Lemon Gate*/
-.lemon_gate{
- background-image: linear-gradient(to top, #96fbc4 0%, #f9f586 100%);
-}
-
-/*035 Itmeo Branding*/
-.itmeo_branding{
- background-image: linear-gradient(180deg, #2af598 0%, #009efd 100%);
-}
-
-/*036 Zeus Miracle*/
-.zeus_miracle{
- background-image: linear-gradient(to top, #cd9cf2 0%, #f6f3ff 100%);
-}
-
-/*037 Old Hat*/
-.old_hat{
- background-image: linear-gradient(to right, #e4afcb 0%, #b8cbb8 0%, #b8cbb8 0%, #e2c58b 30%, #c2ce9c 64%, #7edbdc 100%);
-}
-
-/*038 Star Wine*/
-.star_wine{
- background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%);
-}
-
-/*039 Deep Blue*/
-.deep_blue{
- background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
-}
-
-/*040 Coup de Grace*/
-.coup_de_grace{
- background: #DCD9D4 linear-gradient(to bottom, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), radial-gradient(at 50% 0%, rgba(255, 255, 255, 0.10) 0%, rgba(0, 0, 0, 0.50) 50%);
- background-blend-mode: soft-light,screen;
-}
-
-/*041 Happy Acid*/
-.happy_acid{
- background-image: linear-gradient(to top, #37ecba 0%, #72afd3 100%);
-}
-
-/*042 Awesome Pine*/
-.awesome_pine{
- background-image: linear-gradient(to top, #ebbba7 0%, #cfc7f8 100%);
-}
-
-/*043 New York*/
-.new_york{
- background-image: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%);
-}
-
-/*044 Shy Rainbow*/
-.shy_rainbow{
- background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
-}
-
-/*045 Loon Crest*/
-.loon_crest{
- background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898;
- background-blend-mode: multiply,multiply;
-}
-
-/*046 Mixed Hopes*/
-.mixed_hopes{
- background-image: linear-gradient(to top, #c471f5 0%, #fa71cd 100%);
-}
-
-/*047 Fly High*/
-.fly_high{
- background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%);
-}
-
-/*048 Strong Bliss*/
-.strong_bliss{
- background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%);
-}
-
-/*049 Fresh Milk*/
-.fresh_milk{
- background-image: linear-gradient(to top, #feada6 0%, #f5efef 100%);
-}
-
-/*050 Snow Again*/
-.snow_again{
- background-image: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%);
-}
-
-/*051 February Ink*/
-.february_ink{
- background-image: linear-gradient(to top, #accbee 0%, #e7f0fd 100%);
-}
-
-/*052 Kind Steel*/
-.kind_steel{
- background-image: linear-gradient(-20deg, #e9defa 0%, #fbfcdb 100%);
-}
-
-/*053 Soft Grass*/
-.soft_grass{
- background-image: linear-gradient(to top, #c1dfc4 0%, #deecdd 100%);
-}
-
-/*054 Grown Early*/
-.grown_early{
- background-image: linear-gradient(to top, #0ba360 0%, #3cba92 100%);
-}
-
-/*055 Sharp Blues*/
-.sharp_blues{
- background-image: linear-gradient(to top, #00c6fb 0%, #005bea 100%);
-}
-
-/*056 Shady Water*/
-.shady_water{
- background-image: linear-gradient(to right, #74ebd5 0%, #9face6 100%);
-}
-
-/*057 Dirty Beauty*/
-.dirty_beauty{
- background-image: linear-gradient(to top, #6a85b6 0%, #bac8e0 100%);
-}
-
-/*058 Great Whale*/
-.great_whale{
- background-image: linear-gradient(to top, #a3bded 0%, #6991c7 100%);
-}
-
-/*059 Teen Notebook*/
-.teen_notebook{
- background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%);
-}
-
-/*060 Polite Rumors*/
-.polite_rumors{
- background-image: linear-gradient(to top, #a7a6cb 0%, #8989ba 52%, #8989ba 100%);
-}
-
-/*061 Sweet Period*/
-.sweet_period{
- background-image: linear-gradient(to top, #3f51b1 0%, #5a55ae 13%, #7b5fac 25%, #8f6aae 38%, #a86aa4 50%, #cc6b8e 62%, #f18271 75%, #f3a469 87%, #f7c978 100%);
-}
-
-/*062 Wide Matrix*/
-.wide_matrix{
- background-image: linear-gradient(to top, #fcc5e4 0%, #fda34b 15%, #ff7882 35%, #c8699e 52%, #7046aa 71%, #0c1db8 87%, #020f75 100%);
-}
-
-/*063 Soft Cherish*/
-.soft_cherish{
- background-image: linear-gradient(to top, #dbdcd7 0%, #dddcd7 24%, #e2c9cc 30%, #e7627d 46%, #b8235a 59%, #801357 71%, #3d1635 84%, #1c1a27 100%);
-}
-
-/*064 Red Salvation*/
-.red_salvation{
- background-image: linear-gradient(to top, #f43b47 0%, #453a94 100%);
-}
-
-/*065 Burning Spring*/
-.burning_spring{
- background-image: linear-gradient(to top, #4fb576 0%, #44c489 30%, #28a9ae 46%, #28a2b7 59%, #4c7788 71%, #6c4f63 86%, #432c39 100%);
-}
-
-/*066 Night Party*/
-.night_party{
- background-image: linear-gradient(to top, #0250c5 0%, #d43f8d 100%);
-}
-
-/*067 Sky Glider*/
-.sky_glider{
- background-image: linear-gradient(to top, #88d3ce 0%, #6e45e2 100%);
-}
-
-/*068 Heaven Peach*/
-.heaven_peach{
- background-image: linear-gradient(to top, #d9afd9 0%, #97d9e1 100%);
-}
-
-/*069 Purple Division*/
-.purple_division{
- background-image: linear-gradient(to top, #7028e4 0%, #e5b2ca 100%);
-}
-
-/*070 Aqua Splash*/
-.aqua_splash{
- background-image: linear-gradient(15deg, #13547a 0%, #80d0c7 100%);
-}
-
-/*071 Above Clouds*/
-.above_clouds{
- background-image: linear-gradient(to left, #BDBBBE 0%, #9D9EA3 100%), radial-gradient(88% 271%, rgba(255, 255, 255, 0.25) 0%, rgba(254, 254, 254, 0.25) 1%, rgba(0, 0, 0, 0.25) 100%), radial-gradient(50% 100%, rgba(255, 255, 255, 0.30) 0%, rgba(0, 0, 0, 0.30) 100%);
- background-blend-mode: normal, lighten, soft-light;
-}
-
-/*072 Spiky Naga*/
-.spiky_naga{
- background-image: linear-gradient(to top, #505285 0%, #585e92 12%, #65689f 25%, #7474b0 37%, #7e7ebb 50%, #8389c7 62%, #9795d4 75%, #a2a1dc 87%, #b5aee4 100%);
-}
-
-/*073 Love Kiss*/
-.love_kiss{
- background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%);
-}
-
-/*074 Sharp Glass*/
-.sharp_glass{
- background: #C9CCD3 linear-gradient(-180deg, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%);
- background-blend-mode: lighten;
-}
-
-/*075 Clean Mirror*/
-.clean_mirror{
- background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%);
-}
-
-/*076 Premium Dark*/
-.premium_dark{
- background-image: linear-gradient(to right, #434343 0%, black 100%);
-}
-
-/*077 Cold Evening*/
-.cold_evening{
- background-image: linear-gradient(to top, #0c3483 0%, #a2b6df 100%, #6b8cce 100%, #a2b6df 100%);
-}
-
-/*078 Cochiti Lake*/
-.cochiti_lake{
- background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%);
-}
-
-/*079 Summer Games*/
-.summer_games{
- background-image: linear-gradient(to right, #92fe9d 0%, #00c9ff 100%);
-}
-
-/*080 Passionate Bed*/
-.passionate_bed{
- background-image: linear-gradient(to right, #ff758c 0%, #ff7eb3 100%);
-}
-
-/*081 Mountain Rock*/
-.mountain_rock{
- background-image: linear-gradient(to right, #868f96 0%, #596164 100%);
-}
-
-/*082 Desert Hump*/
-.desert_hump{
- background-image: linear-gradient(to top, #c79081 0%, #dfa579 100%);
-}
-
-/*083 Jungle Day*/
-.jungle_day{
- background-image: linear-gradient(45deg, #8baaaa 0%, #ae8b9c 100%);
-}
-
-/*084 Phoenix Start*/
-.phoenix_start{
- background-image: linear-gradient(to right, #f83600 0%, #f9d423 100%);
-}
-
-/*085 October Silence*/
-.october_silence{
- background-image: linear-gradient(-20deg, #b721ff 0%, #21d4fd 100%);
-}
-
-/*086 Faraway River*/
-.faraway_river{
- background-image: linear-gradient(-20deg, #6e45e2 0%, #88d3ce 100%);
-}
-
-/*087 Alchemist Lab*/
-.alchemist_lab{
- background-image: linear-gradient(-20deg, #d558c8 0%, #24d292 100%);
-}
-
-/*088 Over Sun*/
-.over_sun{
- background-image: linear-gradient(60deg, #abecd6 0%, #fbed96 100%);
-}
-
-/*089 Premium White*/
-.premium_white{
- background-image: linear-gradient(to top, #d5d4d0 0%, #d5d4d0 1%, #eeeeec 31%, #efeeec 75%, #e9e9e7 100%);
-}
-
-/*090 Mars Party*/
-.mars_party{
- background-image: linear-gradient(to top, #5f72bd 0%, #9b23ea 100%);
-}
-
-/*091 Eternal Constance*/
-.eternal_constance{
- background-image: linear-gradient(to top, #09203f 0%, #537895 100%);
-}
-
-/*092 Japan Blush*/
-.japan_blush{
- background-image: linear-gradient(-20deg, #ddd6f3 0%, #faaca8 100%, #faaca8 100%);
-}
-
-/*093 Smiling Rain*/
-.smiling_rain{
- background-image: linear-gradient(-20deg, #dcb0ed 0%, #99c99c 100%);
-}
-
-/*094 Cloudy Apple*/
-.cloudy_apple{
- background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
-}
-
-/*095 Big Mango*/
-.big_mango{
- background-image: linear-gradient(to top, #c71d6f 0%, #d09693 100%);
-}
-
-/*096 Healthy Water*/
-.healthy_water{
- background-image: linear-gradient(60deg, #96deda 0%, #50c9c3 100%);
-}
-
-/*097 Amour Amour*/
-.amour_amour{
- background-image: linear-gradient(to top, #f77062 0%, #fe5196 100%);
-}
-
-/*098 Risky Concrete*/
-.risky_concrete{
- background-image: linear-gradient(to top, #c4c5c7 0%, #dcdddf 52%, #ebebeb 100%);
-}
-
-/*099 Strong Stick*/
-.strong_stick{
- background-image: linear-gradient(to right, #a8caba 0%, #5d4157 100%);
-}
-
-/*100 Vicious Stance*/
-.vicious_stance{
- background-image: linear-gradient(60deg, #29323c 0%, #485563 100%);
-}
-
-/*101 Palo Alto*/
-.palo_alto{
- background-image: linear-gradient(-60deg, #16a085 0%, #f4d03f 100%);
-}
-
-/*102 Happy Memories*/
-.happy_memories{
- background-image: linear-gradient(-60deg, #ff5858 0%, #f09819 100%);
-}
-
-/*103 Midnight Bloom*/
-.midnight_bloom{
- background-image: linear-gradient(-20deg, #2b5876 0%, #4e4376 100%);
-}
-
-/*104 Crystalline*/
-.crystalline{
- background-image: linear-gradient(-20deg, #00cdac 0%, #8ddad5 100%);
-}
-
-/*105 Raccoon Back*/
-.raccoon_back{
- background: linear-gradient(-180deg, #BCC5CE 0%, #929EAD 98%), radial-gradient(at top left, rgba(255,255,255,0.30) 0%, rgba(0,0,0,0.30) 100%);
- background-blend-mode: screen;
-}
-
-/*106 Party Bliss*/
-.party_bliss{
- background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%);
-}
-
-/*107 Confident Cloud*/
-.confident_cloud{
- background-image: linear-gradient(to top, #dad4ec 0%, #dad4ec 1%, #f3e7e9 100%);
-}
-
-/*108 Le Cocktail*/
-.le_cocktail{
- background-image: linear-gradient(45deg, #874da2 0%, #c43a30 100%);
-}
-
-/*109 River City*/
-.river_city{
- background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%);
-}
-
-/*110 Frozen Berry*/
-.frozen_berry{
- background-image: linear-gradient(to top, #e8198b 0%, #c7eafd 100%);
-}
-
-/*111 Elegance*/
-.elegance{
- background-image: radial-gradient(73% 147%, #EADFDF 59%, #ECE2DF 100%), radial-gradient(91% 146%, rgba(255,255,255,0.50) 47%, rgba(0,0,0,0.50) 100%);
- background-blend-mode: screen;
-}
-
-/*112 Child Care*/
-.child_care{
- background-image: linear-gradient(-20deg, #f794a4 0%, #fdd6bd 100%);
-}
-
-/*113 Flying Lemon*/
-.flying_lemon{
- background-image: linear-gradient(60deg, #64b3f4 0%, #c2e59c 100%);
-}
-
-/*114 New Retrowave*/
-.new_retrowave{
- background-image: linear-gradient(to top, #3b41c5 0%, #a981bb 49%, #ffc8a9 100%);
-}
-
-/*115 Hidden Jaguar*/
-.hidden_jaguar{
- background-image: linear-gradient(to top, #0fd850 0%, #f9f047 100%);
-}
-
-/*116 Above The Sky*/
-.above_the_sky{
- background-image: linear-gradient(to top, lightgrey 0%, lightgrey 1%, #e0e0e0 26%, #efefef 48%, #d9d9d9 75%, #bcbcbc 100%);
-}
-
-/*117 Nega*/
-.nega{
- background-image: linear-gradient(45deg, #ee9ca7 0%, #ffdde1 100%);
-}
-
-/*118 Dense Water*/
-.dense_water{
- background-image: linear-gradient(to right, #3ab5b0 0%, #3d99be 31%, #56317a 100%);
-}
-
-/*119 Chemic Aqua*/
-.chemic_aqua{
- background: #CDDCDC radial-gradient(at 50% 100%, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(0, 0, 0, 0.25) 100%);
- background-blend-mode: screen, overlay;
-}
-
-/*120 Seashore*/
-.seashore{
- background-image: linear-gradient(to top, #209cff 0%, #68e0cf 100%);
-}
-
-/*121 Marble Wall*/
-.marble_wall{
- background-image: linear-gradient(to top, #bdc2e8 0%, #bdc2e8 1%, #e6dee9 100%);
-}
-
-/*122 Cheerful Caramel*/
-.cheerful_caramel{
- background-image: linear-gradient(to top, #e6b980 0%, #eacda3 100%);
-}
-
-/*123 Night Sky*/
-.night_sky{
- background-image: linear-gradient(to top, #1e3c72 0%, #1e3c72 1%, #2a5298 100%);
-}
-
-/*124 Magic Lake*/
-.magic_lake{
- background-image: linear-gradient(to top, #d5dee7 0%, #ffafbd 0%, #c9ffbf 100%);
-}
-
-/*125 Young Grass*/
-.young_grass{
- background-image: linear-gradient(to top, #9be15d 0%, #00e3ae 100%);
-}
-
-/*126 Colorful Peach*/
-.colorful_peach{
- background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%);
-}
-
-/*127 Gentle Care*/
-.gentle_care{
- background-image: linear-gradient(to right, #ffc3a0 0%, #ffafbd 100%);
-}
-
-/*128 Plum Bath*/
-.plum_bath{
- background-image: linear-gradient(to top, #cc208e 0%, #6713d2 100%);
-}
-
-/*129 Happy Unicorn*/
-.happy_unicorn{
- background-image: linear-gradient(to top, #b3ffab 0%, #12fff7 100%);
-}
-
-/*130 Full Metal*/
-.full_metal{
- background: linear-gradient(to bottom, #D5DEE7 0%, #E8EBF2 50%, #E2E7ED 100%), linear-gradient(to bottom, rgba(0,0,0,0.02) 50%, rgba(255,255,255,0.02) 61%, rgba(0,0,0,0.02) 73%), linear-gradient(33deg, rgba(255,255,255,0.20) 0%, rgba(0,0,0,0.20) 100%);
- background-blend-mode: normal,color-burn;
-}
-
-/*131 African Field*/
-.african_field{
- background-image: linear-gradient(to top, #65bd60 0%, #5ac1a8 25%, #3ec6ed 50%, #b7ddb7 75%, #fef381 100%);
-}
-
-/*132 Solid Stone*/
-.solid_stone{
- background-image: linear-gradient(to right, #243949 0%, #517fa4 100%);
-}
-
-/*133 Orange Juice*/
-.orange_juice{
- background-image: linear-gradient(-20deg, #fc6076 0%, #ff9a44 100%);
-}
-
-/*134 Glass Water*/
-.glass_water{
- background-image: linear-gradient(to top, #dfe9f3 0%, white 100%);
-}
-
-/*135 Slick Carbon*/
-.slick_carbon{
- background: linear-gradient(to bottom, #323232 0%, #3F3F3F 40%, #1C1C1C 150%), linear-gradient(to top, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.25) 200%);
- background-blend-mode: multiply;
-}
-
-/*136 North Miracle*/
-.north_miracle{
- background-image: linear-gradient(to right, #00dbde 0%, #fc00ff 100%);
-}
-
-/*137 Fruit Blend*/
-.fruit_blend{
- background-image: linear-gradient(to right, #f9d423 0%, #ff4e50 100%);
-}
-
-/*138 Millennium Pine*/
-.millennium_pine{
- background-image: linear-gradient(to top, #50cc7f 0%, #f5d100 100%);
-}
-
-/*139 High Flight*/
-.high_flight{
- background-image: linear-gradient(to right, #0acffe 0%, #495aff 100%);
-}
-
-/*140 Mole Hall*/
-.mole_hall{
- background-image: linear-gradient(-20deg, #616161 0%, #9bc5c3 100%);
-}
-
-/*141 Earl Gray*/
-.earl_gray{
- background: #E4E4E1 radial-gradient(at top center, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.03) 100%), linear-gradient(to top, rgba(255, 255, 255, 0.1) 0%, rgba(143, 152, 157, 0.60) 100%);
- background-blend-mode: normal, multiply;
-}
-
-/*142 Space Shift*/
-.space_shift{
- background-image: linear-gradient(60deg, #3d3393 0%, #2b76b9 37%, #2cacd1 65%, #35eb93 100%);
-}
-
-/*143 Forest Inei*/
-.forest_inei{
- background-image: linear-gradient(to top, #df89b5 0%, #bfd9fe 100%);
-}
-
-/*144 Royal Garden*/
-.royal_garden{
- background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%);
-}
-
-/*145 Rich Metal*/
-.rich_metal{
- background-image: linear-gradient(to right, #d7d2cc 0%, #304352 100%);
-}
-
-/*146 Juicy Cake*/
-.juicy_cake{
- background-image: linear-gradient(to top, #e14fad 0%, #f9d423 100%);
-}
-
-/*147 Smart Indigo*/
-.smart_indigo{
- background-image: linear-gradient(to top, #b224ef 0%, #7579ff 100%);
-}
-
-/*148 Sand Strike*/
-.sand_strike{
- background-image: linear-gradient(to right, #c1c161 0%, #c1c161 0%, #d4d4b1 100%);
-}
-
-/*149 Norse Beauty*/
-.norse_beauty{
- background-image: linear-gradient(to right, #ec77ab 0%, #7873f5 100%);
-}
-
-/*150 Aqua Guidance*/
-.aqua_guidance{
- background-image: linear-gradient(to top, #007adf 0%, #00ecbc 100%);
-}
-
-/*151 Sun Veggie*/
-.sun_veggie{
- background-image: linear-gradient(-225deg, #20E2D7 0%, #F9FEA5 100%);
-}
-
-/*152 Sea Lord*/
-.sea_lord{
- background-image: linear-gradient(-225deg, #2CD8D5 0%, #C5C1FF 56%, #FFBAC3 100%);
-}
-
-/*153 Black Sea*/
-.black_sea{
- background-image: linear-gradient(-225deg, #2CD8D5 0%, #6B8DD6 48%, #8E37D7 100%);
-}
-
-/*154 Grass Shampoo*/
-.grass_shampoo{
- background-image: linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%);
-}
-
-/*155 Landing Aircraft*/
-.landing_aircraft{
- background-image: linear-gradient(-225deg, #5D9FFF 0%, #B8DCFF 48%, #6BBBFF 100%);
-}
-
-/*156 Witch Dance*/
-.witch_dance{
- background-image: linear-gradient(-225deg, #A8BFFF 0%, #884D80 100%);
-}
-
-/*157 Sleepless Night*/
-.sleepless_night{
- background-image: linear-gradient(-225deg, #5271C4 0%, #B19FFF 48%, #ECA1FE 100%);
-}
-
-/*158 Angel Care*/
-.angel_care{
- background-image: linear-gradient(-225deg, #FFE29F 0%, #FFA99F 48%, #FF719A 100%);
-}
-
-/*159 Crystal River*/
-.crystal_river{
- background-image: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%);
-}
-
-/*160 Soft Lipstick*/
-.soft_lipstick{
- background-image: linear-gradient(-225deg, #B6CEE8 0%, #F578DC 100%);
-}
-
-/*161 Salt Mountain*/
-.salt_mountain{
- background-image: linear-gradient(-225deg, #FFFEFF 0%, #D7FFFE 100%);
-}
-
-/*162 Perfect White*/
-.perfect_white{
- background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%);
-}
-
-/*163 Fresh Oasis*/
-.fresh_oasis{
- background-image: linear-gradient(-225deg, #7DE2FC 0%, #B9B6E5 100%);
-}
-
-/*164 Strict November*/
-.strict_november{
- background-image: linear-gradient(-225deg, #CBBACC 0%, #2580B3 100%);
-}
-
-/*165 Morning Salad*/
-.morning_salad{
- background-image: linear-gradient(-225deg, #B7F8DB 0%, #50A7C2 100%);
-}
-
-/*166 Deep Relief*/
-.deep_relief{
- background-image: linear-gradient(-225deg, #7085B6 0%, #87A7D9 50%, #DEF3F8 100%);
-}
-
-/*167 Sea Strike*/
-.sea_strike{
- background-image: linear-gradient(-225deg, #77FFD2 0%, #6297DB 48%, #1EECFF 100%);
-}
-
-/*168 Night Call*/
-.night_call{
- background-image: linear-gradient(-225deg, #AC32E4 0%, #7918F2 48%, #4801FF 100%);
-}
-
-/*169 Supreme Sky*/
-.supreme_sky{
- background-image: linear-gradient(-225deg, #D4FFEC 0%, #57F2CC 48%, #4596FB 100%);
-}
-
-/*170 Light Blue*/
-.light_blue{
- background-image: linear-gradient(-225deg, #9EFBD3 0%, #57E9F2 48%, #45D4FB 100%);
-}
-
-/*171 Mind Crawl*/
-.mind_crawl{
- background-image: linear-gradient(-225deg, #473B7B 0%, #3584A7 51%, #30D2BE 100%);
-}
-
-/*172 Lily Meadow*/
-.lily_meadow{
- background-image: linear-gradient(-225deg, #65379B 0%, #886AEA 53%, #6457C6 100%);
-}
-
-/*173 Sugar Lollipop*/
-.sugar_lollipop{
- background-image: linear-gradient(-225deg, #A445B2 0%, #D41872 52%, #FF0066 100%);
-}
-
-/*174 Sweet Dessert*/
-.sweet_dessert{
- background-image: linear-gradient(-225deg, #7742B2 0%, #F180FF 52%, #FD8BD9 100%);
-}
-
-/*175 Magic Ray*/
-.magic_ray{
- background-image: linear-gradient(-225deg, #FF3CAC 0%, #562B7C 52%, #2B86C5 100%);
-}
-
-/*176 Teen Party*/
-.teen_party{
- background-image: linear-gradient(-225deg, #FF057C 0%, #8D0B93 50%, #321575 100%);
-}
-
-/*177 Frozen Heat*/
-.frozen_heat{
- background-image: linear-gradient(-225deg, #FF057C 0%, #7C64D5 48%, #4CC3FF 100%);
-}
-
-/*178 Gagarin View*/
-.gagarin_view{
- background-image: linear-gradient(-225deg, #69EACB 0%, #EACCF8 48%, #6654F1 100%);
-}
-
-/*179 Fabled Sunset*/
-.fabled_sunset{
- background-image: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%);
-}
-
-/*180 Perfect Blue*/
-.perfect_blue{
- background-image: linear-gradient(-225deg, #3D4E81 0%, #5753C9 48%, #6E7FF3 100%);
-}
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 8ef98d2e42..58f30deb41 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -48,8 +48,7 @@
#ifdef Q_OS_WIN
#include "qrhid3d11_p_p.h"
#endif
-//#ifdef Q_OS_DARWIN
-#ifdef Q_OS_MACOS
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
#include "qrhimetal_p_p.h"
#endif
@@ -2161,6 +2160,32 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
*/
/*!
+ \class QRhiTexture::NativeTexture
+ \brief Contains information about the underlying native resources of a texture.
+ */
+
+/*!
+ \variable QRhiTexture::NativeTexture::object
+ \brief a pointer to the native object handle.
+
+ With OpenGL, the native handle is a GLuint value, so \c object is then a
+ pointer to a GLuint. With Vulkan, the native handle is a VkImage, so \c
+ object is a pointer to a VkImage. With Direct3D 11 and Metal \c
+ object is a pointer to a ID3D11Texture2D or MTLTexture pointer, respectively.
+
+ \note Pay attention to the fact that \a object is always a pointer
+ to the native texture handle type, even if the native type itself is a
+ pointer.
+ */
+
+/*!
+ \variable QRhiTexture::NativeTexture::layout
+ \brief Specifies the current image layout for APIs like Vulkan.
+
+ For Vulkan, \c layout contains a \c VkImageLayout value.
+ */
+
+/*!
\internal
*/
QRhiTexture::QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_,
@@ -2197,12 +2222,25 @@ QRhiResource::Type QRhiTexture::resourceType() const
\sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
*/
+// TODO: remove this version once QtQuick has stopped using it
const QRhiNativeHandles *QRhiTexture::nativeHandles()
{
return nullptr;
}
/*!
+ \return the underlying native resources for this texture. The returned value
+ will be empty if exposing the underlying native resources is not supported by
+ the backend.
+
+ \sa buildFrom()
+ */
+QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
+{
+ return {};
+}
+
+/*!
Similar to build() except that no new native textures are created. Instead,
the texture from \a src is used.
@@ -2225,6 +2263,7 @@ const QRhiNativeHandles *QRhiTexture::nativeHandles()
\sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
*/
+// TODO: remove this version once QtQuick has stopped using it
bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
{
Q_UNUSED(src);
@@ -2232,6 +2271,33 @@ bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
}
/*!
+ Similar to build() except that no new native textures are created. Instead,
+ the native texture resources specified by \a src is used.
+
+ This allows importing an existing native texture object (which must belong
+ to the same device or sharing context, depending on the graphics API) from
+ an external graphics engine.
+
+ \note format(), pixelSize(), sampleCount(), and flags() must still be set
+ correctly. Passing incorrect sizes and other values to QRhi::newTexture()
+ and then following it with a buildFrom() expecting that the native texture
+ object alone is sufficient to deduce such values is \b wrong and will lead
+ to problems.
+
+ \note QRhiTexture does not take ownership of the texture object. release()
+ does not free the object or any associated memory.
+
+ The opposite of this operation, exposing a QRhiTexture-created native
+ texture object to a foreign engine, is possible via nativeTexture().
+
+*/
+bool QRhiTexture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ Q_UNUSED(src);
+ return false;
+}
+
+/*!
\class QRhiSampler
\internal
\inmodule QtGui
@@ -2253,9 +2319,7 @@ bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
\value Repeat
\value ClampToEdge
- \value Border
\value Mirror
- \value MirrorOnce
*/
/*!
@@ -2322,6 +2386,24 @@ QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const
}
/*!
+ \fn bool QRhiRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const;
+
+ \return true if the \a other QRhiRenderPassDescriptor is compatible with
+ this one, meaning \c this and \a other can be used interchangebly in
+ QRhiGraphicsPipeline::setRenderPassDescriptor().
+
+ The concept of the compatibility of renderpass descriptors is similar to
+ the \l{QRhiShaderResourceBindings::isLayoutCompatible}{layout
+ compatibility} of QRhiShaderResourceBindings instances. They allow better
+ reuse of QRhiGraphicsPipeline instances: for example, a
+ QRhiGraphicsPipeline instance cache is expected to use these functions to
+ look for a matching pipeline, instead of just comparing pointers, thus
+ allowing a different QRhiRenderPassDescriptor and
+ QRhiShaderResourceBindings to be used in combination with the pipeline, as
+ long as they are compatible.
+ */
+
+/*!
\return a pointer to a backend-specific QRhiNativeHandles subclass, such as
QRhiVulkanRenderPassNativeHandles. The returned value is null when exposing
the underlying native resources is not supported by the backend.
@@ -4049,8 +4131,7 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
break;
#endif
case Metal:
-//#ifdef Q_OS_DARWIN
-#ifdef Q_OS_MACOS
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
static_cast<QRhiMetalNativeHandles *>(importDevice));
break;
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 588347d111..44118b2f10 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -760,6 +760,11 @@ public:
ASTC_12x12
};
+ struct NativeTexture {
+ const void *object;
+ int layout;
+ };
+
QRhiResource::Type resourceType() const override;
Format format() const { return m_format; }
@@ -776,7 +781,9 @@ public:
virtual bool build() = 0;
virtual const QRhiNativeHandles *nativeHandles();
+ virtual NativeTexture nativeTexture();
virtual bool buildFrom(const QRhiNativeHandles *src);
+ virtual bool buildFrom(NativeTexture src);
protected:
QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_,
@@ -801,9 +808,7 @@ public:
enum AddressMode {
Repeat,
ClampToEdge,
- Border,
Mirror,
- MirrorOnce
};
enum CompareOp {
@@ -902,6 +907,7 @@ class Q_GUI_EXPORT QRhiRenderPassDescriptor : public QRhiResource
public:
QRhiResource::Type resourceType() const override;
+ virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const = 0;
virtual const QRhiNativeHandles *nativeHandles();
protected:
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index 5e576e9c6a..ba2488bffb 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -2764,11 +2764,39 @@ bool QD3D11Texture::buildFrom(const QRhiNativeHandles *src)
return true;
}
+bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ auto *srcTex = static_cast<ID3D11Texture2D * const *>(src.object);
+ if (!srcTex || !*srcTex)
+ return false;
+
+ if (!prepareBuild())
+ return false;
+
+ tex = *srcTex;
+
+ if (!finishBuild())
+ return false;
+
+ QRHI_PROF;
+ QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count)));
+
+ owns = false;
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->registerResource(this);
+ return true;
+}
+
const QRhiNativeHandles *QD3D11Texture::nativeHandles()
{
return &nativeHandlesStruct;
}
+QRhiTexture::NativeTexture QD3D11Texture::nativeTexture()
+{
+ return {&nativeHandlesStruct.texture, 0};
+}
+
ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
{
if (perLevelViews[level])
@@ -2862,12 +2890,8 @@ static inline D3D11_TEXTURE_ADDRESS_MODE toD3DAddressMode(QRhiSampler::AddressMo
return D3D11_TEXTURE_ADDRESS_WRAP;
case QRhiSampler::ClampToEdge:
return D3D11_TEXTURE_ADDRESS_CLAMP;
- case QRhiSampler::Border:
- return D3D11_TEXTURE_ADDRESS_BORDER;
case QRhiSampler::Mirror:
return D3D11_TEXTURE_ADDRESS_MIRROR;
- case QRhiSampler::MirrorOnce:
- return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE;
default:
Q_UNREACHABLE();
return D3D11_TEXTURE_ADDRESS_CLAMP;
@@ -2944,6 +2968,12 @@ void QD3D11RenderPassDescriptor::release()
// nothing to do here
}
+bool QD3D11RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ Q_UNUSED(other);
+ return true;
+}
+
QD3D11ReferenceRenderTarget::QD3D11ReferenceRenderTarget(QRhiImplementation *rhi)
: QRhiRenderTarget(rhi),
d(rhi)
diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h
index 26de34ae0a..8f02c4300b 100644
--- a/src/gui/rhi/qrhid3d11_p_p.h
+++ b/src/gui/rhi/qrhid3d11_p_p.h
@@ -100,7 +100,9 @@ struct QD3D11Texture : public QRhiTexture
void release() override;
bool build() override;
bool buildFrom(const QRhiNativeHandles *src) override;
+ bool buildFrom(NativeTexture src) override;
const QRhiNativeHandles *nativeHandles() override;
+ NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
bool finishBuild();
@@ -136,6 +138,7 @@ struct QD3D11RenderPassDescriptor : public QRhiRenderPassDescriptor
QD3D11RenderPassDescriptor(QRhiImplementation *rhi);
~QD3D11RenderPassDescriptor();
void release() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
struct QD3D11RenderTargetData
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index b394354787..ffaccbad71 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -1785,11 +1785,6 @@ static inline GLenum toGlWrapMode(QRhiSampler::AddressMode m)
return GL_CLAMP_TO_EDGE;
case QRhiSampler::Mirror:
return GL_MIRRORED_REPEAT;
- case QRhiSampler::MirrorOnce:
- Q_FALLTHROUGH();
- case QRhiSampler::Border:
- qWarning("Unsupported wrap mode %d", m);
- return GL_CLAMP_TO_EDGE;
default:
Q_UNREACHABLE();
return GL_CLAMP_TO_EDGE;
@@ -2383,12 +2378,23 @@ void QRhiGles2::executeBindGraphicsPipeline(QRhiGraphicsPipeline *ps)
f->glUseProgram(psD->program);
}
+static inline void qrhi_std140_to_packed(float *dst, int vecSize, int elemCount, const void *src)
+{
+ const float *p = reinterpret_cast<const float *>(src);
+ for (int i = 0; i < elemCount; ++i) {
+ for (int j = 0; j < vecSize; ++j)
+ dst[vecSize * i + j] = *p++;
+ p += 4 - vecSize;
+ }
+}
+
void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
QRhiShaderResourceBindings *srb,
const uint *dynOfsPairs, int dynOfsCount)
{
QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, srb);
int texUnit = 0;
+ QVarLengthArray<float, 256> packedFloatArray;
for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) {
const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data();
@@ -2416,24 +2422,78 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
// so this should not cause unaligned reads
const void *src = bufView.constData() + uniform.offset;
+ if (uniform.arrayDim > 0
+ && uniform.type != QShaderDescription::Float
+ && uniform.type != QShaderDescription::Vec2
+ && uniform.type != QShaderDescription::Vec3
+ && uniform.type != QShaderDescription::Vec4)
+ {
+ qWarning("Uniform with buffer binding %d, buffer offset %d, type %d is an array, "
+ "but arrays are only supported for float, vec2, vec3, and vec4. "
+ "Only the first element will be set.",
+ uniform.binding, uniform.offset, uniform.type);
+ }
+
+ // Our input is an std140 layout uniform block. See
+ // "Standard Uniform Block Layout" in section 7.6.2.2 of
+ // the OpenGL spec. This has some peculiar alignment
+ // requirements, which is not what glUniform* wants. Hence
+ // the unpacking/repacking for arrays and certain types.
+
switch (uniform.type) {
case QShaderDescription::Float:
- f->glUniform1f(uniform.glslLocation, *reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform1f(uniform.glslLocation, *reinterpret_cast<const float *>(src));
+ } else {
+ // input is 16 bytes per element as per std140, have to convert to packed
+ packedFloatArray.resize(elemCount);
+ qrhi_std140_to_packed(packedFloatArray.data(), 1, elemCount, src);
+ f->glUniform1fv(uniform.glslLocation, elemCount, packedFloatArray.constData());
+ }
+ }
break;
case QShaderDescription::Vec2:
- f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ } else {
+ packedFloatArray.resize(elemCount * 2);
+ qrhi_std140_to_packed(packedFloatArray.data(), 2, elemCount, src);
+ f->glUniform2fv(uniform.glslLocation, elemCount, packedFloatArray.constData());
+ }
+ }
break;
case QShaderDescription::Vec3:
- f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ } else {
+ packedFloatArray.resize(elemCount * 3);
+ qrhi_std140_to_packed(packedFloatArray.data(), 3, elemCount, src);
+ f->glUniform3fv(uniform.glslLocation, elemCount, packedFloatArray.constData());
+ }
+ }
break;
case QShaderDescription::Vec4:
- f->glUniform4fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ f->glUniform4fv(uniform.glslLocation, qMax(1, uniform.arrayDim), reinterpret_cast<const float *>(src));
break;
case QShaderDescription::Mat2:
f->glUniformMatrix2fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
break;
case QShaderDescription::Mat3:
- f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
+ {
+ // 4 floats per column (or row, if row-major)
+ float mat[9];
+ const float *srcMat = reinterpret_cast<const float *>(src);
+ memcpy(mat, srcMat, 3 * sizeof(float));
+ memcpy(mat + 3, srcMat + 4, 3 * sizeof(float));
+ memcpy(mat + 6, srcMat + 8, 3 * sizeof(float));
+ f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, mat);
+ }
break;
case QShaderDescription::Mat4:
f->glUniformMatrix4fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
@@ -2474,8 +2534,9 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
case QShaderDescription::Bool4:
f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
break;
- // ### more types
default:
+ qWarning("Uniform with buffer binding %d, buffer offset %d has unsupported type %d",
+ uniform.binding, uniform.offset, uniform.type);
break;
}
}
@@ -2924,21 +2985,65 @@ bool QRhiGles2::linkProgram(GLuint program)
return true;
}
-void QRhiGles2::gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
+void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable &var,
+ const QByteArray &namePrefix,
+ int binding,
+ int baseOffset,
+ GLuint program,
+ QVector<QGles2UniformDescription> *dst)
+{
+ if (var.type == QShaderDescription::Struct) {
+ qWarning("Nested structs are not supported at the moment. '%s' ignored.",
+ qPrintable(var.name));
+ return;
+ }
+ QGles2UniformDescription uniform;
+ uniform.type = var.type;
+ const QByteArray name = namePrefix + var.name.toUtf8();
+ uniform.glslLocation = f->glGetUniformLocation(program, name.constData());
+ if (uniform.glslLocation >= 0) {
+ if (var.arrayDims.count() > 1) {
+ qWarning("Array '%s' has more than one dimension. This is not supported.",
+ qPrintable(var.name));
+ return;
+ }
+ uniform.binding = binding;
+ uniform.offset = uint(baseOffset + var.offset);
+ uniform.size = var.size;
+ uniform.arrayDim = var.arrayDims.isEmpty() ? 0 : var.arrayDims.first();
+ dst->append(uniform);
+ }
+}
+
+void QRhiGles2::gatherUniforms(GLuint program,
+ const QShaderDescription::UniformBlock &ub,
QVector<QGles2UniformDescription> *dst)
{
- const QByteArray prefix = ub.structName.toUtf8() + '.';
+ QByteArray prefix = ub.structName.toUtf8() + '.';
for (const QShaderDescription::BlockVariable &blockMember : ub.members) {
- // ### no array support for now
- QGles2UniformDescription uniform;
- uniform.type = blockMember.type;
- const QByteArray name = prefix + blockMember.name.toUtf8();
- uniform.glslLocation = f->glGetUniformLocation(program, name.constData());
- if (uniform.glslLocation >= 0) {
- uniform.binding = ub.binding;
- uniform.offset = uint(blockMember.offset);
- uniform.size = blockMember.size;
- dst->append(uniform);
+ if (blockMember.type == QShaderDescription::Struct) {
+ prefix += blockMember.name.toUtf8();
+ const int baseOffset = blockMember.offset;
+ if (blockMember.arrayDims.isEmpty()) {
+ for (const QShaderDescription::BlockVariable &structMember : blockMember.structMembers)
+ registerUniformIfActive(structMember, prefix, ub.binding, baseOffset, program, dst);
+ } else {
+ if (blockMember.arrayDims.count() > 1) {
+ qWarning("Array of struct '%s' has more than one dimension. Only the first dimension is used.",
+ qPrintable(blockMember.name));
+ }
+ const int dim = blockMember.arrayDims.first();
+ const int elemSize = blockMember.size / dim;
+ int elemOffset = baseOffset;
+ for (int di = 0; di < dim; ++di) {
+ const QByteArray arrayPrefix = prefix + '[' + QByteArray::number(di) + ']' + '.';
+ for (const QShaderDescription::BlockVariable &structMember : blockMember.structMembers)
+ registerUniformIfActive(structMember, arrayPrefix, ub.binding, elemOffset, program, dst);
+ elemOffset += elemSize;
+ }
+ }
+ } else {
+ registerUniformIfActive(blockMember, prefix, ub.binding, 0, program, dst);
}
}
}
@@ -3409,11 +3514,40 @@ bool QGles2Texture::buildFrom(const QRhiNativeHandles *src)
return true;
}
+bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ const uint *textureId = static_cast<const uint *>(src.object);
+ if (!textureId || !*textureId)
+ return false;
+
+ if (!prepareBuild())
+ return false;
+
+ texture = *textureId;
+ specified = true;
+
+ QRHI_RES_RHI(QRhiGles2);
+ QRHI_PROF;
+ QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
+
+ owns = false;
+ nativeHandlesStruct.texture = texture;
+
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
const QRhiNativeHandles *QGles2Texture::nativeHandles()
{
return &nativeHandlesStruct;
}
+QRhiTexture::NativeTexture QGles2Texture::nativeTexture()
+{
+ return {&nativeHandlesStruct.texture, 0};
+}
+
QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v)
: QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
@@ -3459,6 +3593,12 @@ void QGles2RenderPassDescriptor::release()
// nothing to do here
}
+bool QGles2RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ Q_UNUSED(other);
+ return true;
+}
+
QGles2ReferenceRenderTarget::QGles2ReferenceRenderTarget(QRhiImplementation *rhi)
: QRhiRenderTarget(rhi),
d(rhi)
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h
index cc945876e6..d4f1336c3e 100644
--- a/src/gui/rhi/qrhigles2_p_p.h
+++ b/src/gui/rhi/qrhigles2_p_p.h
@@ -133,7 +133,9 @@ struct QGles2Texture : public QRhiTexture
void release() override;
bool build() override;
bool buildFrom(const QRhiNativeHandles *src) override;
+ bool buildFrom(NativeTexture src) override;
const QRhiNativeHandles *nativeHandles() override;
+ NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -185,6 +187,7 @@ struct QGles2RenderPassDescriptor : public QRhiRenderPassDescriptor
QGles2RenderPassDescriptor(QRhiImplementation *rhi);
~QGles2RenderPassDescriptor();
void release() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
struct QGles2RenderTargetData
@@ -249,6 +252,7 @@ struct QGles2UniformDescription
int binding;
uint offset;
int size;
+ int arrayDim;
};
Q_DECLARE_TYPEINFO(QGles2UniformDescription, Q_MOVABLE_TYPE);
@@ -703,7 +707,14 @@ public:
QByteArray shaderSource(const QRhiShaderStage &shaderStage, int *glslVersion);
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, int *glslVersion);
bool linkProgram(GLuint program);
- void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
+ void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
+ const QByteArray &namePrefix,
+ int binding,
+ int baseOffset,
+ GLuint program,
+ QVector<QGles2UniformDescription> *dst);
+ void gatherUniforms(GLuint program,
+ const QShaderDescription::UniformBlock &ub,
QVector<QGles2UniformDescription> *dst);
void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
QVector<QGles2SamplerDescription> *dst);
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 3ecc56d147..b6ca40e08b 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -41,6 +41,8 @@
#ifdef Q_OS_MACOS
#include <AppKit/AppKit.h>
+#else
+#include <UIKit/UIKit.h>
#endif
#include <Metal/Metal.h>
@@ -318,7 +320,13 @@ struct QMetalComputePipelineData
struct QMetalSwapChainData
{
+ // The iOS simulator's headers mark CAMetalLayer as iOS 13.0+ only.
+ // (for real device SDKs it is 8.0+)
+#ifdef TARGET_IPHONE_SIMULATOR
+ API_AVAILABLE(ios(13.0)) CAMetalLayer *layer = nullptr;
+#else
CAMetalLayer *layer = nullptr;
+#endif
id<CAMetalDrawable> curDrawable;
dispatch_semaphore_t sem[QMTL_FRAMES_IN_FLIGHT];
MTLRenderPassDescriptor *rp = nullptr;
@@ -665,12 +673,17 @@ static inline int mapBinding(int binding,
BindingType type)
{
const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex];
- if (map) {
- auto it = map->constFind(binding);
- if (it != map->cend())
- return type == BindingType::Sampler ? it->second : it->first;
- }
- return binding;
+ if (!map)
+ return binding; // old QShader versions do not have this map, assume 1:1 mapping then
+
+ auto it = map->constFind(binding);
+ if (it != map->cend())
+ return type == BindingType::Sampler ? it->second : it->first; // may be -1, if the resource is inactive
+
+ // Hitting this path is normal too, is not given that the resource (e.g. a
+ // uniform block) is really present in the shaders for all the stages
+ // specified by the visibility mask in the QRhiShaderResourceBinding.
+ return -1;
}
void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD,
@@ -704,16 +717,25 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
}
}
if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[VERTEX].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[VERTEX].buffers.feed(nativeBinding, mtlbuf);
+ res[VERTEX].bufferOffsets.feed(b->binding, offset);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[FRAGMENT].buffers.feed(nativeBinding, mtlbuf);
+ res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[COMPUTE].buffers.feed(nativeBinding, mtlbuf);
+ res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+ }
}
}
break;
@@ -722,16 +744,28 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.tex);
QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.sampler);
if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[VERTEX].samplers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
+ const int nativeBindingTexture = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture);
+ const int nativeBindingSampler = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Sampler);
+ if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) {
+ res[VERTEX].textures.feed(nativeBindingTexture, texD->d->tex);
+ res[VERTEX].samplers.feed(nativeBindingSampler, samplerD->d->samplerState);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[FRAGMENT].samplers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
+ const int nativeBindingTexture = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture);
+ const int nativeBindingSampler = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Sampler);
+ if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) {
+ res[FRAGMENT].textures.feed(nativeBindingTexture, texD->d->tex);
+ res[FRAGMENT].samplers.feed(nativeBindingSampler, samplerD->d->samplerState);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[COMPUTE].samplers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
+ const int nativeBindingTexture = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture);
+ const int nativeBindingSampler = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Sampler);
+ if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) {
+ res[COMPUTE].textures.feed(nativeBindingTexture, texD->d->tex);
+ res[COMPUTE].samplers.feed(nativeBindingSampler, samplerD->d->samplerState);
+ }
}
}
break;
@@ -743,12 +777,21 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
{
QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.simage.tex);
id<MTLTexture> t = texD->d->viewForLevel(b->u.simage.level);
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage))
- res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), t);
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage))
- res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), t);
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage))
- res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), t);
+ if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
+ const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture);
+ if (nativeBinding >= 0)
+ res[VERTEX].textures.feed(nativeBinding, t);
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
+ const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture);
+ if (nativeBinding >= 0)
+ res[FRAGMENT].textures.feed(nativeBinding, t);
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
+ const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture);
+ if (nativeBinding >= 0)
+ res[COMPUTE].textures.feed(nativeBinding, t);
+ }
}
break;
case QRhiShaderResourceBinding::BufferLoad:
@@ -761,16 +804,25 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
id<MTLBuffer> mtlbuf = bufD->d->buf[0];
uint offset = uint(b->u.sbuf.offset);
if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[VERTEX].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[VERTEX].buffers.feed(nativeBinding, mtlbuf);
+ res[VERTEX].bufferOffsets.feed(b->binding, offset);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[FRAGMENT].buffers.feed(nativeBinding, mtlbuf);
+ res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
+ }
}
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+ const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0) {
+ res[COMPUTE].buffers.feed(nativeBinding, mtlbuf);
+ res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+ }
}
}
break;
@@ -1763,8 +1815,10 @@ void QRhiMetal::executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD)
if (changeEnd == -1 || u.offset + u.data.size() > changeEnd)
changeEnd = u.offset + u.data.size();
}
+#ifdef Q_OS_MACOS
if (changeBegin >= 0 && bufD->d->managed)
[bufD->d->buf[idx] didModifyRange: NSMakeRange(NSUInteger(changeBegin), NSUInteger(changeEnd - changeBegin))];
+#endif
bufD->d->pendingUpdates[idx].clear();
}
@@ -1798,8 +1852,12 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
if (color0.needsDrawableForTex || color0.needsDrawableForResolveTex) {
Q_ASSERT(currentSwapChain);
QMetalSwapChain *swapChainD = QRHI_RES(QMetalSwapChain, currentSwapChain);
- if (!swapChainD->d->curDrawable)
- swapChainD->d->curDrawable = [swapChainD->d->layer nextDrawable];
+ if (!swapChainD->d->curDrawable) {
+#ifdef TARGET_IPHONE_SIMULATOR
+ if (@available(ios 13.0, *))
+#endif
+ swapChainD->d->curDrawable = [swapChainD->d->layer nextDrawable];
+ }
if (!swapChainD->d->curDrawable) {
qWarning("No drawable");
return;
@@ -2170,12 +2228,13 @@ bool QMetalRenderBuffer::build()
case DepthStencil:
#ifdef Q_OS_MACOS
desc.storageMode = MTLStorageModePrivate;
+ d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
+ ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
#else
- desc.storageMode = MTLResourceStorageModeMemoryless;
+ desc.storageMode = MTLStorageModeMemoryless;
transientBacking = true;
+ d->format = MTLPixelFormatDepth32Float_Stencil8;
#endif
- d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
- ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
desc.pixelFormat = d->format;
break;
case Color:
@@ -2484,11 +2543,40 @@ bool QMetalTexture::buildFrom(const QRhiNativeHandles *src)
return true;
}
+bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ void * const * tex = (void * const *) src.object;
+ if (!tex || !*tex)
+ return false;
+
+ if (!prepareBuild())
+ return false;
+
+ d->tex = (id<MTLTexture>) *tex;
+
+ d->owns = false;
+ nativeHandlesStruct.texture = d->tex;
+
+ QRHI_PROF;
+ QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
+
+ lastActiveFrameSlot = -1;
+ generation += 1;
+ QRHI_RES_RHI(QRhiMetal);
+ rhiD->registerResource(this);
+ return true;
+}
+
const QRhiNativeHandles *QMetalTexture::nativeHandles()
{
return &nativeHandlesStruct;
}
+QRhiTexture::NativeTexture QMetalTexture::nativeTexture()
+{
+ return {&nativeHandlesStruct.texture, 0};
+}
+
id<MTLTexture> QMetalTextureData::viewForLevel(int level)
{
Q_ASSERT(level >= 0 && level < int(q->mipLevelCount));
@@ -2569,12 +2657,8 @@ static inline MTLSamplerAddressMode toMetalAddressMode(QRhiSampler::AddressMode
return MTLSamplerAddressModeRepeat;
case QRhiSampler::ClampToEdge:
return MTLSamplerAddressModeClampToEdge;
- case QRhiSampler::Border:
- return MTLSamplerAddressModeClampToBorderColor;
case QRhiSampler::Mirror:
return MTLSamplerAddressModeMirrorRepeat;
- case QRhiSampler::MirrorOnce:
- return MTLSamplerAddressModeMirrorClampToEdge;
default:
Q_UNREACHABLE();
return MTLSamplerAddressModeClampToEdge;
@@ -2647,6 +2731,32 @@ void QMetalRenderPassDescriptor::release()
// nothing to do here
}
+bool QMetalRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ if (!other)
+ return false;
+
+ const QMetalRenderPassDescriptor *o = QRHI_RES(const QMetalRenderPassDescriptor, other);
+
+ if (colorAttachmentCount != o->colorAttachmentCount)
+ return false;
+
+ if (hasDepthStencil != o->hasDepthStencil)
+ return false;
+
+ for (int i = 0; i < colorAttachmentCount; ++i) {
+ if (colorFormat[i] != o->colorFormat[i])
+ return false;
+ }
+
+ if (hasDepthStencil) {
+ if (dsFormat != o->dsFormat)
+ return false;
+ }
+
+ return true;
+}
+
QMetalReferenceRenderTarget::QMetalReferenceRenderTarget(QRhiImplementation *rhi)
: QRhiRenderTarget(rhi),
d(new QMetalRenderTargetData)
@@ -3314,7 +3424,11 @@ bool QMetalGraphicsPipeline::build()
// validation blows up otherwise.
MTLPixelFormat fmt = MTLPixelFormat(rpD->dsFormat);
rpDesc.depthAttachmentPixelFormat = fmt;
+#ifdef Q_OS_MACOS
if (fmt != MTLPixelFormatDepth16Unorm && fmt != MTLPixelFormatDepth32Float)
+#else
+ if (fmt != MTLPixelFormatDepth32Float)
+#endif
rpDesc.stencilAttachmentPixelFormat = fmt;
}
@@ -3531,6 +3645,10 @@ QMetalSwapChain::~QMetalSwapChain()
void QMetalSwapChain::release()
{
+#ifdef TARGET_IPHONE_SIMULATOR
+ if (@available(ios 13.0, *)) {
+#endif
+
if (!d->layer)
return;
@@ -3559,6 +3677,10 @@ void QMetalSwapChain::release()
QRHI_PROF_F(releaseSwapChain(this));
rhiD->unregisterResource(this);
+
+#ifdef TARGET_IPHONE_SIMULATOR
+ }
+#endif
}
QRhiCommandBuffer *QMetalSwapChain::currentFrameCommandBuffer()
@@ -3581,16 +3703,20 @@ QRhiRenderPassDescriptor *QMetalSwapChain::newCompatibleRenderPassDescriptor()
{
chooseFormats(); // ensure colorFormat and similar are filled out
- QRHI_RES_RHI(QRhiMetal);
QMetalRenderPassDescriptor *rpD = new QMetalRenderPassDescriptor(m_rhi);
rpD->colorAttachmentCount = 1;
rpD->hasDepthStencil = m_depthStencil != nullptr;
rpD->colorFormat[0] = int(d->colorFormat);
+#ifdef Q_OS_MACOS
// m_depthStencil may not be built yet so cannot rely on computed fields in it
+ QRHI_RES_RHI(QRhiMetal);
rpD->dsFormat = rhiD->d->dev.depth24Stencil8PixelFormatSupported
? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
+#else
+ rpD->dsFormat = MTLPixelFormatDepth32Float_Stencil8;
+#endif
return rpD;
}
@@ -3606,6 +3732,10 @@ void QMetalSwapChain::chooseFormats()
bool QMetalSwapChain::buildOrResize()
{
+#ifdef TARGET_IPHONE_SIMULATOR
+ if (@available(ios 13.0, *)) {
+#endif
+
Q_ASSERT(m_window);
const bool needsRegistration = !window || window != m_window;
@@ -3625,7 +3755,11 @@ bool QMetalSwapChain::buildOrResize()
return false;
}
+#ifdef Q_OS_MACOS
NSView *view = reinterpret_cast<NSView *>(window->winId());
+#else
+ UIView *view = reinterpret_cast<UIView *>(window->winId());
+#endif
Q_ASSERT(view);
d->layer = static_cast<CAMetalLayer *>(view.layer);
Q_ASSERT(d->layer);
@@ -3729,6 +3863,15 @@ bool QMetalSwapChain::buildOrResize()
rhiD->registerResource(this);
return true;
+
+#ifdef TARGET_IPHONE_SIMULATOR
+ } else {
+ // Won't ever get here in a normal app because MTLDevice creation would
+ // fail too. Print a warning, just in case.
+ qWarning("No CAMetalLayer support in this version of the iOS Simulator");
+ return false;
+ }
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h
index 2be86db5c8..8e655fd98b 100644
--- a/src/gui/rhi/qrhimetal_p_p.h
+++ b/src/gui/rhi/qrhimetal_p_p.h
@@ -101,7 +101,9 @@ struct QMetalTexture : public QRhiTexture
void release() override;
bool build() override;
bool buildFrom(const QRhiNativeHandles *src) override;
+ bool buildFrom(NativeTexture src) override;
const QRhiNativeHandles *nativeHandles() override;
+ NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -138,6 +140,7 @@ struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
QMetalRenderPassDescriptor(QRhiImplementation *rhi);
~QMetalRenderPassDescriptor();
void release() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
// there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index fe606f971f..80f004e049 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -651,6 +651,12 @@ bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
return true;
}
+bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ Q_UNUSED(src)
+ return buildFrom(nullptr);
+}
+
const QRhiNativeHandles *QNullTexture::nativeHandles()
{
return &nativeHandlesStruct;
@@ -690,6 +696,12 @@ void QNullRenderPassDescriptor::release()
{
}
+bool QNullRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ Q_UNUSED(other);
+ return true;
+}
+
QNullReferenceRenderTarget::QNullReferenceRenderTarget(QRhiImplementation *rhi)
: QRhiRenderTarget(rhi),
d(rhi)
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
index ce517bfa63..57c3de0418 100644
--- a/src/gui/rhi/qrhinull_p_p.h
+++ b/src/gui/rhi/qrhinull_p_p.h
@@ -81,6 +81,7 @@ struct QNullTexture : public QRhiTexture
void release() override;
bool build() override;
bool buildFrom(const QRhiNativeHandles *src) override;
+ bool buildFrom(NativeTexture src) override;
const QRhiNativeHandles *nativeHandles() override;
QRhiNullTextureNativeHandles nativeHandlesStruct;
@@ -101,6 +102,7 @@ struct QNullRenderPassDescriptor : public QRhiRenderPassDescriptor
QNullRenderPassDescriptor(QRhiImplementation *rhi);
~QNullRenderPassDescriptor();
void release() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
struct QNullRenderTargetData
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index a200a6e271..21ae142b1d 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -1032,54 +1032,62 @@ VkFormat QRhiVulkan::optimalDepthStencilFormat()
return optimalDsFormat;
}
-bool QRhiVulkan::createDefaultRenderPass(VkRenderPass *rp, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat)
+bool QRhiVulkan::createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat)
{
- VkAttachmentDescription attDesc[3];
- memset(attDesc, 0, sizeof(attDesc));
-
// attachment list layout is color (1), ds (0-1), resolve (0-1)
- attDesc[0].format = colorFormat;
- attDesc[0].samples = samples;
- attDesc[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- attDesc[0].storeOp = samples > VK_SAMPLE_COUNT_1_BIT ? VK_ATTACHMENT_STORE_OP_DONT_CARE : VK_ATTACHMENT_STORE_OP_STORE;
- attDesc[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
- attDesc[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
- attDesc[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
- attDesc[0].finalLayout = samples > VK_SAMPLE_COUNT_1_BIT ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
-
- // clear on load + no store + lazy alloc + transient image should play
- // nicely with tiled GPUs (no physical backing necessary for ds buffer)
- attDesc[1].format = optimalDepthStencilFormat();
- attDesc[1].samples = samples;
- attDesc[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- attDesc[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
- attDesc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- attDesc[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
- attDesc[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
- attDesc[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ VkAttachmentDescription attDesc;
+ memset(&attDesc, 0, sizeof(attDesc));
+ attDesc.format = colorFormat;
+ attDesc.samples = samples;
+ attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ attDesc.storeOp = samples > VK_SAMPLE_COUNT_1_BIT ? VK_ATTACHMENT_STORE_OP_DONT_CARE : VK_ATTACHMENT_STORE_OP_STORE;
+ attDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+ attDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+ attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ attDesc.finalLayout = samples > VK_SAMPLE_COUNT_1_BIT ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
+ rpD->attDescs.append(attDesc);
- if (samples > VK_SAMPLE_COUNT_1_BIT) {
- attDesc[2].format = colorFormat;
- attDesc[2].samples = VK_SAMPLE_COUNT_1_BIT;
- attDesc[2].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- attDesc[2].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
- attDesc[2].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
- attDesc[2].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
- attDesc[2].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
- attDesc[2].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
+ rpD->colorRefs.append({ 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL });
+
+ if (hasDepthStencil) {
+ // clear on load + no store + lazy alloc + transient image should play
+ // nicely with tiled GPUs (no physical backing necessary for ds buffer)
+ memset(&attDesc, 0, sizeof(attDesc));
+ attDesc.format = optimalDepthStencilFormat();
+ attDesc.samples = samples;
+ attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ attDesc.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+ attDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ attDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+ attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ attDesc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ rpD->attDescs.append(attDesc);
+
+ rpD->dsRef = { 1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
}
- VkAttachmentReference colorRef = { 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
- VkAttachmentReference dsRef = { 1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
- VkAttachmentReference resolveRef = { 2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+ if (samples > VK_SAMPLE_COUNT_1_BIT) {
+ memset(&attDesc, 0, sizeof(attDesc));
+ attDesc.format = colorFormat;
+ attDesc.samples = VK_SAMPLE_COUNT_1_BIT;
+ attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ attDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+ attDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+ attDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+ attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ attDesc.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
+ rpD->attDescs.append(attDesc);
+
+ rpD->resolveRefs.append({ 2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL });
+ }
VkSubpassDescription subpassDesc;
memset(&subpassDesc, 0, sizeof(subpassDesc));
subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpassDesc.colorAttachmentCount = 1;
- subpassDesc.pColorAttachments = &colorRef;
- subpassDesc.pDepthStencilAttachment = hasDepthStencil ? &dsRef : nullptr;
+ subpassDesc.pColorAttachments = rpD->colorRefs.constData();
+ subpassDesc.pDepthStencilAttachment = hasDepthStencil ? &rpD->dsRef : nullptr;
// Replace the first implicit dep (TOP_OF_PIPE / ALL_COMMANDS) with our own.
VkSubpassDependency subpassDep;
@@ -1095,7 +1103,7 @@ bool QRhiVulkan::createDefaultRenderPass(VkRenderPass *rp, bool hasDepthStencil,
memset(&rpInfo, 0, sizeof(rpInfo));
rpInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
rpInfo.attachmentCount = 1;
- rpInfo.pAttachments = attDesc;
+ rpInfo.pAttachments = rpD->attDescs.constData();
rpInfo.subpassCount = 1;
rpInfo.pSubpasses = &subpassDesc;
rpInfo.dependencyCount = 1;
@@ -1106,19 +1114,21 @@ bool QRhiVulkan::createDefaultRenderPass(VkRenderPass *rp, bool hasDepthStencil,
if (samples > VK_SAMPLE_COUNT_1_BIT) {
rpInfo.attachmentCount += 1;
- subpassDesc.pResolveAttachments = &resolveRef;
+ subpassDesc.pResolveAttachments = rpD->resolveRefs.constData();
}
- VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, rp);
+ VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, &rpD->rp);
if (err != VK_SUCCESS) {
qWarning("Failed to create renderpass: %d", err);
return false;
}
+ rpD->hasDepthStencil = hasDepthStencil;
+
return true;
}
-bool QRhiVulkan::createOffscreenRenderPass(VkRenderPass *rp,
+bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
const QRhiColorAttachment *firstColorAttachment,
const QRhiColorAttachment *lastColorAttachment,
bool preserveColor,
@@ -1126,10 +1136,6 @@ bool QRhiVulkan::createOffscreenRenderPass(VkRenderPass *rp,
QRhiRenderBuffer *depthStencilBuffer,
QRhiTexture *depthTexture)
{
- QVarLengthArray<VkAttachmentDescription, 8> attDescs;
- QVarLengthArray<VkAttachmentReference, 8> colorRefs;
- QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
-
// attachment list layout is color (0-8), ds (0-1), resolve (0-8)
for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) {
@@ -1150,14 +1156,14 @@ bool QRhiVulkan::createOffscreenRenderPass(VkRenderPass *rp,
// this has to interact correctly with activateTextureRenderTarget(), hence leaving in COLOR_ATT
attDesc.initialLayout = preserveColor ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED;
attDesc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
- attDescs.append(attDesc);
+ rpD->attDescs.append(attDesc);
- const VkAttachmentReference ref = { uint32_t(attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
- colorRefs.append(ref);
+ const VkAttachmentReference ref = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+ rpD->colorRefs.append(ref);
}
- const bool hasDepthStencil = depthStencilBuffer || depthTexture;
- if (hasDepthStencil) {
+ rpD->hasDepthStencil = depthStencilBuffer || depthTexture;
+ if (rpD->hasDepthStencil) {
const VkFormat dsFormat = depthTexture ? QRHI_RES(QVkTexture, depthTexture)->vkformat
: QRHI_RES(QVkRenderBuffer, depthStencilBuffer)->vkformat;
const VkSampleCountFlagBits samples = depthTexture ? QRHI_RES(QVkTexture, depthTexture)->samples
@@ -1174,9 +1180,9 @@ bool QRhiVulkan::createOffscreenRenderPass(VkRenderPass *rp,
attDesc.stencilStoreOp = storeOp;
attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
attDesc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- attDescs.append(attDesc);
+ rpD->attDescs.append(attDesc);
}
- VkAttachmentReference dsRef = { uint32_t(attDescs.count() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
+ rpD->dsRef = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) {
if (it->resolveTexture()) {
@@ -1194,37 +1200,37 @@ bool QRhiVulkan::createOffscreenRenderPass(VkRenderPass *rp,
attDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
attDesc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
- attDescs.append(attDesc);
+ rpD->attDescs.append(attDesc);
- const VkAttachmentReference ref = { uint32_t(attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
- resolveRefs.append(ref);
+ const VkAttachmentReference ref = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+ rpD->resolveRefs.append(ref);
} else {
const VkAttachmentReference ref = { VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
- resolveRefs.append(ref);
+ rpD->resolveRefs.append(ref);
}
}
VkSubpassDescription subpassDesc;
memset(&subpassDesc, 0, sizeof(subpassDesc));
subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
- subpassDesc.colorAttachmentCount = uint32_t(colorRefs.count());
- Q_ASSERT(colorRefs.count() == resolveRefs.count());
- subpassDesc.pColorAttachments = !colorRefs.isEmpty() ? colorRefs.constData() : nullptr;
- subpassDesc.pDepthStencilAttachment = hasDepthStencil ? &dsRef : nullptr;
- subpassDesc.pResolveAttachments = !resolveRefs.isEmpty() ? resolveRefs.constData() : nullptr;
+ subpassDesc.colorAttachmentCount = uint32_t(rpD->colorRefs.count());
+ Q_ASSERT(rpD->colorRefs.count() == rpD->resolveRefs.count());
+ subpassDesc.pColorAttachments = !rpD->colorRefs.isEmpty() ? rpD->colorRefs.constData() : nullptr;
+ subpassDesc.pDepthStencilAttachment = rpD->hasDepthStencil ? &rpD->dsRef : nullptr;
+ subpassDesc.pResolveAttachments = !rpD->resolveRefs.isEmpty() ? rpD->resolveRefs.constData() : nullptr;
VkRenderPassCreateInfo rpInfo;
memset(&rpInfo, 0, sizeof(rpInfo));
rpInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- rpInfo.attachmentCount = uint32_t(attDescs.count());
- rpInfo.pAttachments = attDescs.constData();
+ rpInfo.attachmentCount = uint32_t(rpD->attDescs.count());
+ rpInfo.pAttachments = rpD->attDescs.constData();
rpInfo.subpassCount = 1;
rpInfo.pSubpasses = &subpassDesc;
// don't yet know the correct initial/final access and stage stuff for the
// implicit deps at this point, so leave it to the resource tracking to
// generate barriers
- VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, rp);
+ VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, &rpD->rp);
if (err != VK_SUCCESS) {
qWarning("Failed to create renderpass: %d", err);
return false;
@@ -1710,6 +1716,10 @@ QRhi::FrameOpResult QRhiVulkan::endFrame(QRhiSwapChain *swapChain, QRhi::EndFram
presInfo.waitSemaphoreCount = 1;
presInfo.pWaitSemaphores = &frame.drawSem; // gfxQueueFamilyIdx == presQueueFamilyIdx ? &frame.drawSem : &frame.presTransSem;
+ // Do platform-specific WM notification. F.ex. essential on Wayland in
+ // order to circumvent driver frame callbacks
+ inst->presentAboutToBeQueued(swapChainD->window);
+
VkResult err = vkQueuePresentKHR(gfxQueue, &presInfo);
if (err != VK_SUCCESS) {
if (err == VK_ERROR_OUT_OF_DATE_KHR) {
@@ -4613,12 +4623,8 @@ static inline VkSamplerAddressMode toVkAddressMode(QRhiSampler::AddressMode m)
return VK_SAMPLER_ADDRESS_MODE_REPEAT;
case QRhiSampler::ClampToEdge:
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
- case QRhiSampler::Border:
- return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
case QRhiSampler::Mirror:
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
- case QRhiSampler::MirrorOnce:
- return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
default:
Q_UNREACHABLE();
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
@@ -5364,12 +5370,42 @@ bool QVkTexture::buildFrom(const QRhiNativeHandles *src)
return true;
}
+bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
+{
+ auto *img = static_cast<const VkImage*>(src.object);
+ if (!img || !*img)
+ return false;
+
+ if (!prepareBuild())
+ return false;
+
+ image = *img;
+
+ if (!finishBuild())
+ return false;
+
+ QRHI_PROF;
+ QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples));
+
+ usageState.layout = VkImageLayout(src.layout);
+
+ owns = false;
+ QRHI_RES_RHI(QRhiVulkan);
+ rhiD->registerResource(this);
+ return true;
+}
+
const QRhiNativeHandles *QVkTexture::nativeHandles()
{
nativeHandlesStruct.layout = usageState.layout;
return &nativeHandlesStruct;
}
+QRhiTexture::NativeTexture QVkTexture::nativeTexture()
+{
+ return {&nativeHandlesStruct.image, usageState.layout};
+}
+
VkImageView QVkTexture::imageViewForLevel(int level)
{
Q_ASSERT(level >= 0 && level < int(mipLevelCount));
@@ -5501,6 +5537,61 @@ void QVkRenderPassDescriptor::release()
rhiD->unregisterResource(this);
}
+static inline bool attachmentDescriptionEquals(const VkAttachmentDescription &a, const VkAttachmentDescription &b)
+{
+ return a.format == b.format
+ && a.samples == b.samples
+ && a.loadOp == b.loadOp
+ && a.storeOp == b.storeOp
+ && a.stencilLoadOp == b.stencilLoadOp
+ && a.stencilStoreOp == b.stencilStoreOp
+ && a.initialLayout == b.initialLayout
+ && a.finalLayout == b.finalLayout;
+}
+
+bool QVkRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ if (!other)
+ return false;
+
+ const QVkRenderPassDescriptor *o = QRHI_RES(const QVkRenderPassDescriptor, other);
+
+ if (attDescs.count() != o->attDescs.count())
+ return false;
+ if (colorRefs.count() != o->colorRefs.count())
+ return false;
+ if (resolveRefs.count() != o->resolveRefs.count())
+ return false;
+ if (hasDepthStencil != o->hasDepthStencil)
+ return false;
+
+ for (int i = 0, ie = colorRefs.count(); i != ie; ++i) {
+ const uint32_t attIdx = colorRefs[i].attachment;
+ if (attIdx != o->colorRefs[i].attachment)
+ return false;
+ if (attIdx != VK_ATTACHMENT_UNUSED && !attachmentDescriptionEquals(attDescs[attIdx], o->attDescs[attIdx]))
+ return false;
+ }
+
+ if (hasDepthStencil) {
+ const uint32_t attIdx = dsRef.attachment;
+ if (attIdx != o->dsRef.attachment)
+ return false;
+ if (attIdx != VK_ATTACHMENT_UNUSED && !attachmentDescriptionEquals(attDescs[attIdx], o->attDescs[attIdx]))
+ return false;
+ }
+
+ for (int i = 0, ie = resolveRefs.count(); i != ie; ++i) {
+ const uint32_t attIdx = resolveRefs[i].attachment;
+ if (attIdx != o->resolveRefs[i].attachment)
+ return false;
+ if (attIdx != VK_ATTACHMENT_UNUSED && !attachmentDescriptionEquals(attDescs[attIdx], o->attDescs[attIdx]))
+ return false;
+ }
+
+ return true;
+}
+
const QRhiNativeHandles *QVkRenderPassDescriptor::nativeHandles()
{
nativeHandlesStruct.renderPass = rp;
@@ -5584,7 +5675,7 @@ QRhiRenderPassDescriptor *QVkTextureRenderTarget::newCompatibleRenderPassDescrip
QRHI_RES_RHI(QRhiVulkan);
QVkRenderPassDescriptor *rp = new QVkRenderPassDescriptor(m_rhi);
- if (!rhiD->createOffscreenRenderPass(&rp->rp,
+ if (!rhiD->createOffscreenRenderPass(rp,
m_desc.cbeginColorAttachments(),
m_desc.cendColorAttachments(),
m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents),
@@ -6285,7 +6376,7 @@ QRhiRenderPassDescriptor *QVkSwapChain::newCompatibleRenderPassDescriptor()
QRHI_RES_RHI(QRhiVulkan);
QVkRenderPassDescriptor *rp = new QVkRenderPassDescriptor(m_rhi);
- if (!rhiD->createDefaultRenderPass(&rp->rp,
+ if (!rhiD->createDefaultRenderPass(rp,
m_depthStencil != nullptr,
samples,
colorFormat))
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
index d0e1e6758b..d1b77870a1 100644
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ b/src/gui/rhi/qrhivulkan_p_p.h
@@ -121,7 +121,9 @@ struct QVkTexture : public QRhiTexture
void release() override;
bool build() override;
bool buildFrom(const QRhiNativeHandles *src) override;
+ bool buildFrom(NativeTexture src) override;
const QRhiNativeHandles *nativeHandles() override;
+ NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
bool finishBuild();
@@ -171,10 +173,16 @@ struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
QVkRenderPassDescriptor(QRhiImplementation *rhi);
~QVkRenderPassDescriptor();
void release() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
const QRhiNativeHandles *nativeHandles() override;
VkRenderPass rp = VK_NULL_HANDLE;
bool ownsRp = false;
+ QVarLengthArray<VkAttachmentDescription, 8> attDescs;
+ QVarLengthArray<VkAttachmentReference, 8> colorRefs;
+ QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
+ bool hasDepthStencil = false;
+ VkAttachmentReference dsRef;
QRhiVulkanRenderPassNativeHandles nativeHandlesStruct;
int lastActiveFrameSlot = -1;
};
@@ -727,11 +735,11 @@ public:
VkFormat optimalDepthStencilFormat();
VkSampleCountFlagBits effectiveSampleCount(int sampleCount);
- bool createDefaultRenderPass(VkRenderPass *rp,
+ bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD,
bool hasDepthStencil,
VkSampleCountFlagBits samples,
VkFormat colorFormat);
- bool createOffscreenRenderPass(VkRenderPass *rp,
+ bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
const QRhiColorAttachment *firstColorAttachment,
const QRhiColorAttachment *lastColorAttachment,
bool preserveColor,
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
index 9d35d83336..0b99281f08 100644
--- a/src/gui/rhi/qshader.cpp
+++ b/src/gui/rhi/qshader.cpp
@@ -214,9 +214,6 @@ QT_BEGIN_NAMESPACE
QShader, it indicates no shader code was found for the requested key.
*/
-static const int QSB_VERSION = 2;
-static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
-
/*!
Constructs a new, empty (and thus invalid) QShader instance.
*/
@@ -368,9 +365,9 @@ QByteArray QShader::serialized() const
if (!buf.open(QIODevice::WriteOnly))
return QByteArray();
- ds << QSB_VERSION;
+ ds << QShaderPrivate::QSB_VERSION;
ds << int(d->stage);
- ds << d->desc.toBinaryJson();
+ ds << d->desc.toCbor();
ds << d->shaders.count();
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
const QShaderKey &k(it.key());
@@ -429,9 +426,12 @@ QShader QShader::fromSerialized(const QByteArray &data)
Q_ASSERT(d->ref.loadRelaxed() == 1); // must be detached
int intVal;
ds >> intVal;
- const int qsbVersion = intVal;
- if (qsbVersion != QSB_VERSION && qsbVersion != QSB_VERSION_WITHOUT_BINDINGS) {
- qWarning("Attempted to deserialize QShader with unknown version %d.", qsbVersion);
+ d->qsbVersion = intVal;
+ if (d->qsbVersion != QShaderPrivate::QSB_VERSION
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_BINDINGS)
+ {
+ qWarning("Attempted to deserialize QShader with unknown version %d.", d->qsbVersion);
return QShader();
}
@@ -439,7 +439,10 @@ QShader QShader::fromSerialized(const QByteArray &data)
d->stage = Stage(intVal);
QByteArray descBin;
ds >> descBin;
- d->desc = QShaderDescription::fromBinaryJson(descBin);
+ if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON)
+ d->desc = QShaderDescription::fromCbor(descBin);
+ else
+ d->desc = QShaderDescription::fromBinaryJson(descBin);
int count;
ds >> count;
for (int i = 0; i < count; ++i) {
@@ -454,7 +457,7 @@ QShader QShader::fromSerialized(const QByteArray &data)
d->shaders[k] = shader;
}
- if (qsbVersion != QSB_VERSION_WITHOUT_BINDINGS) {
+ if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITHOUT_BINDINGS) {
ds >> count;
for (int i = 0; i < count; ++i) {
QShaderKey k;
@@ -657,6 +660,13 @@ QDebug operator<<(QDebug dbg, const QShaderVersion &v)
pair, because combined image samplers may map to two native resources (a
texture and a sampler) in some shading languages. In that case the second
value refers to the sampler.
+
+ \note The native binding may be -1, in case there is no active binding for
+ the resource in the shader. (for example, there is a uniform block
+ declared, but it is not used in the shader code) The map is always
+ complete, meaning there is an entry for all declared uniform blocks,
+ storage blocks, image objects, and combined samplers, but the value will be
+ -1 for those that are not actually referenced in the shader functions.
*/
/*!
diff --git a/src/gui/rhi/qshader_p_p.h b/src/gui/rhi/qshader_p_p.h
index 4535e01491..8c89f2b45f 100644
--- a/src/gui/rhi/qshader_p_p.h
+++ b/src/gui/rhi/qshader_p_p.h
@@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE
struct Q_GUI_EXPORT QShaderPrivate
{
+ static const int QSB_VERSION = 3;
+ static const int QSB_VERSION_WITH_BINARY_JSON = 2;
+ static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
+
QShaderPrivate()
: ref(1)
{
@@ -64,6 +68,7 @@ struct Q_GUI_EXPORT QShaderPrivate
QShaderPrivate(const QShaderPrivate *other)
: ref(1),
+ qsbVersion(other->qsbVersion),
stage(other->stage),
desc(other->desc),
shaders(other->shaders),
@@ -75,6 +80,7 @@ struct Q_GUI_EXPORT QShaderPrivate
static const QShaderPrivate *get(const QShader *s) { return s->d; }
QAtomicInt ref;
+ int qsbVersion = QSB_VERSION;
QShader::Stage stage = QShader::VertexStage;
QShaderDescription desc;
QHash<QShaderKey, QShaderCode> shaders;
diff --git a/src/gui/rhi/qshaderdescription.cpp b/src/gui/rhi/qshaderdescription.cpp
index 179d5f3a07..d0f73f6aa7 100644
--- a/src/gui/rhi/qshaderdescription.cpp
+++ b/src/gui/rhi/qshaderdescription.cpp
@@ -38,6 +38,9 @@
#include <QDebug>
#include <QJsonObject>
#include <QJsonArray>
+#include <QCborValue>
+#include <QCborMap>
+#include <QCborArray>
QT_BEGIN_NAMESPACE
@@ -335,11 +338,27 @@ bool QShaderDescription::isValid() const
/*!
\return a serialized binary version of the data.
- \sa toJson()
+ \sa toJson(), toCbor()
*/
QByteArray QShaderDescription::toBinaryJson() const
{
+#if QT_CONFIG(binaryjson)
return d->makeDoc().toBinaryData();
+#else
+ qWarning("Cannot generate binary JSON from QShaderDescription due to disabled binaryjson feature");
+ return QByteArray();
+#endif
+}
+
+/*!
+ \return a serialized binary version of the data in CBOR (Concise Binary
+ Object Representation) format.
+
+ \sa QCborValue, toBinaryJson(), toJson()
+ */
+QByteArray QShaderDescription::toCbor() const
+{
+ return QCborValue::fromJsonValue(d->makeDoc().object()).toCbor();
}
/*!
@@ -347,7 +366,7 @@ QByteArray QShaderDescription::toBinaryJson() const
\note There is no deserialization method provided for JSON text.
- \sa toBinaryJson()
+ \sa toBinaryJson(), toCbor()
*/
QByteArray QShaderDescription::toJson() const
{
@@ -357,11 +376,38 @@ QByteArray QShaderDescription::toJson() const
/*!
Deserializes the given binary JSON \a data and returns a new
QShaderDescription.
+
+ \sa fromCbor()
*/
QShaderDescription QShaderDescription::fromBinaryJson(const QByteArray &data)
{
QShaderDescription desc;
+#if QT_CONFIG(binaryjson)
QShaderDescriptionPrivate::get(&desc)->loadDoc(QJsonDocument::fromBinaryData(data));
+#else
+ Q_UNUSED(data);
+ qWarning("Cannot load QShaderDescription from binary JSON due to disabled binaryjson feature");
+#endif
+ return desc;
+}
+
+/*!
+ Deserializes the given CBOR \a data and returns a new QShaderDescription.
+
+ \sa fromBinaryJson()
+ */
+QShaderDescription QShaderDescription::fromCbor(const QByteArray &data)
+{
+ QShaderDescription desc;
+ const QCborValue cbor = QCborValue::fromCbor(data);
+ if (cbor.isMap()) {
+ const QJsonDocument doc(cbor.toMap().toJsonObject());
+ QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
+ }
+ if (cbor.isArray()) {
+ const QJsonDocument doc(cbor.toArray().toJsonArray());
+ QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
+ }
return desc;
}
@@ -1119,4 +1165,106 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc)
}
}
+/*!
+ Returns \c true if the two QShaderDescription objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription
+ */
+bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
+{
+ if (lhs.d == rhs.d)
+ return true;
+
+ return lhs.d->inVars == rhs.d->inVars
+ && lhs.d->outVars == rhs.d->outVars
+ && lhs.d->uniformBlocks == rhs.d->uniformBlocks
+ && lhs.d->pushConstantBlocks == rhs.d->pushConstantBlocks
+ && lhs.d->storageBlocks == rhs.d->storageBlocks
+ && lhs.d->combinedImageSamplers == rhs.d->combinedImageSamplers
+ && lhs.d->storageImages == rhs.d->storageImages
+ && lhs.d->localSize == rhs.d->localSize;
+}
+
+/*!
+ Returns \c true if the two InOutVariable objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::InOutVariable
+ */
+bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
+{
+ return lhs.name == rhs.name
+ && lhs.type == rhs.type
+ && lhs.location == rhs.location
+ && lhs.binding == rhs.binding
+ && lhs.descriptorSet == rhs.descriptorSet
+ && lhs.imageFormat == rhs.imageFormat
+ && lhs.imageFlags == rhs.imageFlags;
+}
+
+/*!
+ Returns \c true if the two BlockVariable objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::BlockVariable
+ */
+bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
+{
+ return lhs.name == rhs.name
+ && lhs.type == rhs.type
+ && lhs.offset == rhs.offset
+ && lhs.size == rhs.size
+ && lhs.arrayDims == rhs.arrayDims
+ && lhs.arrayStride == rhs.arrayStride
+ && lhs.matrixStride == rhs.matrixStride
+ && lhs.matrixIsRowMajor == rhs.matrixIsRowMajor
+ && lhs.structMembers == rhs.structMembers;
+}
+
+/*!
+ Returns \c true if the two UniformBlock objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::UniformBlock
+ */
+bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
+{
+ return lhs.blockName == rhs.blockName
+ && lhs.structName == rhs.structName
+ && lhs.size == rhs.size
+ && lhs.binding == rhs.binding
+ && lhs.descriptorSet == rhs.descriptorSet
+ && lhs.members == rhs.members;
+}
+
+/*!
+ Returns \c true if the two PushConstantBlock objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::PushConstantBlock
+ */
+bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
+{
+ return lhs.name == rhs.name
+ && lhs.size == rhs.size
+ && lhs.members == rhs.members;
+}
+
+/*!
+ Returns \c true if the two StorageBlock objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::StorageBlock
+ */
+bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
+{
+ return lhs.blockName == rhs.blockName
+ && lhs.instanceName == rhs.instanceName
+ && lhs.knownSize == rhs.knownSize
+ && lhs.binding == rhs.binding
+ && lhs.descriptorSet == rhs.descriptorSet
+ && lhs.members == rhs.members;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qshaderdescription_p.h b/src/gui/rhi/qshaderdescription_p.h
index 5a63b998cd..e02a53dcb5 100644
--- a/src/gui/rhi/qshaderdescription_p.h
+++ b/src/gui/rhi/qshaderdescription_p.h
@@ -69,9 +69,11 @@ public:
bool isValid() const;
QByteArray toBinaryJson() const;
+ QByteArray toCbor() const;
QByteArray toJson() const;
static QShaderDescription fromBinaryJson(const QByteArray &data);
+ static QShaderDescription fromCbor(const QByteArray &data);
enum VariableType {
Unknown = 0,
@@ -263,6 +265,7 @@ private:
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
#endif
+ friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags)
@@ -276,6 +279,43 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::PushConstantBlo
Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &);
#endif
+Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW;
+
+inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
+{
+ return !(lhs == rhs);
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/rhi.pri b/src/gui/rhi/rhi.pri
index 4297a5602b..ccd9592634 100644
--- a/src/gui/rhi/rhi.pri
+++ b/src/gui/rhi/rhi.pri
@@ -43,15 +43,15 @@ win32 {
LIBS += -ld3d11 -ldxgi -ldxguid
}
-# darwin {
-macos {
+macos|ios {
HEADERS += \
rhi/qrhimetal_p.h \
rhi/qrhimetal_p_p.h
SOURCES += \
rhi/qrhimetal.mm
- LIBS += -framework AppKit -framework Metal
+ macos: LIBS += -framework AppKit
+ LIBS += -framework Metal
}
include($$PWD/../../3rdparty/VulkanMemoryAllocator.pri)
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 8b8f3e28ac..8528f59844 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -471,7 +471,7 @@ QTextObjectInterface *QAbstractTextDocumentLayout::handlerForObject(int objectTy
QTextObjectHandler handler = d->handlers.value(objectType);
if (!handler.component)
- return 0;
+ return nullptr;
return handler.iface;
}
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 627b3ec8c0..c0b0071e4d 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -123,6 +123,7 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "font-variant", FontVariant },
{ "font-weight", FontWeight },
{ "height", Height },
+ { "icon", QtIcon },
{ "image", QtImage },
{ "image-position", QtImageAlignment },
{ "left", Left },
@@ -682,7 +683,7 @@ bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *s
static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
{
- Qt::Alignment a[2] = { 0, 0 };
+ Qt::Alignment a[2] = { { }, { } };
for (int i = 0; i < qMin(2, count); i++) {
if (values[i].type != Value::KnownIdentifier)
break;
@@ -1380,6 +1381,37 @@ bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size)
return hit;
}
+bool ValueExtractor::extractIcon(QIcon *icon, QSize *size)
+{
+ // Find last declaration that specifies an icon
+ const auto declaration = std::find_if(
+ declarations.rbegin(), declarations.rend(),
+ [](const Declaration &decl) { return decl.d->propertyId == QtIcon; });
+ if (declaration == declarations.rend())
+ return false;
+
+ *icon = declaration->iconValue();
+
+ // If the value contains a URI, try to get the size of the icon
+ if (declaration->d->values.isEmpty())
+ return true;
+
+ const auto &propertyValue = declaration->d->values.constFirst();
+ if (propertyValue.type != Value::Uri)
+ return true;
+
+ // First try to read just the size from the image without loading it
+ const QString url(propertyValue.variant.toString());
+ QImageReader imageReader(url);
+ *size = imageReader.size();
+ if (!size->isNull())
+ return true;
+
+ // Get the size by loading the image instead
+ *size = imageReader.read().size();
+ return true;
+}
+
///////////////////////////////////////////////////////////////////////////////
// Declaration
QColor Declaration::colorValue(const QPalette &pal) const
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index d91b095a76..ef5ae8c80b 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -198,6 +198,7 @@ enum Property {
QtLineHeightType,
FontKerning,
QtForegroundTextureCacheKey,
+ QtIcon,
NumProperties
};
@@ -855,6 +856,7 @@ struct Q_GUI_EXPORT ValueExtractor
bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg);
int extractStyleFeatures();
bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size);
+ bool extractIcon(QIcon *icon, QSize *size);
void lengthValues(const Declaration &decl, int *m);
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index d8a971c7b7..c843e3b706 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -850,7 +850,7 @@ QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other)
if (nbytes && other.data)
data = (uchar *)memcpy(malloc(nbytes), other.data, nbytes);
else
- data = 0;
+ data = nullptr;
}
QDistanceFieldData::~QDistanceFieldData()
@@ -952,7 +952,7 @@ void QDistanceField::setGlyph(QFontEngine *fontEngine, glyph_t glyph, bool doubl
{
QFixedPoint position;
QPainterPath path;
- fontEngine->addGlyphsToPath(&glyph, &position, 1, &path, 0);
+ fontEngine->addGlyphsToPath(&glyph, &position, 1, &path, { });
path.translate(-path.boundingRect().topLeft());
path.setFillRule(Qt::WindingFill);
@@ -1046,7 +1046,7 @@ const uchar *QDistanceField::constBits() const
uchar *QDistanceField::scanLine(int i)
{
if (isNull())
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < d->height);
return d->data + i * d->width;
@@ -1055,7 +1055,7 @@ uchar *QDistanceField::scanLine(int i)
const uchar *QDistanceField::scanLine(int i) const
{
if (isNull())
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < d->height);
return d->data + i * d->width;
@@ -1064,7 +1064,7 @@ const uchar *QDistanceField::scanLine(int i) const
const uchar *QDistanceField::constScanLine(int i) const
{
if (isNull())
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < d->height);
return d->data + i * d->width;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index bf130fa0b7..9ede90d8de 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -180,14 +180,14 @@ Q_GUI_EXPORT int qt_defaultDpi()
}
QFontPrivate::QFontPrivate()
- : engineData(0), dpi(qt_defaultDpi()),
+ : engineData(nullptr), dpi(qt_defaultDpi()),
underline(false), overline(false), strikeOut(false), kerning(true),
- capital(0), letterSpacingIsAbsolute(false), scFont(0)
+ capital(0), letterSpacingIsAbsolute(false), scFont(nullptr)
{
}
QFontPrivate::QFontPrivate(const QFontPrivate &other)
- : request(other.request), engineData(0), dpi(other.dpi),
+ : request(other.request), engineData(nullptr), dpi(other.dpi),
underline(other.underline), overline(other.overline),
strikeOut(other.strikeOut), kerning(other.kerning),
capital(other.capital), letterSpacingIsAbsolute(other.letterSpacingIsAbsolute),
@@ -202,10 +202,10 @@ QFontPrivate::~QFontPrivate()
{
if (engineData && !engineData->ref.deref())
delete engineData;
- engineData = 0;
+ engineData = nullptr;
if (scFont && scFont != this)
scFont->ref.deref();
- scFont = 0;
+ scFont = nullptr;
}
extern QRecursiveMutex *qt_fontdatabase_mutex();
@@ -221,7 +221,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const
// throw out engineData that came from a different thread
if (!engineData->ref.deref())
delete engineData;
- engineData = 0;
+ engineData = nullptr;
}
if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script))
QFontDatabase::load(this, script);
@@ -261,7 +261,7 @@ QFontPrivate *QFontPrivate::smallCapsFontPrivate() const
void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
{
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != nullptr);
dpi = other->dpi;
@@ -346,7 +346,7 @@ QFontEngineData::~QFontEngineData()
if (engines[i]) {
if (!engines[i]->ref.deref())
delete engines[i];
- engines[i] = 0;
+ engines[i] = nullptr;
}
}
}
@@ -610,10 +610,10 @@ void QFont::detach()
if (d->ref.loadRelaxed() == 1) {
if (d->engineData && !d->engineData->ref.deref())
delete d->engineData;
- d->engineData = 0;
+ d->engineData = nullptr;
if (d->scFont && d->scFont != d.data())
d->scFont->ref.deref();
- d->scFont = 0;
+ d->scFont = nullptr;
return;
}
@@ -1666,7 +1666,7 @@ void QFont::setRawMode(bool)
bool QFont::exactMatch() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return d->request.exactMatch(engine->fontDef);
}
@@ -1834,7 +1834,7 @@ Q_GLOBAL_STATIC(QFontSubst, globalFontSubst)
QString QFont::substitute(const QString &familyName)
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower());
if (it != fontSubst->constEnd() && !(*it).isEmpty())
return (*it).first();
@@ -1855,7 +1855,7 @@ QString QFont::substitute(const QString &familyName)
QStringList QFont::substitutes(const QString &familyName)
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
return fontSubst->value(familyName.toLower(), QStringList());
}
@@ -1870,7 +1870,7 @@ void QFont::insertSubstitution(const QString &familyName,
const QString &substituteName)
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
QStringList &list = (*fontSubst)[familyName.toLower()];
QString s = substituteName.toLower();
if (!list.contains(s))
@@ -1888,7 +1888,7 @@ void QFont::insertSubstitutions(const QString &familyName,
const QStringList &substituteNames)
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
QStringList &list = (*fontSubst)[familyName.toLower()];
for (const QString &substituteName : substituteNames) {
const QString lowerSubstituteName = substituteName.toLower();
@@ -1906,7 +1906,7 @@ void QFont::insertSubstitutions(const QString &familyName,
void QFont::removeSubstitutions(const QString &familyName)
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
fontSubst->remove(familyName.toLower());
}
@@ -1926,7 +1926,7 @@ void QFont::removeSubstitutions(const QString &familyName)
QStringList QFont::substitutions()
{
QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
+ Q_ASSERT(fontSubst != nullptr);
QStringList ret = fontSubst->keys();
ret.sort();
@@ -1940,7 +1940,7 @@ QStringList QFont::substitutions()
*/
static quint8 get_font_bits(int version, const QFontPrivate *f)
{
- Q_ASSERT(f != 0);
+ Q_ASSERT(f != nullptr);
quint8 bits = 0;
if (f->request.style)
bits |= 0x01;
@@ -1965,7 +1965,7 @@ static quint8 get_font_bits(int version, const QFontPrivate *f)
static quint8 get_extended_font_bits(const QFontPrivate *f)
{
- Q_ASSERT(f != 0);
+ Q_ASSERT(f != nullptr);
quint8 bits = 0;
if (f->request.ignorePitch)
bits |= 0x01;
@@ -1980,7 +1980,7 @@ static quint8 get_extended_font_bits(const QFontPrivate *f)
*/
static void set_font_bits(int version, quint8 bits, QFontPrivate *f)
{
- Q_ASSERT(f != 0);
+ Q_ASSERT(f != nullptr);
f->request.style = (bits & 0x01) != 0 ? QFont::StyleItalic : QFont::StyleNormal;
f->underline = (bits & 0x02) != 0;
f->overline = (bits & 0x40) != 0;
@@ -1995,7 +1995,7 @@ static void set_font_bits(int version, quint8 bits, QFontPrivate *f)
static void set_extended_font_bits(quint8 bits, QFontPrivate *f)
{
- Q_ASSERT(f != 0);
+ Q_ASSERT(f != nullptr);
f->request.ignorePitch = (bits & 0x01) != 0;
f->letterSpacingIsAbsolute = (bits & 0x02) != 0;
}
@@ -2549,7 +2549,7 @@ QFontInfo &QFontInfo::operator=(const QFontInfo &fi)
QString QFontInfo::family() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.family;
}
@@ -2564,7 +2564,7 @@ QString QFontInfo::family() const
QString QFontInfo::styleName() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.styleName;
}
@@ -2576,7 +2576,7 @@ QString QFontInfo::styleName() const
int QFontInfo::pointSize() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->fontDef.pointSize);
}
@@ -2588,7 +2588,7 @@ int QFontInfo::pointSize() const
qreal QFontInfo::pointSizeF() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.pointSize;
}
@@ -2600,7 +2600,7 @@ qreal QFontInfo::pointSizeF() const
int QFontInfo::pixelSize() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.pixelSize;
}
@@ -2612,7 +2612,7 @@ int QFontInfo::pixelSize() const
bool QFontInfo::italic() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.style != QFont::StyleNormal;
}
@@ -2624,7 +2624,7 @@ bool QFontInfo::italic() const
QFont::Style QFontInfo::style() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return (QFont::Style)engine->fontDef.style;
}
@@ -2636,7 +2636,7 @@ QFont::Style QFontInfo::style() const
int QFontInfo::weight() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->fontDef.weight;
}
@@ -2701,13 +2701,13 @@ bool QFontInfo::strikeOut() const
bool QFontInfo::fixedPitch() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
#ifdef Q_OS_MAC
if (!engine->fontDef.fixedPitchComputed) {
QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') };
QGlyphLayoutArray<2> g;
int l = 2;
- if (!engine->stringToCMap(ch, 2, &g, &l, 0))
+ if (!engine->stringToCMap(ch, 2, &g, &l, {}))
Q_UNREACHABLE();
Q_ASSERT(l == 2);
engine->fontDef.fixedPitch = g.advances[0] == g.advances[1];
@@ -2727,7 +2727,7 @@ bool QFontInfo::fixedPitch() const
QFont::StyleHint QFontInfo::styleHint() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return (QFont::StyleHint) engine->fontDef.styleHint;
}
@@ -2759,7 +2759,7 @@ bool QFontInfo::rawMode() const
bool QFontInfo::exactMatch() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return d->request.exactMatch(engine->fontDef);
}
@@ -2793,7 +2793,7 @@ QFontCache *QFontCache::instance()
void QFontCache::cleanup()
{
- QThreadStorage<QFontCache *> *cache = 0;
+ QThreadStorage<QFontCache *> *cache = nullptr;
QT_TRY {
cache = theFontCache();
} QT_CATCH (const std::bad_alloc &) {
@@ -2830,7 +2830,7 @@ void QFontCache::clear()
Q_ASSERT(engineCacheCount.value(data->engines[i]) == 0);
delete data->engines[i];
}
- data->engines[i] = 0;
+ data->engines[i] = nullptr;
}
}
if (!data->ref.deref()) {
@@ -2863,7 +2863,7 @@ void QFontCache::clear()
FC_DEBUG("QFontCache::clear: engine %p still has refcount %d",
engine, engine->ref.loadRelaxed());
}
- it.value().data = 0;
+ it.value().data = nullptr;
}
}
} while (mightHaveEnginesLeftForCleanup);
@@ -2881,7 +2881,7 @@ QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const
{
EngineDataCache::ConstIterator it = engineDataCache.constFind(def);
if (it == engineDataCache.constEnd())
- return 0;
+ return nullptr;
// found
return it.value();
@@ -2912,7 +2912,7 @@ QFontEngine *QFontCache::findEngine(const Key &key)
{
EngineCache::Iterator it = engineCache.find(key),
end = engineCache.end();
- if (it == end) return 0;
+ if (it == end) return nullptr;
Q_ASSERT(it.value().data != nullptr);
Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi));
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 67702ab5b5..f2fd585835 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -210,7 +210,7 @@ struct QtFontStyle
QtFontStyle(const Key &k)
: key(k), bitmapScalable(false), smoothScalable(false),
- count(0), pixelSizes(0)
+ count(0), pixelSizes(nullptr)
{
}
@@ -265,7 +265,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
return pixelSizes + i;
}
if (!add)
- return 0;
+ return nullptr;
if (!pixelSizes) {
// Most style have only one font size, we avoid waisting memory
@@ -280,13 +280,13 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
pixelSizes = newPixelSizes;
}
pixelSizes[count].pixelSize = size;
- pixelSizes[count].handle = 0;
+ pixelSizes[count].handle = nullptr;
return pixelSizes + (count++);
}
struct QtFontFoundry
{
- QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {}
+ QtFontFoundry(const QString &n) : name(n), count(0), styles(nullptr) {}
~QtFontFoundry() {
while (count--)
delete styles[count];
@@ -314,7 +314,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &st
}
}
if (!create)
- return 0;
+ return nullptr;
// qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos);
if (!(count % 8)) {
@@ -345,7 +345,7 @@ struct QtFontFamily
:
populated(false),
fixedPitch(false),
- name(n), count(0), foundries(0)
+ name(n), count(0), foundries(nullptr)
{
memset(writingSystems, 0, sizeof(writingSystems));
}
@@ -381,7 +381,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
return foundries[i];
}
if (!create)
- return 0;
+ return nullptr;
if (!(count % 8)) {
QtFontFoundry **newFoundries = (QtFontFoundry **)
@@ -450,7 +450,7 @@ class QFontDatabasePrivate
{
public:
QFontDatabasePrivate()
- : count(0), families(0),
+ : count(0), families(nullptr),
fallbacksCache(64)
{ }
@@ -469,7 +469,7 @@ public:
while (count--)
delete families[count];
::free(families);
- families = 0;
+ families = nullptr;
count = 0;
// don't clear the memory fonts!
}
@@ -505,7 +505,7 @@ void QFontDatabasePrivate::invalidate()
QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags)
{
- QtFontFamily *fam = 0;
+ QtFontFamily *fam = nullptr;
int low = 0;
int high = count;
@@ -645,7 +645,7 @@ static void parseFontName(const QString &name, QString &foundry, QString &family
struct QtFontDesc
{
- inline QtFontDesc() : family(0), foundry(0), style(0), size(0) {}
+ inline QtFontDesc() : family(nullptr), foundry(nullptr), style(nullptr), size(nullptr) {}
QtFontFamily *family;
QtFontFoundry *foundry;
QtFontStyle *style;
@@ -949,7 +949,7 @@ QFontEngine *loadSingleEngine(int script,
if (Q_UNLIKELY(!engine->supportsScript(QChar::Script(script)))) {
qWarning(" OpenType support missing for \"%s\", script %d",
qPrintable(def.family), script);
- return 0;
+ return nullptr;
}
engine->isSmoothlyScalable = style->smoothScalable;
@@ -976,7 +976,7 @@ QFontEngine *loadSingleEngine(int script,
+ qPrintable(def.family), script);
if (engine->ref.loadRelaxed() == 0)
delete engine;
- return 0;
+ return nullptr;
}
engine->isSmoothlyScalable = style->smoothScalable;
@@ -1081,9 +1081,9 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
Q_UNUSED(script);
Q_UNUSED(pitch);
- desc->foundry = 0;
- desc->style = 0;
- desc->size = 0;
+ desc->foundry = nullptr;
+ desc->style = nullptr;
+ desc->size = nullptr;
qCDebug(lcFontMatch, " REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
@@ -1104,7 +1104,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
}
int px = -1;
- QtFontSize *size = 0;
+ QtFontSize *size = nullptr;
// 1. see if we have an exact matching size
if (!(styleStrategy & QFont::ForceOutline)) {
@@ -1244,10 +1244,10 @@ static int match(int script, const QFontDef &request,
foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
- desc->family = 0;
- desc->foundry = 0;
- desc->style = 0;
- desc->size = 0;
+ desc->family = nullptr;
+ desc->foundry = nullptr;
+ desc->style = nullptr;
+ desc->size = nullptr;
unsigned int score = ~0u;
@@ -1280,7 +1280,7 @@ static int match(int script, const QFontDef &request,
bestFoundry(script, score, request.styleStrategy,
test.family, foundry_name, styleKey, request.pixelSize, pitch,
&test, request.styleName);
- if (test.foundry == 0 && !foundry_name.isEmpty()) {
+ if (test.foundry == nullptr && !foundry_name.isEmpty()) {
// the specific foundry was not found, so look for
// any foundry matching our requirements
newscore = bestFoundry(script, score, request.styleStrategy, test.family,
@@ -2068,7 +2068,7 @@ bool QFontDatabase::isPrivateFamily(const QString &family) const
*/
QString QFontDatabase::writingSystemName(WritingSystem writingSystem)
{
- const char *name = 0;
+ const char *name = nullptr;
switch (writingSystem) {
case Any:
name = QT_TRANSLATE_NOOP("QFontDatabase", "Any");
@@ -2548,7 +2548,7 @@ QStringList QFontDatabase::applicationFontFamilies(int id)
QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type)
{
- const QFont *font = 0;
+ const QFont *font = nullptr;
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
switch (type) {
case GeneralFont:
@@ -2825,7 +2825,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
if (fe->type() == QFontEngine::Box && !req.families.at(0).isEmpty()) {
if (fe->ref.loadRelaxed() == 0)
delete fe;
- fe = 0;
+ fe = nullptr;
} else {
if (d->dpi > 0)
fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / d->dpi));
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 403a0510fa..3ca9e9bbde 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -141,7 +141,7 @@ static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGl
qglyphs.glyphs = const_cast<glyph_t *>(glyphs);
qglyphs.advances = reinterpret_cast<QFixed *>(advances);
- fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
+ fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags{});
}
static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length)
@@ -221,7 +221,7 @@ static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer,
#ifdef QT_BUILD_INTERNAL
// for testing purpose only, not thread-safe!
-static QList<QFontEngine *> *enginesCollector = 0;
+static QList<QFontEngine *> *enginesCollector = nullptr;
Q_AUTOTEST_EXPORT void QFontEngine_startCollectingEngines()
{
@@ -234,7 +234,7 @@ Q_AUTOTEST_EXPORT QList<QFontEngine *> QFontEngine_stopCollectingEngines()
Q_ASSERT(enginesCollector);
QList<QFontEngine *> ret = *enginesCollector;
delete enginesCollector;
- enginesCollector = 0;
+ enginesCollector = nullptr;
return ret;
}
#endif // QT_BUILD_INTERNAL
@@ -506,7 +506,7 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
g.numGlyphs = 1;
g.glyphs = &kashidaGlyph;
g.advances = &kashidaWidth;
- recalcAdvances(&g, 0);
+ recalcAdvances(&g, { });
for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) {
xpos -= kashidaWidth;
@@ -569,9 +569,9 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
{
glyph_metrics_t gi = boundingBox(glyph);
- if (leftBearing != 0)
+ if (leftBearing != nullptr)
*leftBearing = gi.leftBearing().toReal();
- if (rightBearing != 0)
+ if (rightBearing != nullptr)
*rightBearing = gi.rightBearing().toReal();
}
@@ -948,7 +948,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
im.fill(Qt::transparent);
QPainter p(&im);
p.setRenderHint(QPainter::Antialiasing);
- addGlyphsToPath(&glyph, &pt, 1, &path, 0);
+ addGlyphsToPath(&glyph, &pt, 1, &path, { });
p.setPen(Qt::NoPen);
p.setBrush(Qt::black);
p.drawPath(path);
@@ -1022,7 +1022,7 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
{
QByteArray table;
uint len = 0;
- if (!getSfntTableData(tag, 0, &len))
+ if (!getSfntTableData(tag, nullptr, &len))
return table;
table.resize(len);
if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len))
@@ -1231,11 +1231,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
// version check
quint16 version;
if (!qSafeFromBigEndian(header, endPtr, &version) || version != 0)
- return 0;
+ return nullptr;
quint16 numTables;
if (!qSafeFromBigEndian(header + 2, endPtr, &numTables))
- return 0;
+ return nullptr;
const uchar *maps = table + 4;
@@ -1255,11 +1255,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
for (int n = 0; n < numTables; ++n) {
quint16 platformId;
if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId))
- return 0;
+ return nullptr;
quint16 platformSpecificId = 0;
if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId))
- return 0;
+ return nullptr;
switch (platformId) {
case 0: // Unicode
@@ -1309,38 +1309,38 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
}
}
if(tableToUse < 0)
- return 0;
+ return nullptr;
resolveTable:
*isSymbolFont = (symbolTable > -1);
quint32 unicode_table = 0;
if (!qSafeFromBigEndian(maps + 8 * tableToUse + 4, endPtr, &unicode_table))
- return 0;
+ return nullptr;
if (!unicode_table)
- return 0;
+ return nullptr;
// get the header of the unicode table
header = table + unicode_table;
quint16 format;
if (!qSafeFromBigEndian(header, endPtr, &format))
- return 0;
+ return nullptr;
quint32 length;
if (format < 8) {
quint16 tmp;
if (!qSafeFromBigEndian(header + 2, endPtr, &tmp))
- return 0;
+ return nullptr;
length = tmp;
} else {
if (!qSafeFromBigEndian(header + 4, endPtr, &length))
- return 0;
+ return nullptr;
}
if (table + unicode_table + length > endPtr)
- return 0;
+ return nullptr;
*cmapSize = length;
// To support symbol fonts that contain a unicode table for the symbol area
@@ -1844,7 +1844,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
return engine;
}
- return 0;
+ return nullptr;
}
glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
@@ -1865,7 +1865,7 @@ glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x);
engine = m_engines.at(x);
}
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == Box)
continue;
@@ -1934,7 +1934,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
if (!engine)
continue;
}
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == Box)
continue;
@@ -2308,7 +2308,7 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit
*/
QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script)
{
- QFontEngine *engine = 0;
+ QFontEngine *engine = nullptr;
QFontCache::Key key(fe->fontDef, script, /*multi = */true);
QFontCache *fc = QFontCache::instance();
// We can't rely on the fontDef (and hence the cache Key)
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
index 409176d41b..e00f9d058c 100644
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ b/src/gui/text/qfontengine_qpf2.cpp
@@ -151,17 +151,17 @@ static inline const uchar *verifyTag(const uchar *tagPtr, const uchar *endPtr)
const QFontEngineQPF2::Glyph *QFontEngineQPF2::findGlyph(glyph_t g) const
{
if (!g || g >= glyphMapEntries)
- return 0;
+ return nullptr;
const quint32 *gmapPtr = reinterpret_cast<const quint32 *>(fontData + glyphMapOffset);
quint32 glyphPos = qFromBigEndian<quint32>(gmapPtr[g]);
if (glyphPos > glyphDataSize) {
if (glyphPos == 0xffffffff)
- return 0;
+ return nullptr;
#if defined(DEBUG_FONTENGINE)
qDebug() << "glyph" << g << "outside of glyphData, remapping font file";
#endif
if (glyphPos > glyphDataSize)
- return 0;
+ return nullptr;
}
return reinterpret_cast<const Glyph *>(fontData + glyphDataOffset + glyphPos);
}
@@ -230,7 +230,7 @@ QFontEngineQPF2::QFontEngineQPF2(const QFontDef &def, const QByteArray &data)
{
fontDef = def;
cache_cost = 100;
- cmap = 0;
+ cmap = nullptr;
cmapOffset = 0;
cmapSize = 0;
glyphMapOffset = 0;
@@ -456,7 +456,7 @@ glyph_metrics_t QFontEngineQPF2::boundingBox(glyph_t glyph)
QFixed QFontEngineQPF2::ascent() const
{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
+ return QFixed::fromReal(qvariant_cast<qreal>(extractHeaderField(fontData, Tag_Ascent)));
}
QFixed QFontEngineQPF2::capHeight() const
@@ -466,37 +466,37 @@ QFixed QFontEngineQPF2::capHeight() const
QFixed QFontEngineQPF2::descent() const
{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
+ return QFixed::fromReal(qvariant_cast<qreal>(extractHeaderField(fontData, Tag_Descent)));
}
QFixed QFontEngineQPF2::leading() const
{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Leading).value<qreal>());
+ return QFixed::fromReal(qvariant_cast<qreal>(extractHeaderField(fontData, Tag_Leading)));
}
qreal QFontEngineQPF2::maxCharWidth() const
{
- return extractHeaderField(fontData, Tag_MaxCharWidth).value<qreal>();
+ return qvariant_cast<qreal>(extractHeaderField(fontData, Tag_MaxCharWidth));
}
qreal QFontEngineQPF2::minLeftBearing() const
{
- return extractHeaderField(fontData, Tag_MinLeftBearing).value<qreal>();
+ return qvariant_cast<qreal>(extractHeaderField(fontData, Tag_MinLeftBearing));
}
qreal QFontEngineQPF2::minRightBearing() const
{
- return extractHeaderField(fontData, Tag_MinRightBearing).value<qreal>();
+ return qvariant_cast<qreal>(extractHeaderField(fontData, Tag_MinRightBearing));
}
QFixed QFontEngineQPF2::underlinePosition() const
{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_UnderlinePosition).value<qreal>());
+ return QFixed::fromReal(qvariant_cast<qreal>(extractHeaderField(fontData, Tag_UnderlinePosition)));
}
QFixed QFontEngineQPF2::lineThickness() const
{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value<qreal>());
+ return QFixed::fromReal(qvariant_cast<qreal>(extractHeaderField(fontData, Tag_LineThickness)));
}
bool QFontEngineQPF2::isValid() const
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index d3e4f11e8c..a79957797d 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -282,7 +282,7 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const
int QFontMetrics::ascent() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->ascent());
}
@@ -301,7 +301,7 @@ int QFontMetrics::ascent() const
int QFontMetrics::capHeight() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->capHeight());
}
@@ -318,7 +318,7 @@ int QFontMetrics::capHeight() const
int QFontMetrics::descent() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->descent());
}
@@ -332,7 +332,7 @@ int QFontMetrics::descent() const
int QFontMetrics::height() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->ascent()) + qRound(engine->descent());
}
@@ -346,7 +346,7 @@ int QFontMetrics::height() const
int QFontMetrics::leading() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->leading());
}
@@ -360,7 +360,7 @@ int QFontMetrics::leading() const
int QFontMetrics::lineSpacing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->leading()) + qRound(engine->ascent()) + qRound(engine->descent());
}
@@ -377,7 +377,7 @@ int QFontMetrics::lineSpacing() const
int QFontMetrics::minLeftBearing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->minLeftBearing());
}
@@ -394,7 +394,7 @@ int QFontMetrics::minLeftBearing() const
int QFontMetrics::minRightBearing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->minRightBearing());
}
@@ -404,7 +404,7 @@ int QFontMetrics::minRightBearing() const
int QFontMetrics::maxWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->maxCharWidth());
}
@@ -415,7 +415,7 @@ int QFontMetrics::maxWidth() const
int QFontMetrics::xHeight() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (d->capital == QFont::SmallCaps)
return qRound(d->smallCapsFontPrivate()->engineForScript(QChar::Script_Common)->ascent());
return qRound(engine->xHeight());
@@ -429,7 +429,7 @@ int QFontMetrics::xHeight() const
int QFontMetrics::averageCharWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->averageCharWidth());
}
@@ -450,7 +450,7 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const
{
const int script = QChar::script(ucs4);
QFontEngine *engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return false;
return engine->canRender(ucs4);
@@ -476,7 +476,7 @@ int QFontMetrics::leftBearing(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return 0;
@@ -509,7 +509,7 @@ int QFontMetrics::rightBearing(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return 0;
@@ -518,7 +518,7 @@ int QFontMetrics::rightBearing(QChar ch) const
glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal rb;
- engine->getGlyphBearings(glyph, 0, &rb);
+ engine->getGlyphBearings(glyph, nullptr, &rb);
return qRound(rb);
}
@@ -562,7 +562,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0))
+ if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, { }))
Q_UNREACHABLE();
QFixed width;
@@ -673,7 +673,7 @@ int QFontMetrics::horizontalAdvance(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
d->alterCharForCapitalization(ch);
@@ -684,7 +684,7 @@ int QFontMetrics::horizontalAdvance(QChar ch) const
glyphs.numGlyphs = 1;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
- engine->recalcAdvances(&glyphs, 0);
+ engine->recalcAdvances(&glyphs, { });
return qRound(advance);
}
@@ -725,7 +725,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
d->alterCharForCapitalization(ch);
@@ -736,7 +736,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
glyphs.numGlyphs = 1;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
- engine->recalcAdvances(&glyphs, 0);
+ engine->recalcAdvances(&glyphs, { });
width = qRound(advance);
}
@@ -800,7 +800,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
d->alterCharForCapitalization(ch);
@@ -877,7 +877,7 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te
QRectF rb;
QRectF rr(rect);
qt_format_text(QFont(d.data()), rr, flags | Qt::TextDontPrint, text, &rb, tabStops, tabArray,
- tabArrayLen, 0);
+ tabArrayLen, nullptr);
return rb.toAlignedRect();
}
@@ -994,7 +994,7 @@ QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, in
int QFontMetrics::underlinePos() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->underlinePosition());
}
@@ -1030,7 +1030,7 @@ int QFontMetrics::strikeOutPos() const
int QFontMetrics::lineWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return qRound(engine->lineThickness());
}
@@ -1248,7 +1248,7 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const
qreal QFontMetricsF::ascent() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->ascent().toReal();
}
@@ -1267,7 +1267,7 @@ qreal QFontMetricsF::ascent() const
qreal QFontMetricsF::capHeight() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->capHeight().toReal();
}
@@ -1285,7 +1285,7 @@ qreal QFontMetricsF::capHeight() const
qreal QFontMetricsF::descent() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->descent().toReal();
}
@@ -1299,7 +1299,7 @@ qreal QFontMetricsF::descent() const
qreal QFontMetricsF::height() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return (engine->ascent() + engine->descent()).toReal();
}
@@ -1314,7 +1314,7 @@ qreal QFontMetricsF::height() const
qreal QFontMetricsF::leading() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->leading().toReal();
}
@@ -1328,7 +1328,7 @@ qreal QFontMetricsF::leading() const
qreal QFontMetricsF::lineSpacing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return (engine->leading() + engine->ascent() + engine->descent()).toReal();
}
@@ -1345,7 +1345,7 @@ qreal QFontMetricsF::lineSpacing() const
qreal QFontMetricsF::minLeftBearing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->minLeftBearing();
}
@@ -1362,7 +1362,7 @@ qreal QFontMetricsF::minLeftBearing() const
qreal QFontMetricsF::minRightBearing() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->minRightBearing();
}
@@ -1372,7 +1372,7 @@ qreal QFontMetricsF::minRightBearing() const
qreal QFontMetricsF::maxWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->maxCharWidth();
}
@@ -1383,7 +1383,7 @@ qreal QFontMetricsF::maxWidth() const
qreal QFontMetricsF::xHeight() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (d->capital == QFont::SmallCaps)
return d->smallCapsFontPrivate()->engineForScript(QChar::Script_Common)->ascent().toReal();
return engine->xHeight().toReal();
@@ -1397,7 +1397,7 @@ qreal QFontMetricsF::xHeight() const
qreal QFontMetricsF::averageCharWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->averageCharWidth().toReal();
}
@@ -1420,7 +1420,7 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const
{
const int script = QChar::script(ucs4);
QFontEngine *engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return false;
return engine->canRender(ucs4);
@@ -1446,7 +1446,7 @@ qreal QFontMetricsF::leftBearing(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return 0;
@@ -1479,7 +1479,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == QFontEngine::Box)
return 0;
@@ -1488,7 +1488,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal rb;
- engine->getGlyphBearings(glyph, 0, &rb);
+ engine->getGlyphBearings(glyph, nullptr, &rb);
return rb;
}
@@ -1608,7 +1608,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
d->alterCharForCapitalization(ch);
@@ -1619,7 +1619,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
glyphs.numGlyphs = 1;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
- engine->recalcAdvances(&glyphs, 0);
+ engine->recalcAdvances(&glyphs, { });
return advance.toReal();
}
@@ -1679,7 +1679,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
engine = d->smallCapsFontPrivate()->engineForScript(script);
else
engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
d->alterCharForCapitalization(ch);
@@ -1758,7 +1758,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
QRectF rb;
qt_format_text(QFont(d.data()), rect, flags | Qt::TextDontPrint, text, &rb, tabStops, tabArray,
- tabArrayLen, 0);
+ tabArrayLen, nullptr);
return rb;
}
@@ -1877,7 +1877,7 @@ QString QFontMetricsF::elidedText(const QString &text, Qt::TextElideMode mode, q
qreal QFontMetricsF::underlinePos() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->underlinePosition().toReal();
}
@@ -1912,7 +1912,7 @@ qreal QFontMetricsF::strikeOutPos() const
qreal QFontMetricsF::lineWidth() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
return engine->lineThickness().toReal();
}
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 3c16c3bf62..f4cd839f15 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -279,7 +279,7 @@ void QGlyphRun::clear()
{
detach();
d->rawFont = QRawFont();
- d->flags = 0;
+ d->flags = { };
setPositions(QVector<QPointF>());
setGlyphIndexes(QVector<quint32>());
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 465c3c7000..46e2a8bbfb 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -65,8 +65,7 @@ class QGlyphRunPrivate: public QSharedData
{
public:
QGlyphRunPrivate()
- : flags(nullptr)
- , glyphIndexData(glyphIndexes.constData())
+ : glyphIndexData(glyphIndexes.constData())
, glyphIndexDataSize(0)
, glyphPositionData(glyphPositions.constData())
, glyphPositionDataSize(0)
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 2f25aea92b..397e6cc49f 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2013 Konstantin Ritt
** Contact: https://www.qt.io/licensing/
**
@@ -216,7 +216,20 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_MASARAM_GONDI,
HB_SCRIPT_NUSHU,
HB_SCRIPT_SOYOMBO,
- HB_SCRIPT_ZANABAZAR_SQUARE
+ HB_SCRIPT_ZANABAZAR_SQUARE,
+
+ // Unicode 12.1 additions (not present in harfbuzz-ng 1.7.4)
+ hb_script_t(HB_TAG('D', 'o', 'g', 'r')), // Script_Dogra
+ hb_script_t(HB_TAG('G', 'o', 'n', 'g')), // Script_GunjalaGondi
+ hb_script_t(HB_TAG('R', 'o', 'h', 'g')), // Script_HanifiRohingya
+ hb_script_t(HB_TAG('M', 'a', 'k', 'a')), // Script_Makasar
+ hb_script_t(HB_TAG('M', 'e', 'd', 'f')), // Script_Medefaidrin
+ hb_script_t(HB_TAG('S', 'o', 'g', 'o')), // Script_OldSogdian
+ hb_script_t(HB_TAG('S', 'o', 'g', 'd')), // Script_Sogdian
+ hb_script_t(HB_TAG('E', 'l', 'y', 'm')), // Script_Elymaic
+ hb_script_t(HB_TAG('N', 'a', 'n', 'd')), // Script_Nandinagari
+ hb_script_t(HB_TAG('H', 'm', 'n', 'p')), // Script_NyiakengPuachueHmong
+ hb_script_t(HB_TAG('W', 'c', 'h', 'o')), // Script_Wancho
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
@@ -682,12 +695,12 @@ _hb_qt_font_create(QFontEngine *fe)
return NULL;
}
- const int y_ppem = fe->fontDef.pixelSize;
- const int x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100;
+ const qreal y_ppem = fe->fontDef.pixelSize;
+ const qreal x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100.0;
hb_font_set_funcs(font, hb_qt_get_font_funcs(), (void *)fe, NULL);
- hb_font_set_scale(font, QFixed(x_ppem).value(), -QFixed(y_ppem).value());
- hb_font_set_ppem(font, x_ppem, y_ppem);
+ hb_font_set_scale(font, QFixed::fromReal(x_ppem).value(), -QFixed::fromReal(y_ppem).value());
+ hb_font_set_ppem(font, int(x_ppem), int(y_ppem));
hb_font_set_ptem(font, fe->fontDef.pointSize);
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 90322b24da..02e25bb6af 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -368,7 +368,7 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
Q_UNUSED(pixelSize);
Q_UNUSED(hintingPreference);
qWarning("This plugin does not support font engines created directly from font data");
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index a060448924..884525bd76 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -303,7 +303,7 @@ QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const
QFixedPoint position;
QPainterPath path;
- d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, 0);
+ d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, { });
return path;
}
@@ -750,7 +750,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
int script = qt_script_for_writing_system(writingSystem);
QFontEngine *fe = font_d->engineForScript(script);
- if (fe != 0 && fe->type() == QFontEngine::Multi) {
+ if (fe != nullptr && fe->type() == QFontEngine::Multi) {
QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(fe);
fe = multiEngine->engine(0);
@@ -770,7 +770,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
Q_ASSERT(fe);
}
- if (fe != 0) {
+ if (fe != nullptr) {
rawFont.d.data()->setFontEngine(fe);
rawFont.d.data()->hintingPreference = font.hintingPreference();
}
@@ -795,7 +795,7 @@ void QRawFont::setPixelSize(qreal pixelSize)
void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize,
QFont::HintingPreference hintingPreference)
{
- Q_ASSERT(fontEngine == 0);
+ Q_ASSERT(fontEngine == nullptr);
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
setFontEngine(pfdb->fontEngine(fontData, pixelSize, hintingPreference));
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 490e0b6b8f..e588b44efd 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -403,7 +403,7 @@ QSizeF QStaticText::size() const
}
QStaticTextPrivate::QStaticTextPrivate()
- : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0),
+ : textWidth(-1.0), items(nullptr), itemCount(0), glyphPool(nullptr), positionPool(nullptr),
needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText),
untransformedCoordinates(false)
{
@@ -411,7 +411,7 @@ QStaticTextPrivate::QStaticTextPrivate()
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
: text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix),
- items(0), itemCount(0), glyphPool(0), positionPool(0), textOption(other.textOption),
+ items(nullptr), itemCount(0), glyphPool(nullptr), positionPool(nullptr), textOption(other.textOption),
needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations),
textFormat(other.textFormat), untransformedCoordinates(other.untransformedCoordinates)
{
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index cf584f6980..b50957d63d 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -299,7 +299,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent)
: QObject(*new QSyntaxHighlighterPrivate, parent)
{
if (parent && parent->inherits("QTextEdit")) {
- QTextDocument *doc = parent->property("document").value<QTextDocument *>();
+ QTextDocument *doc = qvariant_cast<QTextDocument *>(parent->property("document"));
if (doc)
setDocument(doc);
}
@@ -321,7 +321,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QTextDocument *parent)
*/
QSyntaxHighlighter::~QSyntaxHighlighter()
{
- setDocument(0);
+ setDocument(nullptr);
}
/*!
@@ -601,7 +601,7 @@ QTextBlockUserData *QSyntaxHighlighter::currentBlockUserData() const
{
Q_D(const QSyntaxHighlighter);
if (!d->currentBlock.isValid())
- return 0;
+ return nullptr;
return d->currentBlock.userData();
}
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 056a854789..fa323ef4bd 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -371,7 +371,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
int newPosition = position;
- if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != 0) {
+ if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != nullptr) {
if ((op >= QTextCursor::EndOfLine && op <= QTextCursor::NextWord)
|| (op >= QTextCursor::Right && op <= QTextCursor::WordRight)) {
QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
@@ -671,7 +671,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
QTextTable *QTextCursorPrivate::complexSelectionTable() const
{
if (position == anchor)
- return 0;
+ return nullptr;
QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
if (t) {
@@ -681,7 +681,7 @@ QTextTable *QTextCursorPrivate::complexSelectionTable() const
Q_ASSERT(cell_anchor.isValid());
if (cell_pos == cell_anchor)
- t = 0;
+ t = nullptr;
}
return t;
}
@@ -1044,7 +1044,7 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
Constructs a null cursor.
*/
QTextCursor::QTextCursor()
- : d(0)
+ : d(nullptr)
{
}
@@ -1623,7 +1623,7 @@ bool QTextCursor::hasComplexSelection() const
if (!d)
return false;
- return d->complexSelectionTable() != 0;
+ return d->complexSelectionTable() != nullptr;
}
/*!
@@ -2111,7 +2111,7 @@ QTextList *QTextCursor::insertList(QTextListFormat::Style style)
QTextList *QTextCursor::createList(const QTextListFormat &format)
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
QTextList *list = static_cast<QTextList *>(d->priv->createObject(format));
QTextBlockFormat modifier;
@@ -2146,7 +2146,7 @@ QTextList *QTextCursor::createList(QTextListFormat::Style style)
QTextList *QTextCursor::currentList() const
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
QTextBlockFormat b = blockFormat();
QTextObject *o = d->priv->objectForFormat(b);
@@ -2186,7 +2186,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols)
QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat &format)
{
if(!d || !d->priv || rows == 0 || cols == 0)
- return 0;
+ return nullptr;
int pos = d->position;
QTextTable *t = QTextTablePrivate::createTable(d->priv, d->position, rows, cols, format);
@@ -2206,7 +2206,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat
QTextTable *QTextCursor::currentTable() const
{
if(!d || !d->priv)
- return 0;
+ return nullptr;
QTextFrame *frame = d->priv->frameAt(d->position);
while (frame) {
@@ -2215,7 +2215,7 @@ QTextTable *QTextCursor::currentTable() const
return table;
frame = frame->parentFrame();
}
- return 0;
+ return nullptr;
}
/*!
@@ -2230,7 +2230,7 @@ QTextTable *QTextCursor::currentTable() const
QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format)
{
if (!d || !d->priv)
- return 0;
+ return nullptr;
return d->priv->insertFrame(selectionStart(), selectionEnd(), format);
}
@@ -2243,7 +2243,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format)
QTextFrame *QTextCursor::currentFrame() const
{
if(!d || !d->priv)
- return 0;
+ return nullptr;
return d->priv->frameAt(d->position);
}
@@ -2604,7 +2604,7 @@ QTextDocument *QTextCursor::document() const
{
if (d->priv)
return d->priv->document();
- return 0; // document went away
+ return nullptr; // document went away
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 25c153910d..fb75954d9c 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1678,7 +1678,7 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, const QTextCurso
*/
QTextObject *QTextDocument::createObject(const QTextFormat &f)
{
- QTextObject *obj = 0;
+ QTextObject *obj = nullptr;
if (f.isListFormat())
obj = new QTextList(this);
else if (f.isTableFormat())
@@ -2423,7 +2423,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
sizeof("small") + sizeof("medium") + 1, // "x-large" )> compressed into "xx-large"
sizeof("small") + sizeof("medium"), // "xx-large" )
};
- const char *name = 0;
+ const char *name = nullptr;
const int idx = format.intProperty(QTextFormat::FontSizeAdjustment) + 1;
if (idx >= 0 && idx <= 4) {
name = sizeNameData + sizeNameOffsets[idx];
@@ -3074,7 +3074,7 @@ void QTextDocumentPrivate::mergeCachedResources(const QTextDocumentPrivate *priv
if (!priv)
return;
- cachedResources.unite(priv->cachedResources);
+ cachedResources.insert(priv->cachedResources);
}
void QTextHtmlExporter::emitBackgroundAttribute(const QTextFormat &format)
@@ -3257,7 +3257,7 @@ void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt)
QTextFrame::Iterator next = frameIt;
++next;
if (next.atEnd()
- && frameIt.currentFrame() == 0
+ && frameIt.currentFrame() == nullptr
&& frameIt.parentFrame() != doc->rootFrame()
&& frameIt.currentBlock().begin().atEnd())
return;
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index a1b1c2e92b..524931ebde 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -185,7 +185,7 @@ QTextDocumentPrivate::QTextDocumentPrivate()
docChangeOldLength(0),
docChangeLength(0),
framesDirty(true),
- rtFrame(0),
+ rtFrame(nullptr),
initialBlockCharFormatIndex(-1) // set correctly later in init()
{
editBlock = 0;
@@ -195,7 +195,7 @@ QTextDocumentPrivate::QTextDocumentPrivate()
undoState = 0;
revision = -1; // init() inserts a block, bringing it to 0
- lout = 0;
+ lout = nullptr;
modified = false;
modifiedState = 0;
@@ -243,7 +243,7 @@ void QTextDocumentPrivate::clear()
curs->adjusted_anchor = 0;
}
- QList<QTextCursorPrivate *>oldCursors = cursors;
+ QSet<QTextCursorPrivate *> oldCursors = cursors;
QT_TRY{
cursors.clear();
@@ -272,7 +272,7 @@ void QTextDocumentPrivate::clear()
blocks.clear();
cachedResources.clear();
delete rtFrame;
- rtFrame = 0;
+ rtFrame = nullptr;
init();
cursors = oldCursors;
{
@@ -290,7 +290,7 @@ void QTextDocumentPrivate::clear()
QTextDocumentPrivate::~QTextDocumentPrivate()
{
for (QTextCursorPrivate *curs : qAsConst(cursors))
- curs->priv = 0;
+ curs->priv = nullptr;
cursors.clear();
undoState = 0;
undoEnabled = true;
@@ -643,7 +643,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
// qDebug("remove_block at %d", key);
Q_ASSERT(X->size_array[0] == 1 && isValidBlockSeparator(text.at(X->stringPosition)));
b = blocks.previous(b);
- B = 0;
+ B = nullptr;
c.command = blocks.size(b) == 1 ? QTextUndoCommand::BlockDeleted : QTextUndoCommand::BlockRemoved;
w = remove_block(key, &c.blockFormat, QTextUndoCommand::BlockAdded, op);
@@ -1437,7 +1437,7 @@ static QTextFrame *findChildFrame(QTextFrame *f, int pos)
else
return c;
}
- return 0;
+ return nullptr;
}
QTextFrame *QTextDocumentPrivate::rootFrame() const
@@ -1467,7 +1467,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f)
for (int i = 0; i < f->d_func()->childFrames.count(); ++i)
clearFrame(f->d_func()->childFrames.at(i));
f->d_func()->childFrames.clear();
- f->d_func()->parentFrame = 0;
+ f->d_func()->parentFrame = nullptr;
}
void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded)
@@ -1551,7 +1551,7 @@ QTextFrame *QTextDocumentPrivate::insertFrame(int start, int end, const QTextFra
Q_ASSERT(start <= end || end == -1);
if (start != end && frameAt(start) != frameAt(end))
- return 0;
+ return nullptr;
beginEditBlock();
@@ -1599,7 +1599,7 @@ void QTextDocumentPrivate::removeFrame(QTextFrame *frame)
QTextObject *QTextDocumentPrivate::objectForIndex(int objectIndex) const
{
if (objectIndex < 0)
- return 0;
+ return nullptr;
QTextObject *object = objects.value(objectIndex, 0);
if (!object) {
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 40252c93eb..ce8e905eb0 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -277,8 +277,8 @@ private:
public:
void documentChange(int from, int length);
- inline void addCursor(QTextCursorPrivate *c) { cursors.append(c); }
- inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); }
+ inline void addCursor(QTextCursorPrivate *c) { cursors.insert(c); }
+ inline void removeCursor(QTextCursorPrivate *c) { cursors.remove(c); }
QTextFrame *frameAt(int pos) const;
QTextFrame *rootFrame() const;
@@ -330,7 +330,7 @@ private:
BlockMap blocks;
int initialBlockCharFormatIndex;
- QList<QTextCursorPrivate *> cursors;
+ QSet<QTextCursorPrivate *> cursors;
QMap<int, QTextObject *> objects;
QMap<QUrl, QVariant> resources;
QMap<QUrl, QVariant> cachedResources;
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 742c56382d..d7bc707491 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -277,7 +277,7 @@ void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const
\sa isEmpty()
*/
QTextDocumentFragment::QTextDocumentFragment()
- : d(0)
+ : d(nullptr)
{
}
@@ -287,7 +287,7 @@ QTextDocumentFragment::QTextDocumentFragment()
like the document's title.
*/
QTextDocumentFragment::QTextDocumentFragment(const QTextDocument *document)
- : d(0)
+ : d(nullptr)
{
if (!document)
return;
@@ -304,7 +304,7 @@ QTextDocumentFragment::QTextDocumentFragment(const QTextDocument *document)
\sa isEmpty(), QTextCursor::selection()
*/
QTextDocumentFragment::QTextDocumentFragment(const QTextCursor &cursor)
- : d(0)
+ : d(nullptr)
{
if (!cursor.hasSelection())
return;
@@ -678,7 +678,7 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processSpecialNodes()
if (n->parent)
n = &at(n->parent);
else
- n = 0;
+ n = nullptr;
}
}
@@ -793,7 +793,7 @@ bool QTextHtmlImporter::closeTag()
bool blockTagClosed = false;
while (depth > endDepth) {
- Table *t = 0;
+ Table *t = nullptr;
if (!tables.isEmpty())
t = &tables.last();
@@ -816,7 +816,7 @@ bool QTextHtmlImporter::closeTag()
indent = t->lastIndent;
tables.resize(tables.size() - 1);
- t = 0;
+ t = nullptr;
if (tables.isEmpty()) {
cursor = doc->rootFrame()->lastCursorPosition();
@@ -1123,7 +1123,7 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processBlockNode()
// for list items we may want to collapse with the bottom margin of the
// list.
- const QTextHtmlParserNode *parentNode = currentNode->parent ? &at(currentNode->parent) : 0;
+ const QTextHtmlParserNode *parentNode = currentNode->parent ? &at(currentNode->parent) : nullptr;
if ((currentNode->id == Html_li || currentNode->id == Html_dt || currentNode->id == Html_dd)
&& parentNode
&& (parentNode->isListStart() || parentNode->id == Html_dl)
@@ -1270,7 +1270,7 @@ void QTextHtmlImporter::appendBlock(const QTextBlockFormat &format, QTextCharFor
QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html)
{
- return fromHtml(html, 0);
+ return fromHtml(html, nullptr);
}
/*!
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index ed23a4d8d9..e21a8d8d52 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -111,7 +111,7 @@ public:
QTextFrameData::QTextFrameData()
: maximumWidth(QFIXED_MAX),
- currentLayoutStruct(0), sizeDirty(true), layoutDirty(true)
+ currentLayoutStruct(nullptr), sizeDirty(true), layoutDirty(true)
{
}
@@ -571,7 +571,7 @@ public:
void setCellPosition(QTextTable *t, const QTextTableCell &cell, const QPointF &pos);
QRectF layoutTable(QTextTable *t, int layoutFrom, int layoutTo, QFixed parentY);
- void positionFloat(QTextFrame *frame, QTextLine *currentLine = 0);
+ void positionFloat(QTextFrame *frame, QTextLine *currentLine = nullptr);
// calls the next one
QRectF layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY = 0);
@@ -1554,7 +1554,7 @@ static inline double prioritizedEdgeAnchorOffset(const QTextDocumentLayoutPrivat
competingCell = adjacentCell(table, cell, orthogonalEdge);
if (competingCell.isValid()) {
checkJoinedEdge(table, td, competingCell, edgeData.edge, edgeData, couldHaveContinuation,
- &maxCompetingEdgeData, 0);
+ &maxCompetingEdgeData, nullptr);
}
}
@@ -1946,7 +1946,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
QTextFrame::Iterator it, const QList<QTextFrame *> &floats, QTextBlock *cursorBlockNeedingRepaint) const
{
Q_Q(const QTextDocumentLayout);
- const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == 0);
+ const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == nullptr);
QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
if (inRootFrame && context.clip.isValid()) {
@@ -1954,7 +1954,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
}
QTextBlock previousBlock;
- QTextFrame *previousFrame = 0;
+ QTextFrame *previousFrame = nullptr;
for (; !it.atEnd(); ++it) {
QTextFrame *c = it.currentFrame();
@@ -2050,7 +2050,7 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain
QVector<QTextLayout::FormatRange> selections;
int blpos = bl.position();
int bllen = bl.length();
- const QTextCharFormat *selFormat = 0;
+ const QTextCharFormat *selFormat = nullptr;
for (int i = 0; i < context.selections.size(); ++i) {
const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);
const int selStart = range.cursor.selectionStart() - blpos;
@@ -2920,7 +2920,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in
QTextFrameFormat fformat = f->frameFormat();
QTextFrame *parent = f->parentFrame();
- const QTextFrameData *pd = parent ? data(parent) : 0;
+ const QTextFrameData *pd = parent ? data(parent) : nullptr;
const qreal maximumWidth = qMax(qreal(0), pd ? pd->contentsWidth.toReal() : document->pageSize().width());
QFixed width = QFixed::fromReal(fformat.width().value(maximumWidth));
@@ -2971,7 +2971,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in
}
QTextFrame *parent = f->parentFrame();
- const QTextFrameData *pd = parent ? data(parent) : 0;
+ const QTextFrameData *pd = parent ? data(parent) : nullptr;
// accumulate top and bottom margins
if (parent) {
@@ -3296,7 +3296,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
const QFixed origMaximumWidth = layoutStruct->maximumWidth;
layoutStruct->maximumWidth = 0;
- const QTextBlockFormat *previousBlockFormatPtr = 0;
+ const QTextBlockFormat *previousBlockFormatPtr = nullptr;
if (lastIt.currentBlock().isValid())
previousBlockFormatPtr = &previousBlockFormat;
@@ -3405,7 +3405,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
}
- fd->currentLayoutStruct = 0;
+ fd->currentLayoutStruct = nullptr;
}
static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling,
@@ -3865,7 +3865,7 @@ int QTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accur
d->ensureLayouted(QFixed::fromReal(point.y()));
QTextFrame *f = d->docPrivate->rootFrame();
int position = 0;
- QTextLayout *l = 0;
+ QTextLayout *l = nullptr;
QFixedPoint pointf;
pointf.x = QFixed::fromReal(point.x());
pointf.y = QFixed::fromReal(point.y());
@@ -3944,7 +3944,7 @@ void QTextDocumentLayout::positionInlineObject(QTextInlineObject item, int posIn
line = b.layout()->lineAt(b.layout()->lineCount()-1);
// qDebug() << "layoutObject: line.isValid" << line.isValid() << b.position() << b.length() <<
// frame->firstPosition() << frame->lastPosition();
- d->positionFloat(frame, line.isValid() ? &line : 0);
+ d->positionFloat(frame, line.isValid() ? &line : nullptr);
}
void QTextDocumentLayout::drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item,
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index 193d2c0dd3..0bafa5d9ff 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -107,7 +107,7 @@ public:
\internal
*/
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
- : device(0),
+ : device(nullptr),
deleteDevice(false),
#if QT_CONFIG(textcodec)
codec(QTextCodec::codecForName("utf-8")),
@@ -320,7 +320,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
*/
bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
{
- if (fragment.d == 0)
+ if (fragment.d == nullptr)
return false; // invalid fragment.
QTextDocument *doc = fragment.d->doc;
if (doc)
@@ -337,7 +337,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
#if QT_CONFIG(textcodec)
void QTextDocumentWriter::setCodec(QTextCodec *codec)
{
- if (codec == 0)
+ if (codec == nullptr)
codec = QTextCodec::codecForName("UTF-8");
Q_ASSERT(codec);
d->codec = codec;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 209433dac5..0024f070ea 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -72,7 +72,7 @@ public:
: m_string(string),
m_analysis(analysis),
m_items(items),
- m_splitter(0)
+ m_splitter(nullptr)
{
}
~Itemizer()
@@ -138,7 +138,7 @@ private:
if (!m_splitter)
m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word,
m_string.constData(), m_string.length(),
- /*buffer*/0, /*buffer size*/0);
+ /*buffer*/nullptr, /*buffer size*/0);
m_splitter->setPosition(start);
QScriptAnalysis itemAnalysis = m_analysis[start];
@@ -1680,8 +1680,8 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
QGlyphLayout g = availableGlyphs(&si).mid(glyphs_shaped, num_glyphs);
ushort *log_clusters = logClusters(&si) + item_pos;
- hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, 0);
- hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, 0);
+ hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, nullptr);
+ hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, nullptr);
uint str_pos = 0;
uint last_cluster = ~0u;
uint last_glyph_pos = glyphs_shaped;
@@ -1720,7 +1720,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
g.glyphs[i] = actualFontEngine->glyphIndex('-');
if (Q_LIKELY(g.glyphs[i] != 0)) {
QGlyphLayout tmp = g.mid(i, 1);
- actualFontEngine->recalcAdvances(&tmp, 0);
+ actualFontEngine->recalcAdvances(&tmp, { });
}
g.attributes[i].dontPrint = true;
}
@@ -1896,7 +1896,7 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri
}
if (kerningEnabled && !shaper_item.kerning_applied)
- actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
+ actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags{});
if (engineIdx != 0) {
for (quint32 i = 0; i < shaper_item.num_glyphs; ++i)
@@ -1917,12 +1917,12 @@ void QTextEngine::init(QTextEngine *e)
e->visualMovement = false;
e->delayDecorations = false;
- e->layoutData = 0;
+ e->layoutData = nullptr;
e->minWidth = 0;
e->maxWidth = 0;
- e->specialData = 0;
+ e->specialData = nullptr;
e->stackEngine = false;
#ifndef QT_NO_RAWFONT
e->useRawFont = false;
@@ -1956,7 +1956,7 @@ const QCharAttributes *QTextEngine::attributes() const
itemize();
if (! ensureSpace(layoutData->string.length()))
- return NULL;
+ return nullptr;
QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems(layoutData->items.size());
for (int i = 0; i < layoutData->items.size(); ++i) {
@@ -2148,7 +2148,7 @@ void QTextEngine::itemize() const
if (it == end || format != frag->format) {
if (s && position >= s->preeditPosition) {
position += s->preeditText.length();
- s = 0;
+ s = nullptr;
}
Q_ASSERT(position <= length);
QFont::Capitalization capitalization =
@@ -2443,8 +2443,8 @@ QTextEngine::FontEngineCache::FontEngineCache()
//input is common (and hard to cache at a higher level)
QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFixed *descent, QFixed *leading) const
{
- QFontEngine *engine = 0;
- QFontEngine *scaledEngine = 0;
+ QFontEngine *engine = nullptr;
+ QFontEngine *scaledEngine = nullptr;
int script = si.analysis.script;
QFont font = fnt;
@@ -2459,7 +2459,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
engine->ref.ref();
if (feCache.prevScaledFontEngine) {
releaseCachedFontEngine(feCache.prevScaledFontEngine);
- feCache.prevScaledFontEngine = 0;
+ feCache.prevScaledFontEngine = nullptr;
}
}
if (si.analysis.flags == QScriptAnalysis::SmallCaps) {
@@ -2538,7 +2538,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
feCache.prevScript = script;
feCache.prevPosition = -1;
feCache.prevLength = -1;
- feCache.prevScaledFontEngine = 0;
+ feCache.prevScaledFontEngine = nullptr;
}
}
@@ -2581,7 +2581,7 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph,
g.numGlyphs = 1;
g.glyphs = &kashidaGlyph;
g.advances = &point->kashidaWidth;
- fe->recalcAdvances(&g, 0);
+ fe->recalcAdvances(&g, { });
if (point->kashidaWidth == 0)
point->type = Justification_Prohibited;
@@ -2808,14 +2808,14 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng)
QTextEngine::LayoutData::LayoutData()
{
- memory = 0;
+ memory = nullptr;
allocated = 0;
memory_on_stack = false;
used = 0;
hasBidi = false;
layoutState = LayoutEmpty;
haveCharAttributes = false;
- logClustersPtr = 0;
+ logClustersPtr = nullptr;
available_glyphs = 0;
}
@@ -2833,8 +2833,8 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int
allocated = 0;
memory_on_stack = false;
- memory = 0;
- logClustersPtr = 0;
+ memory = nullptr;
+ logClustersPtr = nullptr;
} else {
memory_on_stack = true;
memory = stack_memory;
@@ -2855,7 +2855,7 @@ QTextEngine::LayoutData::~LayoutData()
{
if (!memory_on_stack)
free(memory);
- memory = 0;
+ memory = nullptr;
}
bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
@@ -2879,7 +2879,7 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
return false;
}
- void **newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *));
+ void **newMem = (void **)::realloc(memory_on_stack ? nullptr : memory, newAllocated*sizeof(void *));
if (!newMem) {
layoutState = LayoutFailed;
return false;
@@ -2928,7 +2928,7 @@ void QTextEngine::freeMemory()
{
if (!stackEngine) {
delete layoutData;
- layoutData = 0;
+ layoutData = nullptr;
} else {
layoutData->used = 0;
layoutData->hasBidi = false;
@@ -3035,7 +3035,7 @@ void QTextEngine::setPreeditArea(int position, const QString &preeditText)
return;
if (specialData->formats.isEmpty()) {
delete specialData;
- specialData = 0;
+ specialData = nullptr;
} else {
specialData->preeditText = QString();
specialData->preeditPosition = -1;
@@ -3057,7 +3057,7 @@ void QTextEngine::setFormats(const QVector<QTextLayout::FormatRange> &formats)
return;
if (specialData->preeditText.isEmpty()) {
delete specialData;
- specialData = 0;
+ specialData = nullptr;
} else {
specialData->formats.clear();
}
@@ -3214,13 +3214,13 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
glyphs.advances = &ellipsisWidth;
if (glyph != 0) {
- engine->recalcAdvances(&glyphs, 0);
+ engine->recalcAdvances(&glyphs, { });
ellipsisText = ellipsisChar;
} else {
glyph = engine->glyphIndex('.');
if (glyph != 0) {
- engine->recalcAdvances(&glyphs, 0);
+ engine->recalcAdvances(&glyphs, { });
ellipsisWidth *= 3;
ellipsisText = QStringLiteral("...");
@@ -3895,12 +3895,7 @@ QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f)
}
QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format)
- : justified(false),
- underlineStyle(QTextCharFormat::NoUnderline),
- charFormat(format),
- num_chars(0),
- chars(nullptr),
- logClusters(nullptr),
+ : charFormat(format),
f(font),
fontEngine(font->d->engineForScript(si.analysis.script))
{
@@ -3910,13 +3905,9 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
}
QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
- : flags(0),
- justified(false),
- underlineStyle(QTextCharFormat::NoUnderline),
- charFormat(format),
+ : charFormat(format),
num_chars(numChars),
chars(chars_),
- logClusters(nullptr),
f(font),
glyphs(g),
fontEngine(fe)
@@ -3928,7 +3919,7 @@ void QTextItemInt::initWithScriptItem(const QScriptItem &si)
{
// explicitly initialize flags so that initFontAttributes can be called
// multiple times on the same TextItem
- flags = 0;
+ flags = { };
if (si.analysis.bidiLevel %2)
flags |= QTextItem::RightToLeft;
ascent = si.ascent;
@@ -4013,7 +4004,7 @@ QTextLineItemIterator::QTextLineItemIterator(QTextEngine *_eng, int _lineNum, co
const QTextLayout::FormatRange *_selection)
: eng(_eng),
line(eng->lines[_lineNum]),
- si(0),
+ si(nullptr),
lineNum(_lineNum),
lineEnd(line.from + line.length),
firstItem(eng->findItem(line.from)),
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 76b9757eba..f069951ce5 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -303,10 +303,7 @@ struct QScriptItem;
class QTextItemInt : public QTextItem
{
public:
- inline QTextItemInt()
- : justified(false), underlineStyle(QTextCharFormat::NoUnderline), num_chars(0), chars(nullptr),
- logClusters(nullptr), f(nullptr), fontEngine(nullptr)
- {}
+ inline QTextItemInt() = default;
QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat());
QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe,
const QTextCharFormat &format = QTextCharFormat());
@@ -321,16 +318,16 @@ public:
QFixed width;
RenderFlags flags;
- bool justified;
- QTextCharFormat::UnderlineStyle underlineStyle;
+ bool justified = false;
+ QTextCharFormat::UnderlineStyle underlineStyle = QTextCharFormat::NoUnderline;
const QTextCharFormat charFormat;
- int num_chars;
- const QChar *chars;
- const unsigned short *logClusters;
- const QFont *f;
+ int num_chars = 0;
+ const QChar *chars = nullptr;
+ const unsigned short *logClusters = nullptr;
+ const QFont *f = nullptr;
QGlyphLayout glyphs;
- QFontEngine *fontEngine;
+ QFontEngine *fontEngine = nullptr;
};
struct QScriptItem
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index b867f42480..3b9f2d253e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -463,7 +463,7 @@ static const QTextHtmlElement *lookupElementHelper(const QString &element)
const QTextHtmlElement *end = &elements[Html_NumElements];
const QTextHtmlElement *e = std::lower_bound(start, end, element);
if ((e == end) || (element < *e))
- return 0;
+ return nullptr;
return e;
}
@@ -519,7 +519,7 @@ void QTextHtmlParser::dumpHtml()
QTextHtmlParserNode *QTextHtmlParser::newNode(int parent)
{
QTextHtmlParserNode *lastNode = &nodes.last();
- QTextHtmlParserNode *newNode = 0;
+ QTextHtmlParserNode *newNode = nullptr;
bool reuseLastNode = true;
@@ -2123,7 +2123,7 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
QCss::StyleSelector::NodePtr n;
n.id = node;
- const char *extraPseudo = 0;
+ const char *extraPseudo = nullptr;
if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
extraPseudo = "link";
// Ensure that our own style is taken into consideration
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index f7117bfe0a..14018f34da 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -246,7 +246,7 @@ QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, c
QImage QTextImageHandler::image(QTextDocument *doc, const QTextImageFormat &imageFormat)
{
- Q_ASSERT(doc != 0);
+ Q_ASSERT(doc != nullptr);
return getImage(doc, imageFormat);
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index a3e194f835..fc256d72f3 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1649,7 +1649,7 @@ namespace {
struct LineBreakHelper
{
LineBreakHelper()
- : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0),
+ : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(nullptr), logClusters(nullptr),
manualWrap(false), whiteSpaceOrObject(true)
{
}
@@ -1705,7 +1705,7 @@ namespace {
inline void calculateRightBearing(QFontEngine *engine, glyph_t glyph)
{
qreal rb;
- engine->getGlyphBearings(glyph, 0, &rb);
+ engine->getGlyphBearings(glyph, nullptr, &rb);
// We only care about negative right bearings, so we limit the range
// of the bearing here so that we can assume it's negative in the rest
@@ -2212,7 +2212,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
int textPosition,
int textLength)
{
- Q_ASSERT(logClusters != 0);
+ Q_ASSERT(logClusters != nullptr);
QGlyphRun glyphRun;
@@ -2593,7 +2593,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
} else { // si.isTab
QFont f = eng->font(si);
QTextItemInt gf(si, &f, format);
- gf.chars = 0;
+ gf.chars = nullptr;
gf.num_chars = 0;
gf.width = iterator.itemWidth;
QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng);
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index b845889c3d..77dcae0dc8 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -596,7 +596,7 @@ void QTextFramePrivate::remove_me()
parentFrame->d_func()->childFrames.removeAt(index);
childFrames.clear();
- parentFrame = 0;
+ parentFrame = nullptr;
}
/*!
@@ -654,10 +654,10 @@ QTextFrame::iterator QTextFrame::end() const
*/
QTextFrame::iterator::iterator()
{
- f = 0;
+ f = nullptr;
b = 0;
e = 0;
- cf = 0;
+ cf = nullptr;
cb = 0;
}
@@ -669,7 +669,7 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end)
f = frame;
b = begin;
e = end;
- cf = 0;
+ cf = nullptr;
cb = block;
}
@@ -739,7 +739,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator++()
if (cf) {
int end = cf->lastPosition() + 1;
cb = map.findNode(end);
- cf = 0;
+ cf = nullptr;
} else if (cb) {
cb = map.next(cb);
if (cb == e)
@@ -777,7 +777,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator--()
if (cf) {
int start = cf->firstPosition() - 1;
cb = map.findNode(start);
- cf = 0;
+ cf = nullptr;
} else {
if (cb == b)
goto end;
@@ -907,7 +907,7 @@ QTextBlockUserData::~QTextBlockUserData()
bool QTextBlock::isValid() const
{
- return p != 0 && p->blockMap().isValid(n);
+ return p != nullptr && p->blockMap().isValid(n);
}
/*!
@@ -1079,7 +1079,7 @@ bool QTextBlock::contains(int position) const
QTextLayout *QTextBlock::layout() const
{
if (!p || !n)
- return 0;
+ return nullptr;
const QTextBlockData *b = p->blockMap().fragment(n);
if (!b->layout)
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 0e8666565f..408e3ec167 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -70,7 +70,7 @@ static QString pixelToPoint(qreal pixels)
// strategies
class QOutputStrategy {
public:
- QOutputStrategy() : contentStream(0), counter(1) { }
+ QOutputStrategy() : contentStream(nullptr), counter(1) { }
virtual ~QOutputStrategy() {}
virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) = 0;
@@ -240,7 +240,7 @@ void QTextOdfWriter::writeFrame(QXmlStreamWriter &writer, const QTextFrame *fram
}
QTextFrame::iterator iterator = frame->begin();
- QTextFrame *child = 0;
+ QTextFrame *child = nullptr;
int tableRow = -1;
while (! iterator.atEnd()) {
@@ -437,7 +437,7 @@ static bool probeImageData(QIODevice *device, QImage *image, QString *mimeType,
void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextFragment &fragment) const
{
writer.writeStartElement(drawNS, QString::fromLatin1("frame"));
- if (m_strategy == 0) {
+ if (m_strategy == nullptr) {
// don't do anything.
}
else if (fragment.charFormat().isImageFormat()) {
@@ -997,8 +997,8 @@ QTextOdfWriter::QTextOdfWriter(const QTextDocument &document, QIODevice *device)
svgNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0")),
m_document(&document),
m_device(device),
- m_strategy(0),
- m_codec(0),
+ m_strategy(nullptr),
+ m_codec(nullptr),
m_createArchive(true)
{
}
@@ -1093,7 +1093,7 @@ bool QTextOdfWriter::writeAll()
writer.writeEndElement(); // document-content
writer.writeEndDocument();
delete m_strategy;
- m_strategy = 0;
+ m_strategy = nullptr;
return true;
}
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 2c2c05567f..2f195599f0 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -62,7 +62,7 @@ QTextOption::QTextOption()
unused2(0),
f(0),
tab(-1),
- d(0)
+ d(nullptr)
{
direction = Qt::LayoutDirectionAuto;
}
@@ -80,7 +80,7 @@ QTextOption::QTextOption(Qt::Alignment alignment)
unused2(0),
f(0),
tab(-1),
- d(0)
+ d(nullptr)
{
direction = QGuiApplication::layoutDirection();
}
@@ -107,7 +107,7 @@ QTextOption::QTextOption(const QTextOption &o)
unused2(o.unused2),
f(o.f),
tab(o.tab),
- d(0)
+ d(nullptr)
{
if (o.d)
d = new QTextOptionPrivate(*o.d);
@@ -124,7 +124,7 @@ QTextOption &QTextOption::operator=(const QTextOption &o)
if (this == &o)
return *this;
- QTextOptionPrivate* dNew = 0;
+ QTextOptionPrivate* dNew = nullptr;
if (o.d)
dNew = new QTextOptionPrivate(*o.d);
delete d;
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index fc7fbcac12..80c0f122e8 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -141,8 +141,8 @@ static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourc
if ((uLong)stream.avail_out != *destLen)
return Z_BUF_ERROR;
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
+ stream.zalloc = (alloc_func)nullptr;
+ stream.zfree = (free_func)nullptr;
err = inflateInit2(&stream, -MAX_WBITS);
if (err != Z_OK)
@@ -172,9 +172,9 @@ static int deflate (Bytef *dest, ulong *destLen, const Bytef *source, ulong sour
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
+ stream.zalloc = (alloc_func)nullptr;
+ stream.zfree = (free_func)nullptr;
+ stream.opaque = (voidpf)nullptr;
err = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
if (err != Z_OK) return err;
@@ -705,7 +705,7 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
}
// TODO add a check if data.length() > contents.length(). Then try to store the original and revert the compression method to be uncompressed
writeUInt(header.h.compressed_size, data.length());
- uint crc_32 = ::crc32(0, 0, 0);
+ uint crc_32 = ::crc32(0, nullptr, 0);
crc_32 = ::crc32(crc_32, (const uchar *)contents.constData(), contents.length());
writeUInt(header.h.crc_32, crc_32);
@@ -886,7 +886,7 @@ bool QZipReader::isReadable() const
bool QZipReader::exists() const
{
QFile *f = qobject_cast<QFile*> (d->device);
- if (f == 0)
+ if (f == nullptr)
return true;
return f->exists();
}
@@ -1178,7 +1178,7 @@ bool QZipWriter::isWritable() const
bool QZipWriter::exists() const
{
QFile *f = qobject_cast<QFile*> (d->device);
- if (f == 0)
+ if (f == nullptr)
return true;
return f->exists();
}
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 99214c4960..763f309fc7 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -287,7 +287,7 @@ void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, c
*/
void QDesktopServices::unsetUrlHandler(const QString &scheme)
{
- setUrlHandler(scheme, 0, 0);
+ setUrlHandler(scheme, nullptr, nullptr);
}
#if QT_DEPRECATED_SINCE(5, 0)
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp
index 33adac40b2..4af5e47f8f 100644
--- a/src/gui/util/qgridlayoutengine.cpp
+++ b/src/gui/util/qgridlayoutengine.cpp
@@ -177,7 +177,7 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo,
qreal extra = compare(box, totalBox, j);
if (extra > 0.0) {
calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(),
- 0, totalBox, rowInfo, snapToPixelGrid);
+ nullptr, totalBox, rowInfo, snapToPixelGrid);
for (int k = 0; k < span; ++k)
extras[k].q_sizes(j) = newSizes[k];
@@ -988,7 +988,7 @@ void QGridLayoutEngine::removeItem(QGridLayoutItem *item)
for (int i = item->firstRow(); i <= item->lastRow(); ++i) {
for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) {
if (itemAt(i, j) == item)
- setItemAt(i, j, 0);
+ setItemAt(i, j, nullptr);
}
}
@@ -1001,7 +1001,7 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int row, int column, Qt::Orientation
if (orientation == Qt::Horizontal)
qSwap(row, column);
if (uint(row) >= uint(rowCount()) || uint(column) >= uint(columnCount()))
- return 0;
+ return nullptr;
return q_grid.at((row * internalGridColumnCount()) + column);
}
@@ -1100,7 +1100,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
if (constraintOrientation() == Qt::Vertical) {
//We have items whose height depends on their width
if (constraint.width() >= 0) {
- ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo);
+ ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
QVector<qreal> sizehint_xx;
QVector<qreal> sizehint_widths;
@@ -1110,14 +1110,14 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(),
- 0, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
+ nullptr, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo);
sizeHintCalculated = true;
}
} else {
if (constraint.height() >= 0) {
//We have items whose width depends on their height
- ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo);
+ ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
QVector<qreal> sizehint_yy;
QVector<qreal> sizehint_heights;
@@ -1127,7 +1127,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(),
- 0, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
+ nullptr, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo);
sizeHintCalculated = true;
}
@@ -1137,8 +1137,8 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
}
//No items with height for width, so it doesn't matter which order we do these in
- ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo);
- ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo);
+ ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
+ ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
return QSizeF(q_totalBoxes[Hor].q_sizes(which), q_totalBoxes[Ver].q_sizes(which));
}
@@ -1147,7 +1147,7 @@ QLayoutPolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) con
Qt::Orientation orientation = (side == Top || side == Bottom) ? Qt::Vertical : Qt::Horizontal;
int row = (side == Top || side == Left) ? effectiveFirstRow(orientation)
: effectiveLastRow(orientation);
- QLayoutPolicy::ControlTypes result = 0;
+ QLayoutPolicy::ControlTypes result;
for (int column = columnCount(orientation) - 1; column >= 0; --column) {
if (QGridLayoutItem *item = itemAt(row, column, orientation))
@@ -1650,18 +1650,18 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size,
if (constraintOrientation() != Qt::Horizontal) {
//We might have items whose height depends on their width (HFW)
- ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo);
+ ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
+ nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
} else {
//We have items whose width depends on their height (WFH)
- ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo);
+ ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
@@ -1669,7 +1669,7 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size,
ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
+ nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
}
}
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index 5f0e84edb1..181326103b 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -276,7 +276,7 @@ class Q_GUI_EXPORT QGridLayoutItem
{
public:
QGridLayoutItem(int row, int column, int rowSpan = 1, int columnSpan = 1,
- Qt::Alignment alignment = nullptr);
+ Qt::Alignment alignment = { });
virtual ~QGridLayoutItem() {}
inline int firstRow() const { return q_firstRows[Ver]; }
@@ -339,7 +339,7 @@ private:
class Q_GUI_EXPORT QGridLayoutEngine
{
public:
- QGridLayoutEngine(Qt::Alignment defaultAlignment = Qt::Alignment(nullptr), bool snapToPixelGrid = false);
+ QGridLayoutEngine(Qt::Alignment defaultAlignment = { }, bool snapToPixelGrid = false);
inline ~QGridLayoutEngine() { qDeleteAll(q_items); }
int rowCount(Qt::Orientation orientation) const;
diff --git a/src/gui/util/qshadergenerator.cpp b/src/gui/util/qshadergenerator.cpp
index bcb985de54..4beed8ed25 100644
--- a/src/gui/util/qshadergenerator.cpp
+++ b/src/gui/util/qshadergenerator.cpp
@@ -273,11 +273,11 @@ namespace
const QByteArray placeholder = QByteArray(QByteArrayLiteral("$") + parameterName.toUtf8());
const QVariant parameter = node.parameter(parameterName);
if (parameter.userType() == qMetaTypeId<QShaderLanguage::StorageQualifier>()) {
- const QShaderLanguage::StorageQualifier qualifier = parameter.value<QShaderLanguage::StorageQualifier>();
+ const QShaderLanguage::StorageQualifier qualifier = qvariant_cast<QShaderLanguage::StorageQualifier>(parameter);
const QByteArray value = toGlsl(qualifier, format);
result.replace(placeholder, value);
} else if (parameter.userType() == qMetaTypeId<QShaderLanguage::VariableType>()) {
- const QShaderLanguage::VariableType type = parameter.value<QShaderLanguage::VariableType>();
+ const QShaderLanguage::VariableType type = qvariant_cast<QShaderLanguage::VariableType>(parameter);
const QByteArray value = toGlsl(type);
result.replace(placeholder, value);
} else {
diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp
index a393e876e0..26848020f2 100644
--- a/src/gui/util/qshadergraphloader.cpp
+++ b/src/gui/util/qshadergraphloader.cpp
@@ -136,7 +136,7 @@ void QShaderGraphLoader::load()
if (prototypesValue.isObject()) {
QShaderNodesLoader loader;
loader.load(prototypesValue.toObject());
- m_prototypes.unite(loader.nodes());
+ m_prototypes.insert(loader.nodes());
} else {
qWarning() << "Invalid prototypes property, should be an object";
m_status = Error;
diff --git a/src/gui/util/qtexturefiledata.cpp b/src/gui/util/qtexturefiledata.cpp
index ebf46f8e4e..41cbd1b15a 100644
--- a/src/gui/util/qtexturefiledata.cpp
+++ b/src/gui/util/qtexturefiledata.cpp
@@ -247,7 +247,7 @@ void QTextureFileData::setLogName(const QByteArray &name)
static QByteArray glFormatName(quint32 fmt)
{
- const char *id = 0;
+ const char *id = nullptr;
#if QT_CONFIG(opengl)
id = QMetaEnum::fromType<QOpenGLTexture::TextureFormat>().valueToKey(fmt);
#endif
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 2237b016e9..54cbb28ffa 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -688,7 +688,7 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL
return QValidator::Invalid;
bool ok = false;
- double i = buff.toDouble(&ok); // returns 0.0 if !ok
+ double i = locale.toDouble(input, &ok); // returns 0.0 if !ok
if (i == qt_qnan())
return QValidator::Invalid;
if (!ok)
diff --git a/src/gui/vulkan/qplatformvulkaninstance.cpp b/src/gui/vulkan/qplatformvulkaninstance.cpp
index 9d044bfd58..1b5d3370f0 100644
--- a/src/gui/vulkan/qplatformvulkaninstance.cpp
+++ b/src/gui/vulkan/qplatformvulkaninstance.cpp
@@ -80,6 +80,11 @@ QPlatformVulkanInstance::~QPlatformVulkanInstance()
{
}
+void QPlatformVulkanInstance::presentAboutToBeQueued(QWindow *window)
+{
+ Q_UNUSED(window);
+}
+
void QPlatformVulkanInstance::presentQueued(QWindow *window)
{
Q_UNUSED(window);
diff --git a/src/gui/vulkan/qplatformvulkaninstance.h b/src/gui/vulkan/qplatformvulkaninstance.h
index d47c59b5db..f96f1720fb 100644
--- a/src/gui/vulkan/qplatformvulkaninstance.h
+++ b/src/gui/vulkan/qplatformvulkaninstance.h
@@ -77,6 +77,7 @@ public:
virtual QByteArrayList enabledExtensions() const = 0;
virtual PFN_vkVoidFunction getInstanceProcAddr(const char *name) = 0;
virtual bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) = 0;
+ virtual void presentAboutToBeQueued(QWindow *window);
virtual void presentQueued(QWindow *window);
virtual void setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters);
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp
index 0605d88cca..4b961a6f20 100644
--- a/src/gui/vulkan/qvulkaninstance.cpp
+++ b/src/gui/vulkan/qvulkaninstance.cpp
@@ -251,7 +251,6 @@ public:
QVulkanInstancePrivate(QVulkanInstance *q)
: q_ptr(q),
vkInst(VK_NULL_HANDLE),
- flags(0),
errorCode(VK_SUCCESS)
{ }
~QVulkanInstancePrivate() { reset(); }
@@ -759,7 +758,7 @@ VkSurfaceKHR QVulkanInstance::surfaceForWindow(QWindow *window)
// VkSurfaceKHR is non-dispatchable and maps to a pointer on x64 and a uint64 on x86.
// Therefore a pointer is returned from the platform plugin, not the value itself.
void *p = nativeInterface->nativeResourceForWindow(QByteArrayLiteral("vkSurface"), window);
- return p ? *static_cast<VkSurfaceKHR *>(p) : 0;
+ return p ? *static_cast<VkSurfaceKHR *>(p) : VK_NULL_HANDLE;
}
/*!
@@ -775,6 +774,20 @@ bool QVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, uint32_t
}
/*!
+ This function should be called by the application's renderer before queuing
+ a present operation for \a window.
+
+ While on some platforms this will be a no-op, some may perform windowing
+ system dependent synchronization. For example, on Wayland this will
+ add send a wl_surface.frame request in order to prevent the driver from
+ blocking for minimized windows.
+ */
+void QVulkanInstance::presentAboutToBeQueued(QWindow *window)
+{
+ d_ptr->platformInst->presentAboutToBeQueued(window);
+}
+
+/*!
This function should be called by the application's renderer after queuing
a present operation for \a window.
diff --git a/src/gui/vulkan/qvulkaninstance.h b/src/gui/vulkan/qvulkaninstance.h
index 70f2fd5102..5b3db9a4c8 100644
--- a/src/gui/vulkan/qvulkaninstance.h
+++ b/src/gui/vulkan/qvulkaninstance.h
@@ -186,6 +186,7 @@ public:
bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window);
+ void presentAboutToBeQueued(QWindow *window);
void presentQueued(QWindow *window);
typedef bool (*DebugFilter)(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object,
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index 4b5c2b56ee..ed73a77683 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -647,18 +647,40 @@ void QVulkanWindowPrivate::init()
#endif
qCDebug(lcGuiVk, "Using queue families: graphics = %u present = %u", gfxQueueFamilyIdx, presQueueFamilyIdx);
- VkDeviceQueueCreateInfo queueInfo[2];
+ QVector<VkDeviceQueueCreateInfo> queueInfo;
+ queueInfo.reserve(2);
const float prio[] = { 0 };
- memset(queueInfo, 0, sizeof(queueInfo));
- queueInfo[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo[0].queueFamilyIndex = gfxQueueFamilyIdx;
- queueInfo[0].queueCount = 1;
- queueInfo[0].pQueuePriorities = prio;
+ VkDeviceQueueCreateInfo addQueueInfo;
+ memset(&addQueueInfo, 0, sizeof(addQueueInfo));
+ addQueueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
+ addQueueInfo.queueFamilyIndex = gfxQueueFamilyIdx;
+ addQueueInfo.queueCount = 1;
+ addQueueInfo.pQueuePriorities = prio;
+ queueInfo.append(addQueueInfo);
if (gfxQueueFamilyIdx != presQueueFamilyIdx) {
- queueInfo[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo[1].queueFamilyIndex = presQueueFamilyIdx;
- queueInfo[1].queueCount = 1;
- queueInfo[1].pQueuePriorities = prio;
+ addQueueInfo.queueFamilyIndex = presQueueFamilyIdx;
+ addQueueInfo.queueCount = 1;
+ addQueueInfo.pQueuePriorities = prio;
+ queueInfo.append(addQueueInfo);
+ }
+ if (queueCreateInfoModifier) {
+ queueCreateInfoModifier(queueFamilyProps.constData(), queueCount, queueInfo);
+ bool foundGfxQueue = false;
+ bool foundPresQueue = false;
+ for (const VkDeviceQueueCreateInfo& createInfo : qAsConst(queueInfo)) {
+ foundGfxQueue |= createInfo.queueFamilyIndex == gfxQueueFamilyIdx;
+ foundPresQueue |= createInfo.queueFamilyIndex == presQueueFamilyIdx;
+ }
+ if (!foundGfxQueue) {
+ qWarning("QVulkanWindow: Graphics queue missing after call to queueCreateInfoModifier");
+ status = StatusFail;
+ return;
+ }
+ if (!foundPresQueue) {
+ qWarning("QVulkanWindow: Present queue missing after call to queueCreateInfoModifier");
+ status = StatusFail;
+ return;
+ }
}
// Filter out unsupported extensions in order to keep symmetry
@@ -676,8 +698,8 @@ void QVulkanWindowPrivate::init()
VkDeviceCreateInfo devInfo;
memset(&devInfo, 0, sizeof(devInfo));
devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- devInfo.queueCreateInfoCount = gfxQueueFamilyIdx == presQueueFamilyIdx ? 1 : 2;
- devInfo.pQueueCreateInfos = queueInfo;
+ devInfo.queueCreateInfoCount = queueInfo.size();
+ devInfo.pQueueCreateInfos = queueInfo.constData();
devInfo.enabledExtensionCount = devExts.count();
devInfo.ppEnabledExtensionNames = devExts.constData();
@@ -1546,6 +1568,52 @@ bool QVulkanWindow::event(QEvent *e)
}
/*!
+ \typedef QVulkanWindow::QueueCreateInfoModifier
+
+ A function function that is called during graphics initialization to add
+ additAional queues that should be created.
+
+ Set if the renderer needs additional queues besides the default graphics
+ queue (e.g. a transfer queue).
+ The provided queue family properties can be used to select the indices for
+ the additional queues.
+ The renderer can subsequently request the actual queue in initResources().
+
+ Note when requesting additional graphics queues: Qt itself always requests
+ a graphics queue, you'll need to search queueCreateInfo for the appropriate
+ entry and manipulate it to obtain the additional queue.
+
+ \sa setQueueCreateInfoModifier()
+ */
+
+/*!
+ Return a previously set queue create info modification function.
+
+ \sa setQueueCreateInfoModifier()
+
+ \since 5.15
+ */
+QVulkanWindow::QueueCreateInfoModifier QVulkanWindow::queueCreateInfoModifier() const
+{
+ Q_D(const QVulkanWindow);
+ return d->queueCreateInfoModifier;
+}
+
+/*!
+ Set a queue create info modification function.
+
+ \sa queueCreateInfoModifier()
+
+ \since 5.15
+ */
+void QVulkanWindow::setQueueCreateInfoModifier(QueueCreateInfoModifier modifier)
+{
+ Q_D(QVulkanWindow);
+ d->queueCreateInfoModifier = modifier;
+}
+
+
+/*!
Returns true if this window has successfully initialized all Vulkan
resources, including the swapchain.
@@ -1798,7 +1866,7 @@ void QVulkanWindowPrivate::beginFrame()
// build new draw command buffer
if (image.cmdBuf) {
devFuncs->vkFreeCommandBuffers(dev, cmdPool, 1, &image.cmdBuf);
- image.cmdBuf = 0;
+ image.cmdBuf = nullptr;
}
VkCommandBufferAllocateInfo cmdBufInfo = {
@@ -1950,6 +2018,10 @@ void QVulkanWindowPrivate::endFrame()
presInfo.waitSemaphoreCount = 1;
presInfo.pWaitSemaphores = gfxQueueFamilyIdx == presQueueFamilyIdx ? &frame.drawSem : &frame.presTransSem;
+ // Do platform-specific WM notification. F.ex. essential on Wayland in
+ // order to circumvent driver frame callbacks
+ inst->presentAboutToBeQueued(q);
+
err = vkQueuePresentKHR(gfxQueue, &presInfo);
if (err != VK_SUCCESS) {
if (err == VK_ERROR_OUT_OF_DATE_KHR) {
@@ -2211,6 +2283,23 @@ VkQueue QVulkanWindow::graphicsQueue() const
}
/*!
+ Returns the family index of the active graphics queue.
+
+ \note Calling this function is only valid from the invocation of
+ QVulkanWindowRenderer::initResources() up until
+ QVulkanWindowRenderer::releaseResources(). Implementations of
+ QVulkanWindowRenderer::updateQueueCreateInfo() can also call this
+ function.
+
+ \since 5.15
+ */
+uint32_t QVulkanWindow::graphicsQueueFamilyIndex() const
+{
+ Q_D(const QVulkanWindow);
+ return d->gfxQueueFamilyIdx;
+}
+
+/*!
Returns the active graphics command pool.
\note Calling this function is only valid from the invocation of
diff --git a/src/gui/vulkan/qvulkanwindow.h b/src/gui/vulkan/qvulkanwindow.h
index 927c81042f..530b6c0744 100644
--- a/src/gui/vulkan/qvulkanwindow.h
+++ b/src/gui/vulkan/qvulkanwindow.h
@@ -103,6 +103,12 @@ public:
QVector<int> supportedSampleCounts();
void setSampleCount(int sampleCount);
+ typedef std::function<void(const VkQueueFamilyProperties *,
+ uint32_t,
+ QVector<VkDeviceQueueCreateInfo> &)> QueueCreateInfoModifier;
+ QueueCreateInfoModifier queueCreateInfoModifier() const;
+ void setQueueCreateInfoModifier(QueueCreateInfoModifier modifier);
+
bool isValid() const;
virtual QVulkanWindowRenderer *createRenderer();
@@ -112,6 +118,7 @@ public:
const VkPhysicalDeviceProperties *physicalDeviceProperties() const;
VkDevice device() const;
VkQueue graphicsQueue() const;
+ uint32_t graphicsQueueFamilyIndex() const;
VkCommandPool graphicsCommandPool() const;
uint32_t hostVisibleMemoryIndex() const;
uint32_t deviceLocalMemoryIndex() const;
diff --git a/src/gui/vulkan/qvulkanwindow_p.h b/src/gui/vulkan/qvulkanwindow_p.h
index fb374a5564..915e359673 100644
--- a/src/gui/vulkan/qvulkanwindow_p.h
+++ b/src/gui/vulkan/qvulkanwindow_p.h
@@ -97,11 +97,12 @@ public:
int physDevIndex = 0;
QVector<VkPhysicalDevice> physDevs;
QVector<VkPhysicalDeviceProperties> physDevProps;
- QVulkanWindow::Flags flags = nullptr;
+ QVulkanWindow::Flags flags;
QByteArrayList requestedDevExtensions;
QHash<VkPhysicalDevice, QVulkanInfoVector<QVulkanExtension> > supportedDevExtensions;
QVector<VkFormat> requestedColorFormats;
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT;
+ QVulkanWindow::QueueCreateInfoModifier queueCreateInfoModifier;
VkDevice dev = VK_NULL_HANDLE;
QVulkanDeviceFunctions *devFuncs;