diff options
author | Kevin Funk <kfunk@kde.org> | 2017-09-24 23:54:47 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-09-25 11:55:44 +0000 |
commit | ba5bc93b95d28a28a72e60281f765a6f031129a5 (patch) | |
tree | b9132290c3b153a81b229ea4cd681a17b58352fa | |
parent | 93f5ac54f56b8c340731fd88e1b88525fca7793c (diff) |
Replace Q_NULLPTR with nullptr
Change-Id: I480f8b917e41d514f9efff01b2f2664b61ea3440
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/input/frontend/qinputaspect.cpp | 2 | ||||
-rw-r--r-- | src/input/frontend/qinputdeviceintegration.cpp | 2 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfparser.cpp | 90 | ||||
-rw-r--r-- | src/render/framegraph/qclearbuffers.cpp | 2 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicshelperes3_p.h | 2 | ||||
-rw-r--r-- | src/render/texture/qpaintedtextureimage.cpp | 2 |
6 files changed, 50 insertions, 50 deletions
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index a3bf58f08..17e39ef96 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -196,7 +196,7 @@ void QInputAspectPrivate::loadInputDevicePlugins() /*! Create a physical device identified by \a name using the input device integrations present - returns a Q_NULLPTR if it is not found. + returns a nullptr if it is not found. \note caller is responsible for ownership */ // Note: caller is responsible for ownership diff --git a/src/input/frontend/qinputdeviceintegration.cpp b/src/input/frontend/qinputdeviceintegration.cpp index d7f802727..5140776bf 100644 --- a/src/input/frontend/qinputdeviceintegration.cpp +++ b/src/input/frontend/qinputdeviceintegration.cpp @@ -110,7 +110,7 @@ QInputAspect *QInputDeviceIntegration::inputAspect() const Create the Physical device identified by \a name. - If not recognized return Q_NULLPTR + If not recognized return nullptr */ /*! diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp index e42ebb510..8d5696b82 100644 --- a/src/plugins/sceneparsers/gltf/gltfparser.cpp +++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp @@ -234,7 +234,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) } QJsonObject jsonObj = nodes.value(id).toObject(); - QEntity* result = Q_NULLPTR; + QEntity* result = nullptr; // Qt3D has a limitation that a QEntity can only have 1 mesh and 1 material component // So if the node has only 1 mesh, we only create 1 QEntity @@ -270,7 +270,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) } //If the entity contains no meshes, results will still be null here - if (result == Q_NULLPTR) + if (result == nullptr) result = new QEntity; if ( jsonObj.contains(KEY_CHILDREN) ) { @@ -286,7 +286,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) // Node Transforms - Qt3DCore::QTransform *trans = Q_NULLPTR; + Qt3DCore::QTransform *trans = nullptr; if ( jsonObj.contains(KEY_MATRIX) ) { QMatrix4x4 m(Qt::Uninitialized); @@ -297,14 +297,14 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) } // ADD MATRIX TRANSFORM COMPONENT TO ENTITY - if (trans == Q_NULLPTR) + if (trans == nullptr) trans = new Qt3DCore::QTransform; trans->setMatrix(m); } // Rotation quaternion if (jsonObj.contains(KEY_ROTATION)) { - if (trans == Q_NULLPTR) + if (trans == nullptr) trans = new Qt3DCore::QTransform; QJsonArray quaternionValues = jsonObj.value(KEY_ROTATION).toArray(); @@ -317,7 +317,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) // Translation if (jsonObj.contains(KEY_TRANSLATION)) { - if (trans == Q_NULLPTR) + if (trans == nullptr) trans = new Qt3DCore::QTransform; QJsonArray translationValues = jsonObj.value(KEY_TRANSLATION).toArray(); @@ -328,7 +328,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) // Scale if (jsonObj.contains(KEY_SCALE)) { - if (trans == Q_NULLPTR) + if (trans == nullptr) trans = new Qt3DCore::QTransform; QJsonArray scaleValues = jsonObj.value(KEY_SCALE).toArray(); @@ -338,7 +338,7 @@ Qt3DCore::QEntity* GLTFParser::node(const QString &id) } // Add the Transform component - if (trans != Q_NULLPTR) + if (trans != nullptr) result->addComponent(trans); if ( jsonObj.contains(KEY_CAMERA) ) { @@ -380,7 +380,7 @@ Qt3DCore::QEntity* GLTFParser::scene(const QString &id) GLTFParser::BufferData::BufferData() : length(0) - , data(Q_NULLPTR) + , data(nullptr) { } @@ -388,7 +388,7 @@ GLTFParser::BufferData::BufferData(QJsonObject json) { path = json.value(KEY_URI).toString(); length = json.value(KEY_BYTE_LENGTH).toInt(); - data = Q_NULLPTR; + data = nullptr; } GLTFParser::ParameterData::ParameterData() : @@ -508,7 +508,7 @@ QParameter *GLTFParser::parameterFromTechnique(QTechnique *technique, const QStr } } - return Q_NULLPTR; + return nullptr; } Qt3DCore::QEntity* GLTFParser::defaultScene() @@ -538,8 +538,8 @@ QMaterial *GLTFParser::materialWithCustomShader(const QString &id, const QJsonOb //Optional Core technique - QTechnique *coreTechnique = Q_NULLPTR; - QTechnique *gl2Technique = Q_NULLPTR; + QTechnique *coreTechnique = nullptr; + QTechnique *gl2Technique = nullptr; QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString(); if (!coreTechniqueName.isNull()) { if (!m_techniques.contains(coreTechniqueName)) { @@ -577,9 +577,9 @@ QMaterial *GLTFParser::materialWithCustomShader(const QString &id, const QJsonOb QEffect* effect = new QEffect; effect->setObjectName(techniqueName); effect->addTechnique(technique); - if (coreTechnique != Q_NULLPTR) + if (coreTechnique != nullptr) effect->addTechnique(coreTechnique); - if (gl2Technique != Q_NULLPTR) + if (gl2Technique != nullptr) effect->addTechnique(gl2Technique); QMaterial* mat = new QMaterial; @@ -591,15 +591,15 @@ QMaterial *GLTFParser::materialWithCustomShader(const QString &id, const QJsonOb Q_FOREACH (QString vName, values.keys()) { QParameter *param = parameterFromTechnique(technique, vName); - if (param == Q_NULLPTR && coreTechnique != Q_NULLPTR) { + if (param == nullptr && coreTechnique != nullptr) { param = parameterFromTechnique(coreTechnique, vName); } - if (param == Q_NULLPTR && gl2Technique != Q_NULLPTR) { + if (param == nullptr && gl2Technique != nullptr) { param = parameterFromTechnique(gl2Technique, vName); } - if (param == Q_NULLPTR) { + if (param == nullptr) { qCWarning(GLTFParserLog) << "unknown parameter:" << vName << "in technique" << techniqueName << "processing material" << id; continue; @@ -661,7 +661,7 @@ QMaterial *GLTFParser::commonMaterial(const QJsonObject &jsonObj) params[propertyName] = var; } - QMaterial *mat = Q_NULLPTR; + QMaterial *mat = nullptr; if (hasNormalMap) { if (hasSpecularMap) { mat = new QNormalDiffuseSpecularMapMaterial; @@ -707,7 +707,7 @@ QMaterial* GLTFParser::material(const QString &id) QJsonObject jsonObj = mats.value(id).toObject(); - QMaterial *mat = Q_NULLPTR; + QMaterial *mat = nullptr; // Prefer common materials over custom shaders. if (jsonObj.contains(KEY_EXTENSIONS)) { @@ -728,7 +728,7 @@ QCameraLens* GLTFParser::camera(const QString &id) const QJsonObject cams = m_json.object().value(KEY_CAMERAS).toObject(); if (!cams.contains(id)) { qCWarning(GLTFParserLog) << "unknown camera" << id << "in GLTF file" << m_basePath; - return Q_NULLPTR; + return nullptr; } QJsonObject jsonObj = cams.value(id).toObject(); @@ -737,7 +737,7 @@ QCameraLens* GLTFParser::camera(const QString &id) const if (camTy == QStringLiteral("perspective")) { if (!jsonObj.contains(KEY_PERSPECTIVE)) { qCWarning(GLTFParserLog) << "camera:" << id << "missing 'perspective' object"; - return Q_NULLPTR; + return nullptr; } QJsonObject pObj = jsonObj.value(KEY_PERSPECTIVE).toObject(); @@ -752,10 +752,10 @@ QCameraLens* GLTFParser::camera(const QString &id) const } else if (camTy == QStringLiteral("orthographic")) { qCWarning(GLTFParserLog) << Q_FUNC_INFO << "implement me"; - return Q_NULLPTR; + return nullptr; } else { qCWarning(GLTFParserLog) << "camera:" << id << "has unsupported type:" << camTy; - return Q_NULLPTR; + return nullptr; } } @@ -823,7 +823,7 @@ void GLTFParser::cleanup() m_accessorDict.clear(); //Check for Materials with no parent Q_FOREACH (QMaterial *material, m_materialCache.values()) { - if (material->parent() == Q_NULLPTR) + if (material->parent() == nullptr) delete material; } m_materialCache.clear(); @@ -832,19 +832,19 @@ void GLTFParser::cleanup() m_shaderPaths.clear(); //Check for ShaderPrograms with no parent Q_FOREACH (QShaderProgram *program, m_programs.values()) { - if (program->parent() == Q_NULLPTR) + if (program->parent() == nullptr) delete program; } m_programs.clear(); //Check for Techniques with no parent Q_FOREACH (QTechnique *technique, m_techniques.values()) { - if (technique->parent() == Q_NULLPTR) + if (technique->parent() == nullptr) delete technique; } m_techniques.clear(); //Check for Textures with no parent Q_FOREACH (QAbstractTextureProvider *texture, m_textures.values()) { - if (texture->parent() == Q_NULLPTR) + if (texture->parent() == nullptr) delete texture; } m_textures.clear(); @@ -972,9 +972,9 @@ void GLTFParser::processJSONTechnique(const QString &id, const QJsonObject &json QJsonObject attrs = jsonObject.value(KEY_ATTRIBUTES).toObject(); Q_FOREACH ( QString shaderAttributeName, attrs.keys() ) { QString pname = attrs.value(shaderAttributeName).toString(); - QParameter *parameter = paramDict.value(pname, Q_NULLPTR); + QParameter *parameter = paramDict.value(pname, nullptr); QString attributeName = pname; - if (parameter == Q_NULLPTR) { + if (parameter == nullptr) { qCWarning(GLTFParserLog) << Q_FUNC_INFO << "attribute " << pname << "defined in instanceProgram but not as parameter"; continue; @@ -995,8 +995,8 @@ void GLTFParser::processJSONTechnique(const QString &id, const QJsonObject &json QJsonObject uniforms = jsonObject.value(KEY_UNIFORMS).toObject(); Q_FOREACH (QString shaderUniformName, uniforms.keys()) { QString pname = uniforms.value(shaderUniformName).toString(); - QParameter *parameter = paramDict.value(pname, Q_NULLPTR); - if (parameter == Q_NULLPTR) { + QParameter *parameter = paramDict.value(pname, nullptr); + if (parameter == nullptr) { qCWarning(GLTFParserLog) << Q_FUNC_INFO << "uniform " << pname << "defined in instanceProgram but not as parameter"; continue; @@ -1029,7 +1029,7 @@ void GLTFParser::processJSONTechnique(const QString &id, const QJsonObject &json Q_FOREACH (QString functionName, functions.keys()) { int enableStateType = 0; QRenderState *renderState = buildState(functionName, functions.value(functionName), enableStateType); - if (renderState != Q_NULLPTR) { + if (renderState != nullptr) { //Remove the need to set a default state values for enableStateType enableStates.removeOne(enableStateType); pass->addRenderState(renderState); @@ -1039,7 +1039,7 @@ void GLTFParser::processJSONTechnique(const QString &id, const QJsonObject &json //Create render states with default values for any remaining enable states Q_FOREACH (int enableState, enableStates) { QRenderState *renderState = buildStateEnable(enableState); - if (renderState != Q_NULLPTR) + if (renderState != nullptr) pass->addRenderState(renderState); } @@ -1090,8 +1090,8 @@ void GLTFParser::processJSONMesh(const QString &id, const QJsonObject &json) attributeName = attrName; //Get buffer handle for accessor - QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, Q_NULLPTR); - if (buffer == Q_NULLPTR) { + QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, nullptr); + if (buffer == nullptr) { qCWarning(GLTFParserLog) << "unknown buffer-view:" << m_accessorDict[k].bufferViewName << "processing accessor:" << id; continue; } @@ -1113,8 +1113,8 @@ void GLTFParser::processJSONMesh(const QString &id, const QJsonObject &json) qCWarning(GLTFParserLog) << "unknown index accessor:" << k << "on mesh" << id; } else { //Get buffer handle for accessor - QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, Q_NULLPTR); - if (buffer == Q_NULLPTR) { + QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, nullptr); + if (buffer == nullptr) { qCWarning(GLTFParserLog) << "unknown buffer-view:" << m_accessorDict[k].bufferViewName << "processing accessor:" << id; continue; } @@ -1201,7 +1201,7 @@ void GLTFParser::processJSONTexture(const QString &id, const QJsonObject &jsonOb void GLTFParser::loadBufferData() { Q_FOREACH (QString bufferName, m_bufferDatas.keys()) { - if (m_bufferDatas[bufferName].data == Q_NULLPTR) { + if (m_bufferDatas[bufferName].data == nullptr) { QFile* bufferFile = resolveLocalData(m_bufferDatas[bufferName].path); QByteArray *data = new QByteArray(bufferFile->readAll()); m_bufferDatas[bufferName].data = data; @@ -1429,7 +1429,7 @@ QRenderState *GLTFParser::buildStateEnable(int state) if (state == GL_BLEND) { //It doesn't make sense to handle this state alone - return Q_NULLPTR; + return nullptr; } if (state == GL_CULL_FACE) { @@ -1454,7 +1454,7 @@ QRenderState *GLTFParser::buildStateEnable(int state) qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << state; - return Q_NULLPTR; + return nullptr; } QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonValue &value, int &type) @@ -1466,7 +1466,7 @@ QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonVal type = GL_BLEND; //TODO: support render state blendColor qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName; - return Q_NULLPTR; + return nullptr; } if (functionName == QStringLiteral("blendEquationSeparate")) { @@ -1518,7 +1518,7 @@ QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonVal if (functionName == QStringLiteral("depthRange")) { //TODO: support render state depthRange qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName; - return Q_NULLPTR; + return nullptr; } if (functionName == QStringLiteral("frontFace")) { @@ -1530,7 +1530,7 @@ QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonVal if (functionName == QStringLiteral("lineWidth")) { //TODO: support render state lineWidth qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName; - return Q_NULLPTR; + return nullptr; } if (functionName == QStringLiteral("polygonOffset")) { @@ -1552,7 +1552,7 @@ QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonVal } qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName; - return Q_NULLPTR; + return nullptr; } } // namespace Qt3DRender diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp index a1a80bf1e..7b2868e66 100644 --- a/src/render/framegraph/qclearbuffers.cpp +++ b/src/render/framegraph/qclearbuffers.cpp @@ -87,7 +87,7 @@ QClearBuffersPrivate::QClearBuffersPrivate() , m_buffersType(QClearBuffers::None) , m_clearDepthValue(1.f) , m_clearStencilValue(0) - , m_buffer(Q_NULLPTR) + , m_buffer(nullptr) { } diff --git a/src/render/graphicshelpers/graphicshelperes3_p.h b/src/render/graphicshelpers/graphicshelperes3_p.h index 7f78d0d7f..9bca2d48d 100644 --- a/src/render/graphicshelpers/graphicshelperes3_p.h +++ b/src/render/graphicshelpers/graphicshelperes3_p.h @@ -87,7 +87,7 @@ public: UniformType uniformTypeFromGLType(GLenum glType) override; protected: - QOpenGLExtraFunctions *m_extraFuncs = Q_NULLPTR; + QOpenGLExtraFunctions *m_extraFuncs = nullptr; }; } // namespace Render diff --git a/src/render/texture/qpaintedtextureimage.cpp b/src/render/texture/qpaintedtextureimage.cpp index db03b26b9..af0e74d4b 100644 --- a/src/render/texture/qpaintedtextureimage.cpp +++ b/src/render/texture/qpaintedtextureimage.cpp @@ -233,7 +233,7 @@ QTextureImageDataPtr QPaintedTextureImageDataGenerator::operator ()() bool QPaintedTextureImageDataGenerator::operator ==(const QTextureImageDataGenerator &other) const { const QPaintedTextureImageDataGenerator *otherFunctor = functor_cast<QPaintedTextureImageDataGenerator>(&other); - return (otherFunctor != Q_NULLPTR && otherFunctor->m_generation == m_generation && otherFunctor->m_paintedTextureImageId == m_paintedTextureImageId); + return (otherFunctor != nullptr && otherFunctor->m_generation == m_generation && otherFunctor->m_paintedTextureImageId == m_paintedTextureImageId); } } // namespace Qt3DRender |