From 913146ccd401216f71f037ea304b5e61b7a138cf Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 29 Nov 2019 12:41:38 +0100 Subject: RHI: new native texture API The new version takes/returns a value that can be unpacked and passed to other functions without knowing which backend is in use. The old API will be removed in a later change when dependent modules have been updated Task-number: QTBUG-78570 Change-Id: I18d928ceef3cb617c0c509ecccb345551a7990af Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhi.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++++ src/gui/rhi/qrhi_p.h | 7 +++++ src/gui/rhi/qrhid3d11.cpp | 28 ++++++++++++++++++ src/gui/rhi/qrhid3d11_p_p.h | 2 ++ src/gui/rhi/qrhigles2.cpp | 29 +++++++++++++++++++ src/gui/rhi/qrhigles2_p_p.h | 2 ++ src/gui/rhi/qrhimetal.mm | 29 +++++++++++++++++++ src/gui/rhi/qrhimetal_p_p.h | 2 ++ src/gui/rhi/qrhinull.cpp | 6 ++++ src/gui/rhi/qrhinull_p_p.h | 1 + src/gui/rhi/qrhivulkan.cpp | 30 ++++++++++++++++++++ src/gui/rhi/qrhivulkan_p_p.h | 2 ++ 12 files changed, 205 insertions(+) (limited to 'src/gui') diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index ece5190ff7..58f30deb41 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -2159,6 +2159,32 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const \value ASTC_12x12 */ +/*! + \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 */ @@ -2196,11 +2222,24 @@ 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. @@ -2224,12 +2263,40 @@ 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); return false; } +/*! + 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 diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 6fb9c44ae6..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_, diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 52109edce0..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(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]) diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h index 13c56b1d6d..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(); diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index b551980bb3..563d59b318 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -3404,11 +3404,40 @@ bool QGles2Texture::buildFrom(const QRhiNativeHandles *src) return true; } +bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src) +{ + const uint *textureId = static_cast(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) diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index b0f5e340fb..0283fadb4e 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); diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index e5af1cfab1..555ed5e79f 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -2499,11 +2499,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) *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 QMetalTextureData::viewForLevel(int level) { Q_ASSERT(level >= 0 && level < int(q->mipLevelCount)); diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h index 7876539fcd..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); diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp index 0baea1b9d6..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; diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h index c96f279f7d..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; diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 49ca2326bc..21ae142b1d 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -5370,12 +5370,42 @@ bool QVkTexture::buildFrom(const QRhiNativeHandles *src) return true; } +bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src) +{ + auto *img = static_cast(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)); diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h index ffa8c59ed5..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(); -- cgit v1.2.3 From 3359b29c99581f52acf033489ad35884a01ccac8 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 3 Dec 2019 11:13:42 +0100 Subject: QDoubleValidator: Fix thousand separator handling QDoubleValidator would accept "1,23" as valid in a locale which has ',' as a thousand separator. However, it should have been Intermediate instead, as there is still one digit missing. Fixes: QTBUG-75110 Change-Id: I6de90f0b6f1eae95dc8dfc8e5f9658e482e46db3 Reviewed-by: Ulf Hermann Reviewed-by: Edward Welbourne --- src/gui/util/qvalidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') 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) -- cgit v1.2.3 From d872719bf543a60108db88632d061e343e12b607 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 26 Nov 2018 10:18:24 +0100 Subject: Don't use QHash::unite to merge hashes QHash::unite can silently turn a regular QHash into a multi hash, something that is not intended here. Use a regular insert() instead. Change-Id: I9244a8553e84eed5367939019347b51491765ea0 Reviewed-by: Laszlo Agocs --- src/gui/util/qshadergraphloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') 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; -- cgit v1.2.3 From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/accessible/qaccessible.cpp | 20 ++-- src/gui/accessible/qaccessibleobject.cpp | 10 +- src/gui/accessible/qplatformaccessibility.cpp | 2 +- src/gui/animation/qguivariantanimation.cpp | 10 +- src/gui/image/qbmphandler.cpp | 4 +- src/gui/image/qicon.cpp | 16 ++-- src/gui/image/qiconloader.cpp | 2 +- src/gui/image/qimage.cpp | 46 ++++----- src/gui/image/qimage_conversions.cpp | 8 +- src/gui/image/qimageiohandler.cpp | 2 +- src/gui/image/qimagereader.cpp | 12 +-- src/gui/image/qimagereaderwriterhelpers.cpp | 6 +- src/gui/image/qimagewriter.cpp | 14 +-- src/gui/image/qmovie.cpp | 2 +- src/gui/image/qpaintengine_pic.cpp | 6 +- src/gui/image/qpicture.cpp | 22 ++--- src/gui/image/qpixmap.cpp | 6 +- src/gui/image/qpixmap_blitter.cpp | 8 +- src/gui/image/qpixmapcache.cpp | 14 +-- src/gui/image/qplatformpixmap.cpp | 2 +- src/gui/image/qpnghandler.cpp | 58 +++++------ src/gui/image/qxpmhandler.cpp | 4 +- src/gui/itemmodels/qstandarditemmodel.cpp | 92 +++++++++--------- src/gui/kernel/qclipboard.cpp | 6 +- src/gui/kernel/qcursor.cpp | 14 +-- src/gui/kernel/qdnd.cpp | 12 +-- src/gui/kernel/qdrag.cpp | 6 +- src/gui/kernel/qevent.cpp | 8 +- src/gui/kernel/qguiapplication.cpp | 106 ++++++++++----------- src/gui/kernel/qguivariant.cpp | 16 ++-- src/gui/kernel/qkeymapper.cpp | 2 +- src/gui/kernel/qoffscreensurface.cpp | 14 +-- src/gui/kernel/qopenglcontext.cpp | 56 +++++------ src/gui/kernel/qopenglwindow.cpp | 6 +- src/gui/kernel/qpaintdevicewindow.cpp | 2 +- src/gui/kernel/qpalette.cpp | 2 +- src/gui/kernel/qplatformclipboard.cpp | 2 +- src/gui/kernel/qplatformcursor.cpp | 10 +- src/gui/kernel/qplatforminputcontextfactory.cpp | 2 +- src/gui/kernel/qplatformintegration.cpp | 22 ++--- src/gui/kernel/qplatformintegrationplugin.cpp | 2 +- src/gui/kernel/qplatformnativeinterface.cpp | 20 ++-- src/gui/kernel/qplatformopenglcontext.cpp | 2 +- src/gui/kernel/qplatformscreen.cpp | 8 +- src/gui/kernel/qplatformtheme.cpp | 16 ++-- src/gui/kernel/qscreen.cpp | 2 +- src/gui/kernel/qsessionmanager.cpp | 2 +- src/gui/kernel/qshortcutmap.cpp | 12 +-- src/gui/kernel/qsimpledrag.cpp | 2 +- src/gui/kernel/qstylehints.cpp | 2 +- src/gui/kernel/qsurface.cpp | 2 +- src/gui/kernel/qwindow.cpp | 18 ++-- src/gui/kernel/qwindowsysteminterface.cpp | 2 +- src/gui/opengl/qopengl.cpp | 2 +- src/gui/opengl/qopenglbuffer.cpp | 10 +- src/gui/opengl/qopenglcustomshaderstage.cpp | 8 +- src/gui/opengl/qopengldebug.cpp | 24 ++--- src/gui/opengl/qopenglengineshadermanager.cpp | 20 ++-- src/gui/opengl/qopenglframebufferobject.cpp | 12 +-- src/gui/opengl/qopenglfunctions.cpp | 6 +- src/gui/opengl/qopenglfunctions_1_0.cpp | 6 +- src/gui/opengl/qopenglfunctions_1_1.cpp | 10 +- src/gui/opengl/qopenglfunctions_1_2.cpp | 14 +-- src/gui/opengl/qopenglfunctions_1_3.cpp | 18 ++-- src/gui/opengl/qopenglfunctions_1_4.cpp | 22 ++--- src/gui/opengl/qopenglfunctions_1_5.cpp | 24 ++--- src/gui/opengl/qopenglfunctions_2_0.cpp | 26 ++--- src/gui/opengl/qopenglfunctions_2_1.cpp | 28 +++--- src/gui/opengl/qopenglfunctions_3_0.cpp | 30 +++--- src/gui/opengl/qopenglfunctions_3_1.cpp | 22 ++--- .../opengl/qopenglfunctions_3_2_compatibility.cpp | 34 +++---- src/gui/opengl/qopenglfunctions_3_2_core.cpp | 24 ++--- .../opengl/qopenglfunctions_3_3_compatibility.cpp | 38 ++++---- src/gui/opengl/qopenglfunctions_3_3_core.cpp | 26 ++--- .../opengl/qopenglfunctions_4_0_compatibility.cpp | 40 ++++---- src/gui/opengl/qopenglfunctions_4_0_core.cpp | 28 +++--- .../opengl/qopenglfunctions_4_1_compatibility.cpp | 42 ++++---- src/gui/opengl/qopenglfunctions_4_1_core.cpp | 30 +++--- .../opengl/qopenglfunctions_4_2_compatibility.cpp | 44 ++++----- src/gui/opengl/qopenglfunctions_4_2_core.cpp | 32 +++---- .../opengl/qopenglfunctions_4_3_compatibility.cpp | 46 ++++----- src/gui/opengl/qopenglfunctions_4_3_core.cpp | 34 +++---- .../opengl/qopenglfunctions_4_4_compatibility.cpp | 48 +++++----- src/gui/opengl/qopenglfunctions_4_4_core.cpp | 36 +++---- .../opengl/qopenglfunctions_4_5_compatibility.cpp | 52 +++++----- src/gui/opengl/qopenglfunctions_4_5_core.cpp | 38 ++++---- src/gui/opengl/qopenglpaintdevice.cpp | 2 +- src/gui/opengl/qopenglpaintengine.cpp | 20 ++-- src/gui/opengl/qopenglshaderprogram.cpp | 12 +-- src/gui/opengl/qopengltexture.cpp | 32 +++---- src/gui/opengl/qopengltextureglyphcache.cpp | 34 +++---- src/gui/opengl/qopengltimerquery.cpp | 26 ++--- src/gui/opengl/qopenglversionfunctions.cpp | 2 +- src/gui/opengl/qopenglversionfunctionsfactory.cpp | 2 +- src/gui/opengl/qopenglvertexarrayobject.cpp | 16 ++-- src/gui/painting/qblittable.cpp | 2 +- src/gui/painting/qbrush.cpp | 14 +-- src/gui/painting/qcosmeticstroker.cpp | 6 +- src/gui/painting/qdrawhelper.cpp | 92 +++++++++--------- src/gui/painting/qemulationpaintengine.cpp | 2 +- src/gui/painting/qimagescale.cpp | 4 +- src/gui/painting/qmemrotate.cpp | 6 +- src/gui/painting/qoutlinemapper.cpp | 2 +- src/gui/painting/qpagesize.cpp | 20 ++-- src/gui/painting/qpaintdevice.cpp | 6 +- src/gui/painting/qpaintengine.cpp | 12 +-- src/gui/painting/qpaintengine_raster.cpp | 96 +++++++++---------- src/gui/painting/qpaintengineex.cpp | 30 +++--- src/gui/painting/qpainter.cpp | 54 +++++------ src/gui/painting/qpainterpath.cpp | 6 +- src/gui/painting/qpathclipper.cpp | 10 +- src/gui/painting/qpathsimplifier.cpp | 42 ++++---- src/gui/painting/qpdf.cpp | 18 ++-- src/gui/painting/qpdfwriter.cpp | 2 +- src/gui/painting/qpen.cpp | 2 +- src/gui/painting/qplatformbackingstore.cpp | 4 +- src/gui/painting/qrasterizer.cpp | 4 +- src/gui/painting/qregion.cpp | 74 +++++++------- src/gui/painting/qstroker.cpp | 10 +- src/gui/painting/qtextureglyphcache.cpp | 2 +- src/gui/painting/qtriangulatingstroker.cpp | 4 +- src/gui/painting/qtriangulator.cpp | 28 +++--- src/gui/text/qabstracttextdocumentlayout.cpp | 2 +- src/gui/text/qdistancefield.cpp | 8 +- src/gui/text/qfont.cpp | 74 +++++++------- src/gui/text/qfontdatabase.cpp | 50 +++++----- src/gui/text/qfontengine.cpp | 40 ++++---- src/gui/text/qfontengine_qpf2.cpp | 8 +- src/gui/text/qfontmetrics.cpp | 82 ++++++++-------- src/gui/text/qplatformfontdatabase.cpp | 2 +- src/gui/text/qrawfont.cpp | 6 +- src/gui/text/qstatictext.cpp | 4 +- src/gui/text/qsyntaxhighlighter.cpp | 4 +- src/gui/text/qtextcursor.cpp | 26 ++--- src/gui/text/qtextdocument.cpp | 6 +- src/gui/text/qtextdocument_p.cpp | 18 ++-- src/gui/text/qtextdocumentfragment.cpp | 16 ++-- src/gui/text/qtextdocumentlayout.cpp | 24 ++--- src/gui/text/qtextdocumentwriter.cpp | 6 +- src/gui/text/qtextengine.cpp | 44 ++++----- src/gui/text/qtexthtmlparser.cpp | 6 +- src/gui/text/qtextimagehandler.cpp | 2 +- src/gui/text/qtextlayout.cpp | 8 +- src/gui/text/qtextobject.cpp | 16 ++-- src/gui/text/qtextodfwriter.cpp | 12 +-- src/gui/text/qtextoption.cpp | 8 +- src/gui/text/qzip.cpp | 16 ++-- src/gui/util/qdesktopservices.cpp | 2 +- src/gui/util/qgridlayoutengine.cpp | 26 ++--- src/gui/util/qtexturefiledata.cpp | 2 +- src/gui/vulkan/qvulkaninstance.cpp | 2 +- src/gui/vulkan/qvulkanwindow.cpp | 2 +- 152 files changed, 1418 insertions(+), 1418 deletions(-) (limited to 'src/gui') 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, qAccessibleFactories) Q_GLOBAL_STATIC(QList, 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(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( - (QVariant (*)(const QColor &, const QColor &, qreal))0); + (QVariant (*)(const QColor &, const QColor &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0); + (QVariant (*)(const QVector2D &, const QVector2D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0); + (QVariant (*)(const QVector3D &, const QVector3D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0); + (QVariant (*)(const QVector4D &, const QVector4D &, qreal))nullptr); qRegisterAnimationInterpolator( - (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0); + (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))nullptr); } Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator) 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 869e206524..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; } /*! @@ -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(this); diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 8f33a13b95..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(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; @@ -314,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; 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..5e3b608d20 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; 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(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..9dcc955fe2 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 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; } /*! @@ -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(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(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(this)->cacheKeys.remove(key); - return 0; + return nullptr; } QPixmap *ptr = QCache::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 d6caf6773a..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; @@ -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) { @@ -910,16 +910,16 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const 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, int compression_in, const 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..2998808b54 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", @@ -139,7 +139,7 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item, } } if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; children.replace(index, item); if (item) @@ -412,7 +412,7 @@ void QStandardItemPrivate::setModel(QStandardItemModel *mod) */ QStandardItemModelPrivate::QStandardItemModelPrivate() : root(new QStandardItem), - itemPrototype(0), + itemPrototype(nullptr), sortRole(Qt::DisplayRole) { root->setFlags(Qt::ItemIsDropEnabled); @@ -510,12 +510,12 @@ bool QStandardItemPrivate::insertRows(int row, int count, const QListd_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 +555,12 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QListd_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 +583,7 @@ void QStandardItemModelPrivate::itemChanged(QStandardItem *item, const QVectord_func()->parent == 0) { + if (item->d_func()->parent == nullptr) { // Header item int idx = columnHeaderItems.indexOf(item); if (idx != -1) { @@ -679,7 +679,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 +698,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 +870,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 +890,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 +1794,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 +1821,7 @@ void QStandardItem::removeColumns(int column, int count) for (int j=i; jchildren.at(j); if (oldItem) - oldItem->d_func()->setModel(0); + oldItem->d_func()->setModel(nullptr); delete oldItem; } d->children.remove(i, count); @@ -1874,7 +1874,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 +1891,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 +1925,7 @@ QList 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 +1958,7 @@ QList 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 +2291,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(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 +2432,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 +2442,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 +2461,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 +2488,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 +2498,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 +2517,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 +2757,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 +2779,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 +2876,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 +2902,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 +2919,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()); } @@ -2931,7 +2931,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()); } @@ -2967,7 +2967,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 +2980,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 +3004,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 +3047,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 +3076,7 @@ bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, bool QStandardItemModel::setItemData(const QModelIndex &index, const QMap &roles) { QStandardItem *item = itemFromIndex(index); - if (item == 0) + if (item == nullptr) return false; item->d_func()->setItemData(roles); return true; @@ -3106,7 +3106,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 +3124,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 1ba8760a9d..4ae5412367 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -384,7 +384,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); @@ -440,7 +440,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); } @@ -452,7 +452,7 @@ QCursor::QCursor() { if (!QCursorData::initialized) { if (QCoreApplication::startingUp()) { - d = 0; + d = nullptr; return; } QCursorData::initialize(); @@ -470,7 +470,7 @@ QCursor::QCursor() \sa setShape() */ QCursor::QCursor(Qt::CursorShape shape) - : d(0) + : d(nullptr) { if (!QCursorData::initialized) QCursorData::initialize(); @@ -550,7 +550,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(); @@ -675,7 +675,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) { } @@ -695,7 +695,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 &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 ef31e475ea..6a0b01b6c3 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; @@ -155,8 +155,8 @@ QPointer QGuiApplicationPrivate::currentDragWindow; QVector QGuiApplicationPrivate::tabletDevicePoints; -QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; -QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; +QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr; +QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr; QList QGuiApplicationPrivate::generic_plugin_list; @@ -172,13 +172,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; @@ -188,30 +188,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 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; @@ -243,7 +243,7 @@ static void initPalette() static inline void clearPalette() { delete QGuiApplicationPrivate::app_pal; - QGuiApplicationPrivate::app_pal = 0; + QGuiApplicationPrivate::app_pal = nullptr; } static void initFontUnlocked() @@ -261,7 +261,7 @@ static void initFontUnlocked() static inline void clearFontUnlocked() { delete QGuiApplicationPrivate::app_font; - QGuiApplicationPrivate::app_font = 0; + QGuiApplicationPrivate::app_font = nullptr; } static void initThemeHints() @@ -656,16 +656,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(); @@ -676,15 +676,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()}; @@ -704,7 +704,7 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) : QCoreApplicationPrivate(argc, argv, flags), - inputMethod(0), + inputMethod(nullptr), lastTouchType(QEvent::TouchEnd), ownGlobalShareContext(false) { @@ -797,7 +797,7 @@ QWindow *QGuiApplication::modalWindow() { CHECK_QAPP_INSTANCE(nullptr) if (QGuiApplicationPrivate::self->modalWindowList.isEmpty()) - return 0; + return nullptr; return QGuiApplicationPrivate::self->modalWindowList.first(); } @@ -844,7 +844,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); } } @@ -874,12 +874,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; } @@ -889,7 +889,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; } @@ -930,7 +930,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking break; } } - *blockingWindow = 0; + *blockingWindow = nullptr; return false; } @@ -969,7 +969,7 @@ QObject *QGuiApplication::focusObject() { if (focusWindow()) return focusWindow()->focusObject(); - return 0; + return nullptr; } /*! @@ -1022,7 +1022,7 @@ QWindowList QGuiApplication::topLevelWindows() QScreen *QGuiApplication::primaryScreen() { if (QGuiApplicationPrivate::screen_list.isEmpty()) - return 0; + return nullptr; return QGuiApplicationPrivate::screen_list.at(0); } @@ -1450,7 +1450,7 @@ void QGuiApplicationPrivate::createPlatformIntegration() } if (j < argc) { - argv[j] = 0; + argv[j] = nullptr; argc = j; } @@ -1470,7 +1470,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 @@ -1481,7 +1481,7 @@ void QGuiApplicationPrivate::createEventDispatcher() void QGuiApplicationPrivate::eventDispatcherReady() { - if (platform_integration == 0) + if (platform_integration == nullptr) createPlatformIntegration(); platform_integration->initialize(); @@ -1578,7 +1578,7 @@ void QGuiApplicationPrivate::init() } if (j < argc) { - argv[j] = 0; + argv[j] = nullptr; argc = j; } @@ -1587,7 +1587,7 @@ void QGuiApplicationPrivate::init() if (!envPlugins.isEmpty()) pluginList += envPlugins.split(','); - if (platform_integration == 0) + if (platform_integration == nullptr) createPlatformIntegration(); initPalette(); @@ -1693,16 +1693,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 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(); @@ -1793,7 +1793,7 @@ Qt::MouseButtons QGuiApplication::mouseButtons() QPlatformNativeInterface *QGuiApplication::platformNativeInterface() { QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); - return pi ? pi->nativeInterface() : 0; + return pi ? pi->nativeInterface() : nullptr; } /*! @@ -2144,7 +2144,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; @@ -2357,7 +2357,7 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le return; } - currentMouseWindow = 0; + currentMouseWindow = nullptr; QEvent event(QEvent::Leave); QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); @@ -2376,7 +2376,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); @@ -2445,7 +2445,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()) { @@ -2871,7 +2871,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, @@ -3247,12 +3247,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; } @@ -3873,7 +3873,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(); } /*! @@ -3907,7 +3907,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 &l, const QCursor &c) 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 constructor(x, copy); - QMetaTypeSwitcher::switcher(constructor, type, 0); + QMetaTypeSwitcher::switcher(constructor, type, nullptr); } static void clear(QVariant::Private *d) { QVariantDestructor destructor(d); - QMetaTypeSwitcher::switcher(destructor, d->type, 0); + QMetaTypeSwitcher::switcher(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 isNull(d); - return QMetaTypeSwitcher::switcher(isNull, d->type, 0); + return QMetaTypeSwitcher::switcher(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 comparator(a, b); - return QMetaTypeSwitcher::switcher(comparator, a->type, 0); + return QMetaTypeSwitcher::switcher(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(&v.data_ptr()); QVariantDebugStream stream(dbg, d); - QMetaTypeSwitcher::switcher(stream, d->type, 0); + QMetaTypeSwitcher::switcher(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/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(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, qwindow_context_storage); -static QOpenGLContext *global_share_context = 0; +static QOpenGLContext *global_share_context = nullptr; #ifndef QT_NO_DEBUG QHash 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(); @@ -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(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 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 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 34c4549443..12065078c1 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -128,7 +128,7 @@ void QPlatformCursor::setPos(const QPoint &pos) qWarning("This plugin does not support QCursor::setPos()" "; emulating movement within the application."); } - QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove); + QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove); } // End of display and pointer event handling code @@ -431,7 +431,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) { @@ -478,7 +478,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 @@ -548,14 +548,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/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/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 ¶mList, 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 e511a6f5c4..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; } /*! 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(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/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 80de561297..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); 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 9ed450b031..a7ea20266b 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -65,11 +65,11 @@ Q_LOGGING_CATEGORY(lcShortcutMap, "qt.gui.shortcutmap") 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) @@ -184,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; @@ -228,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; @@ -264,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; @@ -638,7 +638,7 @@ 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; QVector ambiguousShortcuts; while(i < d->identicals.size()) { diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 803206477c..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(w)) return w; } - return 0; + return nullptr; } /*! 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/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b71a0c54aa..74e0e6401e 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 ba04f8701d..c9a70897d6 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -179,7 +179,7 @@ void QWindowSystemInterfacePrivate::installWindowSystemEventHandler(QWindowSyste void QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(QWindowSystemEventHandler *handler) { if (eventHandler == handler) - eventHandler = 0; + eventHandler = nullptr; } QWindowSystemEventHandler::~QWindowSystemEventHandler() 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(funcs->glGetString(GL_EXTENSIONS)); diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index 5ad16a8438..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; } /*! @@ -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 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 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(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 3e9eb3dd0a..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); 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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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 20cc2b5ae5..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); @@ -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::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::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::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 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/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..b23fb45952 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -179,7 +179,7 @@ struct QTexturedBrushData : public QBrushData { QTexturedBrushData() { m_has_pixmap_texture = false; - m_pixmap = 0; + m_pixmap = nullptr; } ~QTexturedBrushData() { delete m_pixmap; @@ -189,7 +189,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 +202,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 +360,7 @@ public: { if (!brush->ref.deref()) delete brush; - brush = 0; + brush = nullptr; } }; @@ -831,7 +831,7 @@ const QGradient *QBrush::gradient() const || d->style == Qt::ConicalGradientPattern) { return &static_cast(d.data())->gradient; } - return 0; + return nullptr; } Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush) @@ -968,7 +968,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(d.data()))->m_pixmap; @@ -1335,7 +1335,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) \internal */ QGradient::QGradient() - : m_type(NoGradient), dummy(0) + : m_type(NoGradient), dummy(nullptr) { } diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 0fb89a75b5..bece814a6f 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 &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 e8d129d047..6819545bda 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -310,7 +310,7 @@ inline void QT_FASTCALL storePixel(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, // BPP1MSB fetchPixel, // BPP1LSB fetchPixel, // 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) { } @@ -6397,21 +6397,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, { @@ -6448,7 +6448,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB8565_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6456,7 +6456,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB666 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6464,7 +6464,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB6666_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6472,7 +6472,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB555 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6480,7 +6480,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB8555_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6488,7 +6488,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB888 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint24 @@ -6496,7 +6496,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGB444 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6504,7 +6504,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB4444_Premultiplied { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6568,7 +6568,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Alpha8 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_alpha @@ -6576,7 +6576,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Grayscale8 { blend_color_generic, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_gray @@ -6584,7 +6584,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBX64 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6592,7 +6592,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBA64 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6600,7 +6600,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_RGBA64_Premultiplied { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint64 @@ -6608,7 +6608,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_Grayscale16 { blend_color_generic_rgb64, - 0, + nullptr, qt_alphamapblit_generic, qt_alphargbblit_generic, qt_rectfill_quint16 @@ -6616,7 +6616,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(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 fpoints(count); for (int i=0; iflags.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(fontEngine->glyphCache(0, glyphFormat, s->matrix, QColor(s->penData.solidColor))); + static_cast(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 ®ion) 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(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 722afaf119..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 ®ion, 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; ipen); @@ -928,7 +928,7 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr for (int i=0; ipen); @@ -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); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d5cec1b45a..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(d->engine) : 0; + d->extended = d->engine->isExtended() ? static_cast(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()); @@ -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); } /*! @@ -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(0)); + d->drawTextItem(p, ti, static_cast(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; } @@ -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(); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 859122c3b9..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); } 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 &vertices, @@ -685,9 +685,9 @@ void PathSimplifier::connectElements() QDataBuffer 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 &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..932c3e6f5a 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(); @@ -1469,7 +1469,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 +1477,8 @@ QPdfEnginePrivate::QPdfEnginePrivate() initResources(); resolution = 1200; currentObject = 1; - currentPage = 0; - stroker.stream = 0; + currentPage = nullptr; + stroker.stream = nullptr; streampos = 0; @@ -1547,12 +1547,12 @@ 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; } setActive(false); diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index bf7e2d3dca..35814d146c 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() 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 0ecb4390e9..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 { } 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 ®ion) 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(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/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::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 QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::Node *result = nullptr; while (current) { if (edgeIsLeftOfEdge(edgeIndex, current->data)) { current = current->left; @@ -1072,7 +1072,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::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::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::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::ComplexToSimple::calculateIntersections() // Find all edges in the edge list that contain the current vertex and mark them to be split later. QPair::Node *, QRBTree::Node *> range = bounds(event.point); - QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; + QRBTree::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::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::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray template void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() { - Q_ASSERT(m_edgeList.root == 0); + Q_ASSERT(m_edgeList.root == nullptr); // Initialize priority queue. fillPriorityQueue(); @@ -1772,7 +1772,7 @@ void QTriangulator::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 QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfEdge(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::Node *result = nullptr; while (current) { if (edgeIsLeftOfEdge(edgeIndex, current->data)) { current = current->left; @@ -1879,7 +1879,7 @@ template QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(int pointIndex) const { QRBTree::Node *current = m_edgeList.root; - QRBTree::Node *result = 0; + QRBTree::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::SimpleToMonotone::monotoneDecomposition() j = m_edges.at(i).previous; Q_ASSERT(j < m_edges.size()); - QRBTree::Node *leftEdgeNode = 0; + QRBTree::Node *leftEdgeNode = nullptr; switch (m_edges.at(i).type) { case RegularVertex: @@ -2049,7 +2049,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() if (m_edges.at(m_edges.at(i).helper).type == MergeVertex) diagonals.add(QPair(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::SimpleToMonotone::monotoneDecomposition() if (m_edges.at(m_edges.at(j).helper).type == MergeVertex) diagonals.add(QPair(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/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/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 89f943ca51..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() @@ -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..e162015aba 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,7 +2701,7 @@ 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') }; @@ -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 *cache = 0; + QThreadStorage *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 1668fac5a3..3ca9e9bbde 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -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 *enginesCollector = 0; +static QList *enginesCollector = nullptr; Q_AUTOTEST_EXPORT void QFontEngine_startCollectingEngines() { @@ -234,7 +234,7 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() Q_ASSERT(enginesCollector); QList ret = *enginesCollector; delete enginesCollector; - enginesCollector = 0; + enginesCollector = nullptr; return ret; } #endif // QT_BUILD_INTERNAL @@ -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(); } @@ -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(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(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..d22239c040 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(fontData + glyphMapOffset); quint32 glyphPos = qFromBigEndian(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(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; diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 906047cdb4..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); } @@ -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); @@ -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); @@ -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); @@ -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/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 e04c8909f3..884525bd76 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -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(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..c345e89a21 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -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 c88497840f..b69b94d4e7 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(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(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(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); } @@ -2603,7 +2603,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 e94f635651..3382ec0b69 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1666,7 +1666,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()) @@ -2408,7 +2408,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]; @@ -3256,7 +3256,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 2f02f62a57..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; @@ -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/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 &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::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 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 8a91b34b7a..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; @@ -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 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; } } @@ -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 &formats) return; if (specialData->preeditText.isEmpty()) { delete specialData; - specialData = 0; + specialData = nullptr; } else { specialData->formats.clear(); } @@ -4004,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/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 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 (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 (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 024f0f084e..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 sizehint_xx; QVector 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 sizehint_yy; QVector 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)); } @@ -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/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().valueToKey(fmt); #endif diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp index 764cb917ad..4b961a6f20 100644 --- a/src/gui/vulkan/qvulkaninstance.cpp +++ b/src/gui/vulkan/qvulkaninstance.cpp @@ -758,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(p) : 0; + return p ? *static_cast(p) : VK_NULL_HANDLE; } /*! diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 790bef9e14..ed73a77683 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -1866,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 = { -- cgit v1.2.3