diff options
89 files changed, 481 insertions, 712 deletions
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp index 7a5de991ce..6c71b6184e 100644 --- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp +++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp @@ -58,7 +58,7 @@ class FbRenderer : public QQuickFramebufferObject::Renderer { public: - FbRenderer() : c(0), dir(1) { } + FbRenderer() { } // The lifetime of the FBO and this class depends on how QQuickWidget // manages the scenegraph and context when it comes to showing and hiding @@ -85,8 +85,8 @@ public: } private: - float c; - int dir; + float c = 0; + int dir = 1; }; #endif diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp index 306909161e..b9ce1afc38 100644 --- a/examples/quick/scenegraph/graph/linenode.cpp +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -66,7 +66,7 @@ class LineShader : public QSGSimpleMaterialShader<LineMaterial> QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) public: - LineShader() : id_color(-1), id_spread(-1), id_size(-1) { + LineShader() { setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/line.vsh"); setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/line.fsh"); } @@ -86,9 +86,9 @@ public: } private: - int id_color; - int id_spread; - int id_size; + int id_color = -1; + int id_spread = -1; + int id_size = -1; }; struct LineVertex { diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp index 6e79bb247f..d1eaa1ec26 100644 --- a/examples/quick/scenegraph/graph/noisynode.cpp +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -72,7 +72,7 @@ class NoisyShader : public QSGSimpleMaterialShader<NoisyMaterial> QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial) public: - NoisyShader() : id_color(-1), id_texture(-1), id_textureSize(-1) { + NoisyShader() { setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/noisy.vsh"); setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/noisy.fsh"); } @@ -103,9 +103,9 @@ public: } private: - int id_color; - int id_texture; - int id_textureSize; + int id_color = -1; + int id_texture = -1; + int id_textureSize = -1; }; NoisyNode::NoisyNode(QQuickWindow *window) diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp index b00876440d..2271774643 100644 --- a/src/imports/settings/qqmlsettings.cpp +++ b/src/imports/settings/qqmlsettings.cpp @@ -254,18 +254,15 @@ public: void _q_propertyChanged(); QVariant readProperty(const QMetaProperty &property) const; - QQmlSettings *q_ptr; - int timerId; - bool initialized; + QQmlSettings *q_ptr = nullptr; + int timerId = 0; + bool initialized = false; QString category; mutable QPointer<QSettings> settings; QHash<const char *, QVariant> changedProperties; }; -QQmlSettingsPrivate::QQmlSettingsPrivate() - : q_ptr(nullptr), timerId(0), initialized(false) -{ -} +QQmlSettingsPrivate::QQmlSettingsPrivate() {} QSettings *QQmlSettingsPrivate::instance() const { diff --git a/src/imports/sharedimage/qsharedimageloader.cpp b/src/imports/sharedimage/qsharedimageloader.cpp index ee862b6a77..4672ded376 100644 --- a/src/imports/sharedimage/qsharedimageloader.cpp +++ b/src/imports/sharedimage/qsharedimageloader.cpp @@ -88,9 +88,7 @@ class QSharedImageLoaderPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QSharedImageLoader) public: - QSharedImageLoaderPrivate() - : QObjectPrivate() - {} + QSharedImageLoaderPrivate() {} QImage load(const QString &path, QSharedImageLoader::ImageParameters *params); diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h index 6671cec4f8..73351fb99a 100644 --- a/src/particles/qquickparticlesystem_p.h +++ b/src/particles/qquickparticlesystem_p.h @@ -137,10 +137,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleGroupData { class FreeList { public: - FreeList() - : firstUnused(UINT_MAX) - , allocated(0) - {} + FreeList() {} void resize(int newSize) { @@ -189,8 +186,8 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleGroupData { private: QV4::BitVector isUnused; - unsigned firstUnused; - int allocated; + unsigned firstUnused = UINT_MAX; + int allocated = 0; }; public: // types diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp index 28cfabc44b..dd0e4c6a04 100644 --- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp @@ -71,18 +71,13 @@ private: void connectionEstablished(); bool connectToServer(); - bool m_block; + bool m_block = false; QString m_filename; - QLocalSocket *m_socket; - QQmlDebugServer *m_debugServer; + QLocalSocket *m_socket = nullptr; + QQmlDebugServer *m_debugServer = nullptr; }; -QLocalClientConnection::QLocalClientConnection() : - m_block(false), - m_socket(nullptr), - m_debugServer(nullptr) -{ -} +QLocalClientConnection::QLocalClientConnection() { } QLocalClientConnection::~QLocalClientConnection() { diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp index 4006bf17ff..32ce820ea8 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -70,24 +70,16 @@ private: void newConnection(); bool listen(); - int m_portFrom; - int m_portTo; - bool m_block; + int m_portFrom = 0; + int m_portTo = 0; + bool m_block = false; QString m_hostaddress; - QTcpSocket *m_socket; - QTcpServer *m_tcpServer; - QQmlDebugServer *m_debugServer; + QTcpSocket *m_socket = nullptr; + QTcpServer *m_tcpServer = nullptr; + QQmlDebugServer *m_debugServer = nullptr; }; -QTcpServerConnection::QTcpServerConnection() : - m_portFrom(0), - m_portTo(0), - m_block(false), - m_socket(nullptr), - m_tcpServer(nullptr), - m_debugServer(nullptr) -{ -} +QTcpServerConnection::QTcpServerConnection() {} QTcpServerConnection::~QTcpServerConnection() { diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h index 26965c0264..42a73aa77b 100644 --- a/src/qml/animations/qanimationgroupjob_p.h +++ b/src/qml/animations/qanimationgroupjob_p.h @@ -90,8 +90,8 @@ protected: private: //definition - QAbstractAnimationJob *m_firstChild; - QAbstractAnimationJob *m_lastChild; + QAbstractAnimationJob *m_firstChild = nullptr; + QAbstractAnimationJob *m_lastChild = nullptr; }; QT_END_NAMESPACE diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp index 02dcaf1313..10096bf19c 100644 --- a/src/qml/animations/qcontinuinganimationgroupjob.cpp +++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp @@ -43,7 +43,6 @@ QT_BEGIN_NAMESPACE QContinuingAnimationGroupJob::QContinuingAnimationGroupJob() - : QAnimationGroupJob() { } diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h index 358b95ce53..67ba626247 100644 --- a/src/qml/animations/qparallelanimationgroupjob_p.h +++ b/src/qml/animations/qparallelanimationgroupjob_p.h @@ -76,8 +76,8 @@ private: void applyGroupState(QAbstractAnimationJob *animation); //state - int m_previousLoop; - int m_previousCurrentTime; + int m_previousLoop = 0; + int m_previousCurrentTime = 0; }; QT_END_NAMESPACE diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp index 27175580dc..0652ed578b 100644 --- a/src/qml/animations/qpauseanimationjob.cpp +++ b/src/qml/animations/qpauseanimationjob.cpp @@ -42,8 +42,7 @@ QT_BEGIN_NAMESPACE QPauseAnimationJob::QPauseAnimationJob(int duration) - : QAbstractAnimationJob() - , m_duration(duration) + : m_duration(duration) { m_isPause = true; } diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h index c7023b77c6..800f0c3b90 100644 --- a/src/qml/animations/qsequentialanimationgroupjob_p.h +++ b/src/qml/animations/qsequentialanimationgroupjob_p.h @@ -77,12 +77,12 @@ protected: private: struct AnimationIndex { - AnimationIndex() : afterCurrent(false), timeOffset(0), animation(nullptr) {} + AnimationIndex() {} // AnimationIndex points to the animation at timeOffset, skipping 0 duration animations. // Note that the index semantic is slightly different depending on the direction. - bool afterCurrent; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same - int timeOffset; // time offset when the animation at index starts. - QAbstractAnimationJob *animation; //points to the animation at timeOffset + bool afterCurrent = false; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same + int timeOffset = 0; // time offset when the animation at index starts. + QAbstractAnimationJob *animation = nullptr; //points to the animation at timeOffset }; int animationActualTotalDuration(QAbstractAnimationJob *anim) const; @@ -103,8 +103,8 @@ private: void advanceForwards(const AnimationIndex &newAnimationIndex); //state - QAbstractAnimationJob *m_currentAnimation; - int m_previousLoop; + QAbstractAnimationJob *m_currentAnimation = nullptr; + int m_previousLoop = 0; }; QT_END_NAMESPACE diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index 673bc2c481..7f2cf40611 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -82,12 +82,11 @@ struct PoolList PoolList() : first(nullptr) , last(nullptr) - , count(0) {} T *first; T *last; - int count; + int count = 0; int append(T *item) { item->next = nullptr; @@ -205,11 +204,11 @@ class FixedPoolArray { T *data; public: - int count; + int count = 0; FixedPoolArray() : data(nullptr) - , count(0) + {} void allocate(QQmlJS::MemoryPool *pool, int size) @@ -343,21 +342,16 @@ struct Function struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression { CompiledFunctionOrExpression() - : node(nullptr) - , nameIndex(0) - , disableAcceleratedLookups(false) - , next(nullptr) + {} CompiledFunctionOrExpression(QQmlJS::AST::Node *n) : node(n) - , nameIndex(0) - , disableAcceleratedLookups(false) - , next(nullptr) + {} - QQmlJS::AST::Node *node; // FunctionDeclaration, Statement or Expression - quint32 nameIndex; - bool disableAcceleratedLookups; - CompiledFunctionOrExpression *next; + QQmlJS::AST::Node *node = nullptr; // FunctionDeclaration, Statement or Expression + quint32 nameIndex = 0; + bool disableAcceleratedLookups = false; + CompiledFunctionOrExpression *next = nullptr; }; struct Q_QML_PRIVATE_EXPORT Object diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 27c8e96e16..a46d47cb67 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -191,10 +191,7 @@ public: bool isLValue() const { return !isReadonly; } Reference(Codegen *cg, Type type = Invalid) : type(type), codegen(cg) {} - Reference() - : type(Invalid) - , codegen(nullptr) - {} + Reference() {} Reference(const Reference &other); Reference &operator =(const Reference &other); @@ -367,7 +364,7 @@ public: bool stackSlotIsLocalOrArgument = false; bool isVolatile = false; bool global = false; - Codegen *codegen; + Codegen *codegen = nullptr; private: void storeAccumulator() const; @@ -386,16 +383,12 @@ public: }; struct ObjectPropertyValue { - ObjectPropertyValue() - : getter(-1) - , setter(-1) - , keyAsIndex(UINT_MAX) - {} + ObjectPropertyValue() {} Reference rvalue; - int getter; // index in _module->functions or -1 if not set - int setter; - uint keyAsIndex; + int getter = -1; // index in _module->functions or -1 if not set + int setter = -1; + uint keyAsIndex = UINT_MAX; bool hasGetter() const { return getter >= 0; } bool hasSetter() const { return setter >= 0; } @@ -406,34 +399,26 @@ protected: class Result { Reference _result; - const BytecodeGenerator::Label *_iftrue; - const BytecodeGenerator::Label *_iffalse; - Format _format; + const BytecodeGenerator::Label *_iftrue = nullptr; + const BytecodeGenerator::Label *_iffalse = nullptr; + Format _format = ex; Format _requested; bool _trueBlockFollowsCondition = false; public: explicit Result(const Reference &lrvalue) : _result(lrvalue) - , _iftrue(nullptr) - , _iffalse(nullptr) - , _format(ex) , _requested(ex) - { - } + {} explicit Result(Format requested = ex) - : _iftrue(nullptr) - , _iffalse(nullptr) - , _format(ex) - , _requested(requested) {} + : _requested(requested) {} explicit Result(const BytecodeGenerator::Label *iftrue, const BytecodeGenerator::Label *iffalse, bool trueBlockFollowsCondition) : _iftrue(iftrue) , _iffalse(iffalse) - , _format(ex) , _requested(cx) , _trueBlockFollowsCondition(trueBlockFollowsCondition) { diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index d375942d0e..a78a66db52 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -173,10 +173,10 @@ struct Context { // Map from meta property index (existence implies dependency) to notify signal index struct KeyValuePair { - quint32 _key; - quint32 _value; + quint32 _key = 0; + quint32 _value = 0; - KeyValuePair(): _key(0), _value(0) {} + KeyValuePair() {} KeyValuePair(quint32 key, quint32 value): _key(key), _value(value) {} quint32 key() const { return _key; } diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h index 2984a89df5..375c9a365f 100644 --- a/src/qml/jsruntime/qv4executableallocator_p.h +++ b/src/qml/jsruntime/qv4executableallocator_p.h @@ -82,11 +82,8 @@ public: struct Allocation { Allocation() - : addr(0) - , size(0) + : size(0) , free(true) - , next(nullptr) - , prev(nullptr) {} void *start() const; @@ -103,11 +100,11 @@ public: bool mergeNext(ExecutableAllocator *allocator); bool mergePrevious(ExecutableAllocator *allocator); - quintptr addr; + quintptr addr = 0; uint size : 31; // More than 2GB of function code? nah :) uint free : 1; - Allocation *next; - Allocation *prev; + Allocation *next = nullptr; + Allocation *prev = nullptr; }; // for debugging / unit-testing @@ -117,13 +114,12 @@ public: struct ChunkOfPages { ChunkOfPages() - : pages(nullptr) - , firstAllocation(nullptr) + {} ~ChunkOfPages(); - WTF::PageAllocation *pages; - Allocation *firstAllocation; + WTF::PageAllocation *pages = nullptr; + Allocation *firstAllocation = nullptr; bool contains(Allocation *alloc) const; }; diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h index 21e4e8ea66..82346d5f68 100644 --- a/src/qml/jsruntime/qv4identifier_p.h +++ b/src/qml/jsruntime/qv4identifier_p.h @@ -95,9 +95,9 @@ struct IdentifierHashData struct IdentifierHash { - IdentifierHashData *d; + IdentifierHashData *d = nullptr; - IdentifierHash() : d(nullptr) {} + IdentifierHash() {} IdentifierHash(ExecutionEngine *engine); inline IdentifierHash(const IdentifierHash &other); inline ~IdentifierHash(); diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h index 5a0b2389e1..55e8eefcb7 100644 --- a/src/qml/jsruntime/qv4persistent_p.h +++ b/src/qml/jsruntime/qv4persistent_p.h @@ -94,7 +94,7 @@ private: class Q_QML_EXPORT PersistentValue { public: - PersistentValue() : val(nullptr) {} + PersistentValue() {} PersistentValue(const PersistentValue &other); PersistentValue &operator=(const PersistentValue &other); PersistentValue &operator=(const WeakValue &other); @@ -142,13 +142,13 @@ public: bool isEmpty() { return !val; } private: - Value *val; + Value *val = nullptr; }; class Q_QML_EXPORT WeakValue { public: - WeakValue() : val(nullptr) {} + WeakValue() {} WeakValue(const WeakValue &other); WeakValue(ExecutionEngine *engine, const Value &value); WeakValue &operator=(const WeakValue &other); @@ -206,7 +206,7 @@ public: void markOnce(MarkStack *markStack); private: - Value *val; + Value *val = nullptr; private: Q_NEVER_INLINE void allocVal(ExecutionEngine *engine); diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index acbd88d466..ed3c83badf 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -224,8 +224,7 @@ public: Kind_UiEnumMemberList }; - inline Node() - : kind(Kind_Undefined) {} + inline Node() {} // NOTE: node destructors are never called, // instead we block free the memory @@ -248,7 +247,7 @@ public: virtual SourceLocation lastSourceLocation() const = 0; // attributes - int kind; + int kind = Kind_Undefined; }; class QML_PARSER_EXPORT ExpressionNode: public Node @@ -489,8 +488,8 @@ class QML_PARSER_EXPORT ObjectLiteral: public ExpressionNode public: QQMLJS_DECLARE_AST_NODE(ObjectLiteral) - ObjectLiteral(): - properties (nullptr) { kind = K; } + ObjectLiteral() + { kind = K; } ObjectLiteral(PropertyAssignmentList *plist): properties (plist) { kind = K; } @@ -504,7 +503,7 @@ public: { return rbraceToken; } // attributes - PropertyAssignmentList *properties; + PropertyAssignmentList *properties = nullptr; SourceLocation lbraceToken; SourceLocation rbraceToken; }; diff --git a/src/qml/parser/qqmljsengine_p.h b/src/qml/parser/qqmljsengine_p.h index 8cbe69a0ba..af26bac0ff 100644 --- a/src/qml/parser/qqmljsengine_p.h +++ b/src/qml/parser/qqmljsengine_p.h @@ -71,8 +71,7 @@ class QML_PARSER_EXPORT DiagnosticMessage public: enum Kind { Warning, Error }; - DiagnosticMessage() - : kind(Error) {} + DiagnosticMessage() {} DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) : kind(kind), loc(loc), message(message) {} @@ -83,7 +82,7 @@ public: bool isError() const { return kind == Error; } - Kind kind; + Kind kind = Error; AST::SourceLocation loc; QString message; }; diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h index 5682d66f45..ef443d96bc 100644 --- a/src/qml/parser/qqmljsmemorypool_p.h +++ b/src/qml/parser/qqmljsmemorypool_p.h @@ -71,13 +71,7 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData void operator =(const MemoryPool &other); public: - MemoryPool() - : _blocks(nullptr), - _allocatedBlocks(0), - _blockCount(-1), - _ptr(nullptr), - _end(nullptr) - { } + MemoryPool() {} ~MemoryPool() { @@ -144,11 +138,11 @@ private: } private: - char **_blocks; - int _allocatedBlocks; - int _blockCount; - char *_ptr; - char *_end; + char **_blocks = nullptr; + int _allocatedBlocks = 0; + int _blockCount = -1; + char *_ptr = nullptr; + char *_end = nullptr; enum { diff --git a/src/qml/qml/ftw/qflagpointer_p.h b/src/qml/qml/ftw/qflagpointer_p.h index 6954a8f09c..91ce74bec9 100644 --- a/src/qml/qml/ftw/qflagpointer_p.h +++ b/src/qml/qml/ftw/qflagpointer_p.h @@ -83,7 +83,7 @@ public: inline T *data() const; private: - quintptr ptr_value; + quintptr ptr_value = 0; static const quintptr FlagBit = 0x1; static const quintptr Flag2Bit = 0x2; @@ -115,7 +115,7 @@ public: inline T2 *asT2() const; private: - quintptr ptr_value; + quintptr ptr_value = 0; static const quintptr FlagBit = 0x1; static const quintptr Flag2Bit = 0x2; @@ -124,7 +124,6 @@ private: template<typename T> QFlagPointer<T>::QFlagPointer() -: ptr_value(0) { } @@ -233,7 +232,6 @@ T *QFlagPointer<T>::data() const template<typename T, typename T2> QBiPointer<T, T2>::QBiPointer() -: ptr_value(0) { } diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index bd2c9fbdb7..2d6c25bdd3 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -94,7 +94,7 @@ private: friend class QStringHashNode; inline void computeHash() const; - mutable quint32 m_hash; + mutable quint32 m_hash = 0; }; class QHashedCStringRef; @@ -142,9 +142,9 @@ private: inline void computeHash() const; - const QChar *m_data; - int m_length; - mutable quint32 m_hash; + const QChar *m_data = nullptr; + int m_length = 0; + mutable quint32 m_hash = 0; }; class Q_AUTOTEST_EXPORT QHashedCStringRef @@ -169,9 +169,9 @@ private: inline void computeHash() const; - const char *m_data; - int m_length; - mutable quint32 m_hash; + const char *m_data = nullptr; + int m_length = 0; + mutable quint32 m_hash = 0; }; class QStringHashData; @@ -179,7 +179,7 @@ class Q_AUTOTEST_EXPORT QStringHashNode { public: QStringHashNode() - : length(0), hash(0), symbolId(0), ckey(nullptr) + : ckey(nullptr) { } @@ -210,9 +210,9 @@ public: QFlagPointer<QStringHashNode> next; - qint32 length; - quint32 hash; - quint32 symbolId; + qint32 length = 0; + quint32 hash = 0; + quint32 symbolId = 0; union { const char *ckey; @@ -276,25 +276,20 @@ public: class Q_AUTOTEST_EXPORT QStringHashData { public: - QStringHashData() - : buckets(nullptr), numBuckets(0), size(0), numBits(0) -#ifdef QSTRINGHASH_LINK_DEBUG - , linkCount(0) -#endif - {} + QStringHashData() {} - QStringHashNode **buckets; - int numBuckets; - int size; - short numBits; + QStringHashNode **buckets = nullptr; + int numBuckets = 0; + int size = 0; + short numBits = 0; #ifdef QSTRINGHASH_LINK_DEBUG - int linkCount; + int linkCount = 0; #endif struct IteratorData { - IteratorData() : n(nullptr), p(nullptr) {} - QStringHashNode *n; - void *p; + IteratorData() {} + QStringHashNode *n = nullptr; + void *p = nullptr; }; void rehashToBits(short); void rehashToSize(int); @@ -369,10 +364,10 @@ public: }; struct ReservedNodePool { - ReservedNodePool() : count(0), used(0), nodes(nullptr) {} + ReservedNodePool() : nodes(nullptr) {} ~ReservedNodePool() { delete [] nodes; } - int count; - int used; + int count = 0; + int used = 0; Node *nodes; }; @@ -1038,7 +1033,7 @@ inline uint qHash(const QHashedStringRef &string) } QHashedString::QHashedString() -: QString(), m_hash(0) +: QString() { } @@ -1089,7 +1084,6 @@ quint32 QHashedString::existingHash() const } QHashedStringRef::QHashedStringRef() -: m_data(nullptr), m_length(0), m_hash(0) { } @@ -1236,7 +1230,6 @@ quint32 QHashedStringRef::hash() const } QHashedCStringRef::QHashedCStringRef() -: m_data(nullptr), m_length(0), m_hash(0) { } diff --git a/src/qml/qml/ftw/qintrusivelist_p.h b/src/qml/qml/ftw/qintrusivelist_p.h index c3b16f5b8c..8992be9f93 100644 --- a/src/qml/qml/ftw/qintrusivelist_p.h +++ b/src/qml/qml/ftw/qintrusivelist_p.h @@ -95,7 +95,7 @@ public: private: static inline N *nodeToN(QIntrusiveListNode *node); - QIntrusiveListNode *__first; + QIntrusiveListNode *__first = nullptr; }; class QIntrusiveListNode @@ -107,8 +107,8 @@ public: inline void remove(); inline bool isInList() const; - QIntrusiveListNode *_next; - QIntrusiveListNode**_prev; + QIntrusiveListNode *_next = nullptr; + QIntrusiveListNode**_prev = nullptr; }; template<class N, QIntrusiveListNode N::*member> @@ -165,7 +165,7 @@ typename QIntrusiveList<N, member>::iterator &QIntrusiveList<N, member>::iterato template<class N, QIntrusiveListNode N::*member> QIntrusiveList<N, member>::QIntrusiveList() -: __first(nullptr) + { } @@ -245,7 +245,6 @@ N *QIntrusiveList<N, member>::nodeToN(QIntrusiveListNode *node) } QIntrusiveListNode::QIntrusiveListNode() -: _next(nullptr), _prev(nullptr) { } diff --git a/src/qml/qml/ftw/qqmlnullablevalue_p.h b/src/qml/qml/ftw/qqmlnullablevalue_p.h index 7a9e4d7b8a..5b3d2fc456 100644 --- a/src/qml/qml/ftw/qqmlnullablevalue_p.h +++ b/src/qml/qml/ftw/qqmlnullablevalue_p.h @@ -57,7 +57,7 @@ template<typename T> struct QQmlNullableValue { QQmlNullableValue() - : isNull(true), value(T()) {} + : value(T()) {} QQmlNullableValue(const QQmlNullableValue<T> &o) : isNull(o.isNull), value(o.value) {} QQmlNullableValue(const T &t) @@ -70,7 +70,7 @@ struct QQmlNullableValue void invalidate() { isNull = true; } bool isValid() const { return !isNull; } - bool isNull; + bool isNull = true; T value; }; diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index bea2d253e4..fc53be3e7b 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -95,8 +95,8 @@ public: { return m_nextBinding.flag2(); } struct RefCount { - RefCount() : refCount(0) {} - int refCount; + RefCount() {} + int refCount = 0; void ref() { ++refCount; } int deref() { return --refCount; } operator int() const { return refCount; } diff --git a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h index 685e0160a3..eabe6666b4 100644 --- a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h +++ b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h @@ -58,7 +58,7 @@ class QQmlBoundSignalExpression; class Q_QML_PRIVATE_EXPORT QQmlBoundSignalExpressionPointer { public: - inline QQmlBoundSignalExpressionPointer() : o(nullptr) {} + inline QQmlBoundSignalExpressionPointer() {} QQmlBoundSignalExpressionPointer(QQmlBoundSignalExpression *); QQmlBoundSignalExpressionPointer(const QQmlBoundSignalExpressionPointer &); ~QQmlBoundSignalExpressionPointer(); @@ -73,7 +73,7 @@ public: QQmlBoundSignalExpressionPointer &take(QQmlBoundSignalExpression *); private: - QQmlBoundSignalExpression *o; + QQmlBoundSignalExpression *o = nullptr; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmldirparser_p.h b/src/qml/qml/qqmldirparser_p.h index 1530b7a6cf..95370398ad 100644 --- a/src/qml/qml/qqmldirparser_p.h +++ b/src/qml/qml/qqmldirparser_p.h @@ -91,8 +91,7 @@ public: struct Component { - Component() - : majorVersion(0), minorVersion(0), internal(false), singleton(false) {} + Component() {} Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), @@ -100,24 +99,23 @@ public: QString typeName; QString fileName; - int majorVersion; - int minorVersion; - bool internal; - bool singleton; + int majorVersion = 0; + int minorVersion = 0; + bool internal = false; + bool singleton = false; }; struct Script { - Script() - : majorVersion(0), minorVersion(0) {} + Script() {} Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} QString nameSpace; QString fileName; - int majorVersion; - int minorVersion; + int majorVersion = 0; + int minorVersion = 0; }; QHash<QString,Component> components() const; diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index 53f5dbed02..302fdd56c4 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -368,12 +368,12 @@ public: struct QQmlSourceLocation { - QQmlSourceLocation() : line(0), column(0) {} + QQmlSourceLocation() {} QQmlSourceLocation(const QString &sourceFile, quint16 line, quint16 column) : sourceFile(sourceFile), line(line), column(column) {} QString sourceFile; - quint16 line; - quint16 column; + quint16 line = 0; + quint16 column = 0; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlguard_p.h b/src/qml/qml/qqmlguard_p.h index 87c3677d29..808bf4c709 100644 --- a/src/qml/qml/qqmlguard_p.h +++ b/src/qml/qml/qqmlguard_p.h @@ -65,9 +65,9 @@ public: inline QQmlGuardImpl(const QQmlGuardImpl &); inline ~QQmlGuardImpl(); - QObject *o; - QQmlGuardImpl *next; - QQmlGuardImpl **prev; + QObject *o = nullptr; + QQmlGuardImpl *next = nullptr; + QQmlGuardImpl **prev = nullptr; inline void addGuard(); inline void remGuard(); @@ -113,18 +113,17 @@ Q_DECLARE_METATYPE(QQmlGuard<QObject>) QT_BEGIN_NAMESPACE QQmlGuardImpl::QQmlGuardImpl() -: o(nullptr), next(nullptr), prev(nullptr) { } QQmlGuardImpl::QQmlGuardImpl(QObject *g) -: o(g), next(nullptr), prev(nullptr) +: o(g) { if (o) addGuard(); } QQmlGuardImpl::QQmlGuardImpl(const QQmlGuardImpl &g) -: o(g.o), next(nullptr), prev(nullptr) +: o(g.o) { if (o) addGuard(); } diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h index 4c6ae0cb8f..90ec57c911 100644 --- a/src/qml/qml/qqmllist.h +++ b/src/qml/qml/qqmllist.h @@ -61,20 +61,15 @@ public: typedef void (*ClearFunction)(QQmlListProperty<T> *); QQmlListProperty() - : object(nullptr), - data(nullptr), - append(nullptr), + : append(nullptr), count(nullptr), at(nullptr), - clear(nullptr), - dummy1(nullptr), - dummy2(nullptr) + clear(nullptr) {} QQmlListProperty(QObject *o, QList<T *> &list) : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), - clear(qlist_clear), - dummy1(nullptr), - dummy2(nullptr) + clear(qlist_clear) + {} QQmlListProperty(QObject *o, void *d, AppendFunction a, CountFunction c, AtFunction t, ClearFunction r ) @@ -83,18 +78,15 @@ public: append(a), count(c), at(t), - clear(r), - dummy1(nullptr), - dummy2(nullptr) + clear(r) + {} QQmlListProperty(QObject *o, void *d, CountFunction c, AtFunction t) : object(o), data(d), append(nullptr), count(c), at(t), - clear(nullptr), - dummy1(nullptr), - dummy2(nullptr) + clear(nullptr) {} bool operator==(const QQmlListProperty &o) const { return object == o.object && @@ -105,8 +97,8 @@ public: clear == o.clear; } - QObject *object; - void *data; + QObject *object = nullptr; + void *data = nullptr; AppendFunction append; @@ -115,8 +107,8 @@ public: ClearFunction clear; - void *dummy1; - void *dummy2; + void *dummy1 = nullptr; + void *dummy2 = nullptr; private: static void qlist_append(QQmlListProperty *p, T *v) { diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index 39761875bf..d77e314de5 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -73,7 +73,7 @@ private: friend class QQmlThreadNotifierProxyObject; static void emitNotify(QQmlNotifierEndpoint *, void **a); - QQmlNotifierEndpoint *endpoints; + QQmlNotifierEndpoint *endpoints = nullptr; }; class QQmlEngine; @@ -129,7 +129,6 @@ private: }; QQmlNotifier::QQmlNotifier() -: endpoints(nullptr) { } diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 22be6ba60c..7b04ba11b8 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -376,10 +376,10 @@ private: struct QQmlEnumValue { - QQmlEnumValue() : value(-1) {} + QQmlEnumValue() {} QQmlEnumValue(const QString &n, int v) : namedValue(n), value(v) {} QString namedValue; - int value; + int value = -1; }; struct QQmlEnumData diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp index 2037c4f6cd..6554010f36 100644 --- a/src/qml/types/qqmltimer.cpp +++ b/src/qml/types/qqmltimer.cpp @@ -57,7 +57,7 @@ class QQmlTimerPrivate : public QObjectPrivate, public QAnimationJobChangeListen Q_DECLARE_PUBLIC(QQmlTimer) public: QQmlTimerPrivate() - : interval(1000), running(false), repeating(false), triggeredOnStart(false) + : running(false), repeating(false), triggeredOnStart(false) , classBegun(false), componentComplete(false), firstTick(true), awaitingTick(false) {} void animationFinished(QAbstractAnimationJob *) override; @@ -71,7 +71,7 @@ public: } } - int interval; + int interval = 1000; QPauseAnimationJob pause; bool running : 1; bool repeating : 1; diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h index 8bc13f1b67..8347a3ff19 100644 --- a/src/qml/util/qqmlchangeset_p.h +++ b/src/qml/util/qqmlchangeset_p.h @@ -62,10 +62,10 @@ class Q_QML_PRIVATE_EXPORT QQmlChangeSet public: struct MoveKey { - MoveKey() : moveId(-1), offset(0) {} + MoveKey() {} MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {} - int moveId; - int offset; + int moveId = -1; + int offset = 0; }; // The storrage for Change (below). This struct is trivial, which it has to be in order to store diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h index d5723889e1..172040559c 100644 --- a/src/qml/util/qqmllistcompositor_p.h +++ b/src/qml/util/qqmllistcompositor_p.h @@ -87,17 +87,17 @@ public: class Range { public: - Range() : next(this), previous(this), list(nullptr), index(0), count(0), flags(0) {} + Range() : next(this), previous(this) {} Range(Range *next, void *list, int index, int count, uint flags) : next(next), previous(next->previous), list(list), index(index), count(count), flags(flags) { next->previous = this; previous->next = this; } Range *next; Range *previous; - void *list; - int index; - int count; - uint flags; + void *list = nullptr; + int index = 0; + int count = 0; + uint flags = 0; inline int start() const { return index; } inline int end() const { return index + count; } @@ -145,11 +145,11 @@ public: void setGroup(Group g) { group = g; groupFlag = 1 << g; } - Range *range; - int offset; - Group group; + Range *range = nullptr; + int offset = 0; + Group group = Default; int groupFlag; - int groupCount; + int groupCount = 0; union { struct { int cacheIndex; @@ -308,8 +308,7 @@ Q_DECLARE_TYPEINFO(QQmlListCompositor::Change, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Remove, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Insert, Q_PRIMITIVE_TYPE); -inline QQmlListCompositor::iterator::iterator() - : range(nullptr), offset(0), group(Default), groupCount(0) {} +inline QQmlListCompositor::iterator::iterator() {} inline QQmlListCompositor::iterator::iterator(const iterator &it) : range(it.range) , offset(it.offset) diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp index 1f40cab049..67bad8d812 100644 --- a/src/qmldebug/qqmldebugconnection.cpp +++ b/src/qmldebug/qqmldebugconnection.cpp @@ -63,15 +63,15 @@ class QQmlDebugConnectionPrivate : public QObjectPrivate public: QQmlDebugConnectionPrivate(); - QPacketProtocol *protocol; - QIODevice *device; - QLocalServer *server; + QPacketProtocol *protocol = nullptr; + QIODevice *device = nullptr; + QLocalServer *server = nullptr; QEventLoop handshakeEventLoop; QTimer handshakeTimer; - bool gotHello; - int currentDataStreamVersion; - int maximumDataStreamVersion; + bool gotHello = false; + int currentDataStreamVersion = QDataStream::Qt_4_7; + int maximumDataStreamVersion = QDataStream::Qt_DefaultCompiledVersion; QHash <QString, float> serverPlugins; QHash<QString, QQmlDebugClient *> plugins; QStringList removedPlugins; @@ -81,10 +81,7 @@ public: void flush(); }; -QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate() : - protocol(nullptr), device(nullptr), server(nullptr), gotHello(false), - currentDataStreamVersion(QDataStream::Qt_4_7), - maximumDataStreamVersion(QDataStream::Qt_DefaultCompiledVersion) +QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate() { handshakeTimer.setSingleShot(true); handshakeTimer.setInterval(3000); diff --git a/src/quick/items/qquickanchors_p_p.h b/src/quick/items/qquickanchors_p_p.h index db929f99f3..0a834276ae 100644 --- a/src/quick/items/qquickanchors_p_p.h +++ b/src/quick/items/qquickanchors_p_p.h @@ -60,15 +60,15 @@ QT_BEGIN_NAMESPACE class QQuickAnchorLine { public: - QQuickAnchorLine() : item(nullptr), anchorLine(QQuickAnchors::InvalidAnchor) {} + QQuickAnchorLine() {} QQuickAnchorLine(QQuickItem *i, QQuickAnchors::Anchor l) : item(i), anchorLine(l) {} QQuickAnchorLine(QQuickItem *i, uint l) : item(i) , anchorLine(static_cast<QQuickAnchors::Anchor>(l)) { Q_ASSERT(l < ((QQuickAnchors::BaselineAnchor << 1) - 1)); } - QQuickItem *item; - QQuickAnchors::Anchor anchorLine; + QQuickItem *item = nullptr; + QQuickAnchors::Anchor anchorLine = QQuickAnchors::InvalidAnchor; }; inline bool operator==(const QQuickAnchorLine& a, const QQuickAnchorLine& b) diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index d6aca87f84..e430832fe7 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -135,8 +135,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject public: QQuickMouseEvent() - : _x(0), _y(0), _button(Qt::NoButton), _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) - , _source(Qt::MouseEventNotSynthesized), _wasHeld(false), _isClick(false), _accepted(false) + : _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) + , _wasHeld(false), _isClick(false), _accepted(false) , _flags(Qt::MouseEventFlags(nullptr)) {} @@ -175,12 +175,12 @@ public: void setAccepted(bool accepted) { _accepted = accepted; } int flags() const { return _flags; } private: - qreal _x; - qreal _y; - Qt::MouseButton _button; + qreal _x = 0; + qreal _y = 0; + Qt::MouseButton _button = Qt::NoButton; Qt::MouseButtons _buttons; Qt::KeyboardModifiers _modifiers; - Qt::MouseEventSource _source; + Qt::MouseEventSource _source = Qt::MouseEventNotSynthesized; bool _wasHeld : 1; bool _isClick : 1; bool _accepted : 1; @@ -201,8 +201,7 @@ class QQuickWheelEvent : public QObject public: QQuickWheelEvent() - : _x(0), _y(0), _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) - , _inverted(false), _accepted(false) + : _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) {} void reset(qreal x, qreal y, const QPoint &angleDelta, const QPoint &pixelDelta, @@ -229,14 +228,14 @@ public: void setAccepted(bool accepted) { _accepted = accepted; } private: - qreal _x; - qreal _y; + qreal _x = 0; + qreal _y = 0; QPoint _angleDelta; QPoint _pixelDelta; Qt::MouseButtons _buttons; Qt::KeyboardModifiers _modifiers; - bool _inverted; - bool _accepted; + bool _inverted = false; + bool _accepted = false; }; class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject @@ -245,14 +244,13 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) public: - QQuickCloseEvent() - : _accepted(true) {} + QQuickCloseEvent() {} bool isAccepted() { return _accepted; } void setAccepted(bool accepted) { _accepted = accepted; } private: - bool _accepted; + bool _accepted = true; }; class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject @@ -394,10 +392,8 @@ public: QQuickPointerEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QObject(parent) , m_device(device) - , m_event(nullptr) - , m_button(Qt::NoButton) , m_pressedButtons(Qt::NoButton) - { } + {} virtual ~QQuickPointerEvent(); @@ -441,8 +437,8 @@ public: // helpers for C++ only (during event delivery) protected: QQuickPointerDevice *m_device; - QInputEvent *m_event; // original event as received by QQuickWindow - Qt::MouseButton m_button; + QInputEvent *m_event = nullptr; // original event as received by QQuickWindow + Qt::MouseButton m_button = Qt::NoButton; Qt::MouseButtons m_pressedButtons; Q_DISABLE_COPY(QQuickPointerEvent) @@ -487,9 +483,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerTouchEvent : public QQuickPointerEvent public: QQuickPointerTouchEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickPointerEvent(parent, device) - , m_pointCount(0) , m_synthMouseEvent(QEvent::MouseMove, QPointF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier) - { } + {} QQuickPointerEvent *reset(QEvent *) override; void localize(QQuickItem *target) override; @@ -515,7 +510,7 @@ public: QTouchEvent *asTouchEvent() const; private: - int m_pointCount; + int m_pointCount = 0; QVector<QQuickEventTouchPoint *> m_touchPoints; mutable QMouseEvent m_synthMouseEvent; diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 2e91e2111c..1a3be437af 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -661,17 +661,15 @@ class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate { public: QQuickKeyNavigationAttachedPrivate() - : QObjectPrivate(), - left(nullptr), right(nullptr), up(nullptr), down(nullptr), tab(nullptr), backtab(nullptr), - leftSet(false), rightSet(false), upSet(false), downSet(false), + : leftSet(false), rightSet(false), upSet(false), downSet(false), tabSet(false), backtabSet(false) {} - QQuickItem *left; - QQuickItem *right; - QQuickItem *up; - QQuickItem *down; - QQuickItem *tab; - QQuickItem *backtab; + QQuickItem *left = nullptr; + QQuickItem *right = nullptr; + QQuickItem *up = nullptr; + QQuickItem *down = nullptr; + QQuickItem *tab = nullptr; + QQuickItem *backtab = nullptr; bool leftSet : 1; bool rightSet : 1; bool upSet : 1; @@ -782,8 +780,7 @@ class QQuickKeysAttachedPrivate : public QObjectPrivate { public: QQuickKeysAttachedPrivate() - : QObjectPrivate(), inPress(false), inRelease(false) - , inIM(false), enabled(true), imeItem(nullptr), item(nullptr) + : inPress(false), inRelease(false), inIM(false), enabled(true) {} //loop detection @@ -793,9 +790,9 @@ public: bool enabled : 1; - QQuickItem *imeItem; + QQuickItem *imeItem = nullptr; QList<QQuickItem *> targets; - QQuickItem *item; + QQuickItem *item = nullptr; QQuickKeyEvent theKeyEvent; }; diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index a6acdfc97d..f1550b4ac6 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -86,16 +86,7 @@ class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject public: QQuickTouchPoint(bool qmlDefined = true) - : _id(0), - _x(0.0), _y(0.0), - _pressure(0.0), - _rotation(0), - _qmlDefined(qmlDefined), - _inUse(false), - _pressed(false), - _startX(0.0), _startY(0.0), - _previousX(0.0), _previousY(0.0), - _sceneX(0.0), _sceneY(0.0) + : _qmlDefined(qmlDefined) {} int pointId() const { return _id; } @@ -171,23 +162,23 @@ Q_SIGNALS: private: friend class QQuickMultiPointTouchArea; - int _id; - qreal _x; - qreal _y; - qreal _pressure; - qreal _rotation; + int _id = 0; + qreal _x = 0.0; + qreal _y = 0.0; + qreal _pressure = 0.0; + qreal _rotation = 0; QSizeF _ellipseDiameters; QVector2D _velocity; QRectF _area; bool _qmlDefined; - bool _inUse; //whether the point is currently in use (only valid when _qmlDefined == true) - bool _pressed; - qreal _startX; - qreal _startY; - qreal _previousX; - qreal _previousY; - qreal _sceneX; - qreal _sceneY; + bool _inUse = false; //whether the point is currently in use (only valid when _qmlDefined == true) + bool _pressed = false; + qreal _startX = 0.0; + qreal _startY = 0.0; + qreal _previousX = 0.0; + qreal _previousY = 0.0; + qreal _sceneX = 0.0; + qreal _sceneY = 0.0; QPointingDeviceUniqueId _uniqueId; }; @@ -197,7 +188,7 @@ class QQuickGrabGestureEvent : public QObject Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints) Q_PROPERTY(qreal dragThreshold READ dragThreshold) public: - QQuickGrabGestureEvent() : _grab(false), _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} + QQuickGrabGestureEvent() : _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} Q_INVOKABLE void grab() { _grab = true; } bool wantsGrab() const { return _grab; } @@ -209,7 +200,7 @@ public: private: friend class QQuickMultiPointTouchArea; - bool _grab; + bool _grab = false; qreal _dragThreshold; QList<QObject*> _touchPoints; }; diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h index 416e6611b5..d6d22b05d8 100644 --- a/src/quick/items/qquickspriteengine_p.h +++ b/src/quick/items/qquickspriteengine_p.h @@ -83,9 +83,6 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStochasticState : public QObject //Currently public: QQuickStochasticState(QObject* parent = nullptr) : QObject(parent) - , m_duration(-1) - , m_durationVariation(0) - , m_randomStart(false) { } @@ -179,11 +176,11 @@ public Q_SLOTS: private: QString m_name; QVariantMap m_to; - int m_duration; - int m_durationVariation; + int m_duration = -1; + int m_durationVariation = 0; friend class QQuickStochasticEngine; - bool m_randomStart; + bool m_randomStart = false; }; class Q_QUICK_PRIVATE_EXPORT QQuickStochasticEngine : public QObject diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 46753e8087..918f3ce82c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -125,7 +125,6 @@ template <typename Type, int PageSize> class Allocator { public: Allocator() - : m_freePage(0) { pages.push_back(new AllocatorPage<Type, PageSize>()); } @@ -209,7 +208,7 @@ public: } QVector<AllocatorPage<Type, PageSize> *> pages; - int m_freePage; + int m_freePage = 0; }; @@ -306,12 +305,7 @@ struct Buffer { struct Element { Element() - : node(nullptr) - , batch(nullptr) - , nextInBatch(nullptr) - , root(nullptr) - , order(0) - , boundsComputed(false) + : boundsComputed(false) , boundsOutsideFloatRange(false) , translateOnlyToRoot(false) , removed(false) @@ -332,14 +326,14 @@ struct Element { } void computeBounds(); - QSGGeometryNode *node; - Batch *batch; - Element *nextInBatch; - Node *root; + QSGGeometryNode *node = nullptr; + Batch *batch = nullptr; + Element *nextInBatch = nullptr; + Node *root = nullptr; Rect bounds; // in device coordinates - int order; + int order = 0; uint boundsComputed : 1; uint boundsOutsideFloatRange : 1; @@ -362,12 +356,12 @@ struct RenderNodeElement : public Element { }; struct BatchRootInfo { - BatchRootInfo() : parentRoot(nullptr), lastOrder(-1), firstOrder(-1), availableOrders(0) { } + BatchRootInfo() {} QSet<Node *> subRoots; - Node *parentRoot; - int lastOrder; - int firstOrder; - int availableOrders; + Node *parentRoot = nullptr; + int lastOrder = -1; + int firstOrder = -1; + int availableOrders = 0; }; struct ClipBatchRootInfo : public BatchRootInfo @@ -381,14 +375,13 @@ struct DrawSet : vertices(v) , zorders(z) , indices(i) - , indexCount(0) { } - DrawSet() : vertices(0), zorders(0), indices(0), indexCount(0) {} - int vertices; - int zorders; - int indices; - int indexCount; + DrawSet() {} + int vertices = 0; + int zorders = 0; + int indices = 0; + int indexCount = 0; }; enum BatchCompatibility diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 10d4e2a3eb..9717862baa 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -244,14 +244,7 @@ static void qt_print_node_count() * Constructs a new node */ QSGNode::QSGNode() - : m_parent(nullptr) - , m_type(BasicNodeType) - , m_firstChild(nullptr) - , m_lastChild(nullptr) - , m_nextSibling(nullptr) - , m_previousSibling(nullptr) - , m_subtreeRenderableCount(0) - , m_nodeFlags(OwnedByParent) + : m_nodeFlags(OwnedByParent) , m_dirtyState(nullptr) { init(); @@ -870,10 +863,6 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) QSGGeometryNode::QSGGeometryNode() : QSGBasicGeometryNode(GeometryNodeType) - , m_render_order(0) - , m_material(nullptr) - , m_opaque_material(nullptr) - , m_opacity(1) { } @@ -1326,8 +1315,6 @@ void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state) */ QSGOpacityNode::QSGOpacityNode() : QSGNode(OpacityNodeType) - , m_opacity(1) - , m_combined_opacity(1) { } diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h index cd9d689dc1..528f100f8e 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.h +++ b/src/quick/scenegraph/coreapi/qsgnode.h @@ -168,13 +168,13 @@ private: void init(); void destroy(); - QSGNode *m_parent; - NodeType m_type; - QSGNode *m_firstChild; - QSGNode *m_lastChild; - QSGNode *m_nextSibling; - QSGNode *m_previousSibling; - int m_subtreeRenderableCount; + QSGNode *m_parent = nullptr; + NodeType m_type = BasicNodeType; + QSGNode *m_firstChild = nullptr; + QSGNode *m_lastChild = nullptr; + QSGNode *m_nextSibling = nullptr; + QSGNode *m_previousSibling = nullptr; + int m_subtreeRenderableCount = 0; Flags m_nodeFlags; DirtyState m_dirtyState; // Obsolete, remove in Qt 6 @@ -246,11 +246,11 @@ protected: private: friend class QSGNodeUpdater; - int m_render_order; - QSGMaterial *m_material; - QSGMaterial *m_opaque_material; + int m_render_order = 0; + QSGMaterial *m_material = nullptr; + QSGMaterial *m_opaque_material = nullptr; - qreal m_opacity; + qreal m_opacity = 1; }; class Q_QUICK_EXPORT QSGClipNode : public QSGBasicGeometryNode @@ -323,8 +323,8 @@ public: bool isSubtreeBlocked() const override; private: - qreal m_opacity; - qreal m_combined_opacity; + qreal m_opacity = 1; + qreal m_combined_opacity = 1; }; class Q_QUICK_EXPORT QSGNodeVisitor { diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h index 84d5477085..f81128f51a 100644 --- a/src/quick/scenegraph/coreapi/qsgnode_p.h +++ b/src/quick/scenegraph/coreapi/qsgnode_p.h @@ -78,18 +78,14 @@ public: class QSGBasicGeometryNodePrivate : public QSGNodePrivate { public: - QSGBasicGeometryNodePrivate() - : QSGNodePrivate() - {} + QSGBasicGeometryNodePrivate() {} }; class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate { public: - QSGGeometryNodePrivate() - : QSGBasicGeometryNodePrivate() - {} + QSGGeometryNodePrivate() {} }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index b890728fd8..d4ff6ea9fe 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -162,12 +162,12 @@ class Q_QUICK_PRIVATE_EXPORT QSGNodeDumper : public QSGNodeVisitor { public: static void dump(QSGNode *n); - QSGNodeDumper() : m_indent(0) {} + QSGNodeDumper() {} void visitNode(QSGNode *n) override; void visitChildren(QSGNode *n) override; private: - int m_indent; + int m_indent = 0; }; diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index f1d8493e85..9c88b8272c 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -266,19 +266,19 @@ public: Texture // for APIs with separate texture and sampler objects }; struct InputParameter { - InputParameter() : semanticIndex(0) { } + InputParameter() {} // Semantics use the D3D keys (POSITION, TEXCOORD). // Attribute name based APIs can map based on pre-defined names. QByteArray semanticName; - int semanticIndex; + int semanticIndex = 0; }; struct Variable { - Variable() : type(Constant), offset(0), size(0), bindPoint(0) { } - VariableType type; + Variable() {} + VariableType type = Constant; QByteArray name; - uint offset; // for cbuffer members - uint size; // for cbuffer members - int bindPoint; // for textures and samplers; for register-based APIs + uint offset = 0; // for cbuffer members + uint size = 0; // for cbuffer members + int bindPoint = 0; // for textures and samplers; for register-based APIs }; QByteArray blob; // source or bytecode @@ -329,8 +329,8 @@ public: }; struct ShaderData { - ShaderData() : hasShaderCode(false) { } - bool hasShaderCode; + ShaderData() {} + bool hasShaderCode = false; QSGGuiThreadShaderEffectManager::ShaderInfo shaderInfo; QVector<VariableData> varData; }; @@ -373,7 +373,7 @@ public: HighQualitySubPixelAntialiasing }; - QSGGlyphNode() : m_ownerElement(nullptr) {} + QSGGlyphNode() {} virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0; virtual void setColor(const QColor &color) = 0; @@ -394,7 +394,7 @@ public: void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); } protected: QRectF m_bounding_rect; - QQuickItem *m_ownerElement; + QQuickItem *m_ownerElement = nullptr; }; class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphConsumer @@ -421,24 +421,24 @@ public: }; struct TexCoord { - qreal x; - qreal y; - qreal width; - qreal height; - qreal xMargin; - qreal yMargin; + qreal x = 0; + qreal y = 0; + qreal width = -1; + qreal height = -1; + qreal xMargin = 0; + qreal yMargin = 0; - TexCoord() : x(0), y(0), width(-1), height(-1), xMargin(0), yMargin(0) { } + TexCoord() {} bool isNull() const { return width <= 0 || height <= 0; } bool isValid() const { return width >= 0 && height >= 0; } }; struct Texture { - uint textureId; + uint textureId = 0; QSize size; - Texture() : textureId(0), size(QSize()) { } + Texture() : size(QSize()) { } bool operator == (const Texture &other) const { return textureId == other.textureId; } }; @@ -478,13 +478,13 @@ protected: }; struct GlyphData { - Texture *texture; + Texture *texture = nullptr; TexCoord texCoord; QRectF boundingRect; QPainterPath path; - quint32 ref; + quint32 ref = 0; - GlyphData() : texture(nullptr), ref(0) { } + GlyphData() {} }; virtual void requestGlyphs(const QSet<glyph_t> &glyphs) = 0; diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index a697c315a3..628619fa46 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -74,8 +74,8 @@ struct QSGAdaptationBackendData { QSGAdaptationBackendData(); - bool tried; - QSGContextFactoryInterface *factory; + bool tried = false; + QSGContextFactoryInterface *factory = nullptr; QString name; QSGContextFactoryInterface::Flags flags; @@ -85,9 +85,7 @@ struct QSGAdaptationBackendData }; QSGAdaptationBackendData::QSGAdaptationBackendData() - : tried(false) - , factory(nullptr) - , flags(nullptr) + : flags(nullptr) { // Fill in the table with the built-in adaptations. builtIns.append(new QSGSoftwareAdaptation); diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h index fe365495c2..76c0d20647 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h @@ -91,10 +91,9 @@ private: QSize size; QRect allocatedArea; QDistanceField image; - int padding; + int padding = -1; - TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect), padding(-1) - { } + TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect) { } }; void createTexture(TextureInfo * texInfo, int width, int height); diff --git a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp index 7e6d6d0d07..5dd6eaa4ca 100644 --- a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp @@ -83,7 +83,6 @@ QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const } SmoothTextureMaterialShader::SmoothTextureMaterialShader() - : QSGTextureMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.frag")); diff --git a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp index ef8a13931e..fd0dcebd57 100644 --- a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp +++ b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp @@ -67,7 +67,6 @@ private: }; SmoothColorMaterialShader::SmoothColorMaterialShader() - : QSGMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothcolor.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothcolor.frag")); diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp index c9a9625f2b..8761d99c1f 100644 --- a/src/quick/scenegraph/qsgdefaultspritenode.cpp +++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp @@ -70,26 +70,18 @@ public: return this - static_cast<const QQuickSpriteMaterial *>(other); } - QSGTexture *texture; - - float animT; - float animX1; - float animY1; - float animX2; - float animY2; - float animW; - float animH; + QSGTexture *texture = nullptr; + + float animT = 0.0f; + float animX1 = 0.0f; + float animY1 = 0.0f; + float animX2 = 0.0f; + float animY2 = 0.0f; + float animW = 1.0f; + float animH = 1.0f; }; QQuickSpriteMaterial::QQuickSpriteMaterial() - : texture(nullptr) - , animT(0.0f) - , animX1(0.0f) - , animY1(0.0f) - , animX2(0.0f) - , animY2(0.0f) - , animW(1.0f) - , animH(1.0f) { setFlag(Blending, true); } @@ -103,7 +95,6 @@ class SpriteMaterialData : public QSGMaterialShader { public: SpriteMaterialData() - : QSGMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/sprite.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/sprite.frag")); diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index dd2d787495..aa58218505 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -61,19 +61,19 @@ protected: void updateColor(const QVector4D &c); void updateTextureScale(const QVector2D &ts); - float m_fontScale; - float m_matrixScale; + float m_fontScale = 1.0; + float m_matrixScale = 1.0; - int m_matrix_id; - int m_textureScale_id; - int m_alphaMin_id; - int m_alphaMax_id; - int m_color_id; + int m_matrix_id = -1; + int m_textureScale_id = -1; + int m_alphaMin_id = -1; + int m_alphaMax_id = -1; + int m_color_id = -1; QVector2D m_lastTextureScale; QVector4D m_lastColor; - float m_lastAlphaMin; - float m_lastAlphaMax; + float m_lastAlphaMin = -1; + float m_lastAlphaMax = -1; }; char const *const *QSGDistanceFieldTextMaterialShader::attributeNames() const { @@ -82,16 +82,6 @@ char const *const *QSGDistanceFieldTextMaterialShader::attributeNames() const { } QSGDistanceFieldTextMaterialShader::QSGDistanceFieldTextMaterialShader() - : QSGMaterialShader(), - m_fontScale(1.0) - , m_matrixScale(1.0) - , m_matrix_id(-1) - , m_textureScale_id(-1) - , m_alphaMin_id(-1) - , m_alphaMax_id(-1) - , m_color_id(-1) - , m_lastAlphaMin(-1) - , m_lastAlphaMax(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldtext.frag")); @@ -288,12 +278,11 @@ public: protected: void initialize() override; - int m_styleColor_id; + int m_styleColor_id = -1; }; DistanceFieldStyledTextMaterialShader::DistanceFieldStyledTextMaterialShader() : QSGDistanceFieldTextMaterialShader() - , m_styleColor_id(-1) { } @@ -358,14 +347,12 @@ protected: void updateOutlineAlphaRange(int dfRadius); - int m_outlineAlphaMax0_id; - int m_outlineAlphaMax1_id; + int m_outlineAlphaMax0_id = -1; + int m_outlineAlphaMax1_id = -1; }; DistanceFieldOutlineTextMaterialShader::DistanceFieldOutlineTextMaterialShader() : DistanceFieldStyledTextMaterialShader() - , m_outlineAlphaMax0_id(-1) - , m_outlineAlphaMax1_id(-1) { setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldoutlinetext.frag")); } @@ -438,12 +425,11 @@ protected: void updateShift(qreal fontScale, const QPointF& shift); - int m_shift_id; + int m_shift_id = -1; }; DistanceFieldShiftedStyleTextMaterialShader::DistanceFieldShiftedStyleTextMaterialShader() : DistanceFieldStyledTextMaterialShader() - , m_shift_id(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldshiftedtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldshiftedtext.frag")); @@ -516,14 +502,12 @@ public: void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; private: - int m_fontScale_id; - int m_vecDelta_id; + int m_fontScale_id = -1; + int m_vecDelta_id = -1; }; QSGHiQSubPixelDistanceFieldTextMaterialShader::QSGHiQSubPixelDistanceFieldTextMaterialShader() : QSGDistanceFieldTextMaterialShader() - , m_fontScale_id(-1) - , m_vecDelta_id(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/hiqsubpixeldistancefieldtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/hiqsubpixeldistancefieldtext.frag")); diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 6ce37de7cb..0c49ca9aa5 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -47,8 +47,7 @@ class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate { public: QSGSimpleTextureNodePrivate() - : QSGGeometryNodePrivate() - , texCoordMode(QSGSimpleTextureNode::NoTransform) + : texCoordMode(QSGSimpleTextureNode::NoTransform) , isAtlasTexture(false) , ownsTexture(false) {} diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp index 70a8b321d8..7b1d5abb26 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.cpp +++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp @@ -57,7 +57,6 @@ inline static bool isPowerOfTwo(int x) QSGMaterialType QSGOpaqueTextureMaterialShader::type; QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader() - : QSGMaterialShader() { #if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.vert")); diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index f1ad73af1b..cb61430e2e 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -64,7 +64,6 @@ private: QSGMaterialType QSGVertexColorMaterialShader::type; QSGVertexColorMaterialShader::QSGVertexColorMaterialShader() - : QSGMaterialShader() { #if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.vert")); diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 72b9149886..2da541304d 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -77,8 +77,8 @@ Q_SIGNALS: void fontDownloaded(const QString&, QQuickFontLoader::Status); private: - int redirectCount; - QNetworkReply *reply; + int redirectCount = 0; + QNetworkReply *reply = nullptr; private Q_SLOTS: void replyFinished(); @@ -91,13 +91,8 @@ public: }; QQuickFontObject::QQuickFontObject(int _id) - : QObject(nullptr) -#if QT_CONFIG(qml_network) - ,redirectCount(0), reply(nullptr) -#endif - ,id(_id) + : QObject(nullptr), id(_id) { - } #if QT_CONFIG(qml_network) @@ -148,11 +143,11 @@ class QQuickFontLoaderPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickFontLoader) public: - QQuickFontLoaderPrivate() : status(QQuickFontLoader::Null) {} + QQuickFontLoaderPrivate() {} QUrl url; QString name; - QQuickFontLoader::Status status; + QQuickFontLoader::Status status = QQuickFontLoader::Null; }; static void q_QFontLoaderFontsStaticReset(); diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index e7891a6612..1a13f6395a 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -515,15 +515,12 @@ class QQuickImageProviderOptionsPrivate : public QSharedData { public: QQuickImageProviderOptionsPrivate() - : autoTransform(QQuickImageProviderOptions::UsePluginDefaultTransform) - , preserveAspectRatioCrop(false) - , preserveAspectRatioFit(false) { } - QQuickImageProviderOptions::AutoTransform autoTransform; - bool preserveAspectRatioCrop; - bool preserveAspectRatioFit; + QQuickImageProviderOptions::AutoTransform autoTransform = QQuickImageProviderOptions::UsePluginDefaultTransform; + bool preserveAspectRatioCrop = false; + bool preserveAspectRatioFit = false; }; /*! diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index 06f6800a0e..f8b67ef945 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -90,7 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAttribute : public QQuickPathElement Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) public: - QQuickPathAttribute(QObject *parent=nullptr) : QQuickPathElement(parent), _value(0) {} + QQuickPathAttribute(QObject *parent=nullptr) : QQuickPathElement(parent) {} QString name() const; @@ -105,7 +105,7 @@ Q_SIGNALS: private: QString _name; - qreal _value; + qreal _value = 0; }; class Q_QUICK_PRIVATE_EXPORT QQuickCurve : public QQuickPathElement @@ -177,7 +177,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathQuad : public QQuickCurve Q_PROPERTY(qreal relativeControlX READ relativeControlX WRITE setRelativeControlX NOTIFY relativeControlXChanged) Q_PROPERTY(qreal relativeControlY READ relativeControlY WRITE setRelativeControlY NOTIFY relativeControlYChanged) public: - QQuickPathQuad(QObject *parent=nullptr) : QQuickCurve(parent), _controlX(0), _controlY(0) {} + QQuickPathQuad(QObject *parent=nullptr) : QQuickCurve(parent) {} qreal controlX() const; void setControlX(qreal x); @@ -202,8 +202,8 @@ Q_SIGNALS: void relativeControlYChanged(); private: - qreal _controlX; - qreal _controlY; + qreal _controlX = 0; + qreal _controlY = 0; QQmlNullableValue<qreal> _relativeControlX; QQmlNullableValue<qreal> _relativeControlY; }; @@ -221,7 +221,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCubic : public QQuickCurve Q_PROPERTY(qreal relativeControl2X READ relativeControl2X WRITE setRelativeControl2X NOTIFY relativeControl2XChanged) Q_PROPERTY(qreal relativeControl2Y READ relativeControl2Y WRITE setRelativeControl2Y NOTIFY relativeControl2YChanged) public: - QQuickPathCubic(QObject *parent=nullptr) : QQuickCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} + QQuickPathCubic(QObject *parent=nullptr) : QQuickCurve(parent) {} qreal control1X() const; void setControl1X(qreal x); @@ -264,10 +264,10 @@ Q_SIGNALS: void relativeControl2YChanged(); private: - qreal _control1X; - qreal _control1Y; - qreal _control2X; - qreal _control2Y; + qreal _control1X = 0; + qreal _control1Y = 0; + qreal _control2X = 0; + qreal _control2Y = 0; QQmlNullableValue<qreal> _relativeControl1X; QQmlNullableValue<qreal> _relativeControl1Y; QQmlNullableValue<qreal> _relativeControl2X; @@ -294,7 +294,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathArc : public QQuickCurve public: QQuickPathArc(QObject *parent=nullptr) - : QQuickCurve(parent), _radiusX(0), _radiusY(0), _useLargeArc(false), _direction(Clockwise), _xAxisRotation(0) {} + : QQuickCurve(parent) {} enum ArcDirection { Clockwise, Counterclockwise }; Q_ENUM(ArcDirection) @@ -324,11 +324,11 @@ Q_SIGNALS: Q_REVISION(2) void xAxisRotationChanged(); private: - qreal _radiusX; - qreal _radiusY; - bool _useLargeArc; - ArcDirection _direction; - qreal _xAxisRotation; + qreal _radiusX = 0; + qreal _radiusY = 0; + bool _useLargeArc = false; + ArcDirection _direction = Clockwise; + qreal _xAxisRotation = 0; }; class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve @@ -344,7 +344,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve public: QQuickPathAngleArc(QObject *parent=nullptr) - : QQuickCurve(parent), _centerX(0), _centerY(0), _radiusX(0), _radiusY(0), _startAngle(0), _sweepAngle(0), _moveToStart(true) {} + : QQuickCurve(parent) {} qreal centerX() const; void setCenterX(qreal); @@ -379,13 +379,13 @@ Q_SIGNALS: void moveToStartChanged(); private: - qreal _centerX; - qreal _centerY; - qreal _radiusX; - qreal _radiusY; - qreal _startAngle; - qreal _sweepAngle; - bool _moveToStart; + qreal _centerX = 0; + qreal _centerY = 0; + qreal _radiusX = 0; + qreal _radiusY = 0; + qreal _startAngle = 0; + qreal _sweepAngle = 0; + bool _moveToStart = true; }; class Q_QUICK_PRIVATE_EXPORT QQuickPathSvg : public QQuickCurve @@ -412,7 +412,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPercent : public QQuickPathElement Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) public: - QQuickPathPercent(QObject *parent=nullptr) : QQuickPathElement(parent), _value(0) {} + QQuickPathPercent(QObject *parent=nullptr) : QQuickPathElement(parent) {} qreal value() const; void setValue(qreal value); @@ -421,18 +421,18 @@ Q_SIGNALS: void valueChanged(); private: - qreal _value; + qreal _value = 0; }; struct QQuickCachedBezier { - QQuickCachedBezier() : isValid(false) {} + QQuickCachedBezier() {} QBezier bezier; int element; qreal bezLength; qreal currLength; qreal p; - bool isValid; + bool isValid = false; }; class QQuickPathPrivate; @@ -494,15 +494,15 @@ private Q_SLOTS: private: struct AttributePoint { - AttributePoint() : percent(0), scale(1), origpercent(0) {} + AttributePoint() {} AttributePoint(const AttributePoint &other) : percent(other.percent), scale(other.scale), origpercent(other.origpercent), values(other.values) {} AttributePoint &operator=(const AttributePoint &other) { percent = other.percent; scale = other.scale; origpercent = other.origpercent; values = other.values; return *this; } - qreal percent; //massaged percent along the painter path - qreal scale; - qreal origpercent; //'real' percent along the painter path + qreal percent = 0; //massaged percent along the painter path + qreal scale = 1; + qreal origpercent = 0; //'real' percent along the painter path QHash<QString, qreal> values; }; diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h index f5c9664223..9735d51264 100644 --- a/src/quick/util/qquickpath_p_p.h +++ b/src/quick/util/qquickpath_p_p.h @@ -72,7 +72,7 @@ public: static QQuickPathPrivate* get(QQuickPath *path) { return path->d_func(); } static const QQuickPathPrivate* get(const QQuickPath *path) { return path->d_func(); } - QQuickPathPrivate() : pathLength(0), closed(false), componentComplete(true), isShapePath(false) { } + QQuickPathPrivate() {} QPainterPath _path; QList<QQuickPathElement*> _pathElements; @@ -83,10 +83,10 @@ public: mutable QQuickCachedBezier prevBez; QQmlNullableValue<qreal> startX; QQmlNullableValue<qreal> startY; - qreal pathLength; - bool closed; - bool componentComplete; - bool isShapePath; + qreal pathLength = 0; + bool closed = false; + bool componentComplete = true; + bool isShapePath = false; }; QT_END_NAMESPACE diff --git a/src/quick/util/qquickstyledtext_p.h b/src/quick/util/qquickstyledtext_p.h index 821f95b6bf..51f1b7d8f9 100644 --- a/src/quick/util/qquickstyledtext_p.h +++ b/src/quick/util/qquickstyledtext_p.h @@ -67,9 +67,7 @@ class QQmlContext; class Q_AUTOTEST_EXPORT QQuickStyledTextImgTag { public: - QQuickStyledTextImgTag() - : position(0), offset(0.0), align(QQuickStyledTextImgTag::Bottom), pix(nullptr) - { } + QQuickStyledTextImgTag() { } ~QQuickStyledTextImgTag() { delete pix; } @@ -82,10 +80,10 @@ public: QUrl url; QPointF pos; QSize size; - int position; - qreal offset; // this offset allows us to compensate for flooring reserved space - Align align; - QQuickPixmap *pix; + int position = 0; + qreal offset = 0.0; // this offset allows us to compensate for flooring reserved space + Align align = QQuickStyledTextImgTag::Bottom; + QQuickPixmap *pix = nullptr; }; class Q_AUTOTEST_EXPORT QQuickStyledText diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index 93284c0685..ac9f75979e 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -104,11 +104,11 @@ struct QQuickTimeLinePrivate }; struct TimeLine { - TimeLine() : length(0), consumedOpLength(0), base(0.) {} + TimeLine() {} QList<Op> ops; - int length; - int consumedOpLength; - qreal base; + int length = 0; + int consumedOpLength = 0; + qreal base = 0.; }; int length; diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp index c81fd37f07..7e19e925b6 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp +++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp @@ -53,7 +53,7 @@ private slots: class TestableQAbstractAnimation : public QAbstractAnimationJob { public: - TestableQAbstractAnimation() : m_duration(10) {} + TestableQAbstractAnimation() {} virtual ~TestableQAbstractAnimation() {}; int duration() const { return m_duration; } @@ -61,7 +61,7 @@ public: void setDuration(int duration) { m_duration = duration; } private: - int m_duration; + int m_duration = 10; }; class DummyQAnimationGroup : public QAnimationGroupJob diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index b7f8280c5b..974357dc8e 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -71,10 +71,7 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob { Q_OBJECT public: - UncontrolledAnimation() - : id(0) - { - } + UncontrolledAnimation() { } int duration() const { return -1; /* not time driven */ } @@ -96,7 +93,7 @@ protected: } private: - int id; + int id = 0; }; class StateChangeListener: public QAnimationJobChangeListener diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index bb7e50dbbd..a8bcadbc84 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -89,7 +89,6 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob Q_OBJECT public: UncontrolledAnimation() - : id(0) { } @@ -113,7 +112,7 @@ protected: } private: - int id; + int id = 0; }; class StateChangeListener: public QAnimationJobChangeListener @@ -133,14 +132,14 @@ public: class FinishedListener: public QAnimationJobChangeListener { public: - FinishedListener() : m_count(0) {} + FinishedListener() {} virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; } void clear() { m_count = 0; } int count() { return m_count; } private: - int m_count; + int m_count = 0; }; void tst_QParallelAnimationGroupJob::setCurrentTime() @@ -685,10 +684,10 @@ void tst_QParallelAnimationGroupJob::stopUncontrolledAnimations() } struct AnimState { - AnimState(int time = -1) : time(time), state(-1) {} + AnimState(int time = -1) : time(time) {} AnimState(int time, int state) : time(time), state(state) {} int time; - int state; + int state = -1; }; #define Running QAbstractAnimationJob::Running diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp index ff295c5409..8f6b6a2ab7 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp +++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp @@ -39,17 +39,14 @@ static const char winTimerError[] = "On windows, consistent timing is not workin class TestablePauseAnimation : public QPauseAnimationJob { public: - TestablePauseAnimation() - : m_updateCurrentTimeCount(0) - { - } + TestablePauseAnimation() { } TestablePauseAnimation(int duration) : QPauseAnimationJob(duration), m_updateCurrentTimeCount(0) { } - int m_updateCurrentTimeCount; + int m_updateCurrentTimeCount = 0; protected: void updateCurrentTime(int currentTime) { diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index ee5db3e75a..57b0905a8a 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -95,7 +95,7 @@ class TestValueAnimation : public TestAnimation { public: TestValueAnimation(int duration = 250) - : TestAnimation(duration), start(0), end(0), value(0) {} + : TestAnimation(duration) {} void updateCurrentTime(int msecs) { @@ -105,8 +105,8 @@ public: value = start + (end - start) * (qreal(msecs) / duration()); } - qreal start, end; - qreal value; + qreal start = 0, end = 0; + qreal value = 0; }; class UncontrolledAnimation : public QObject, public QAbstractAnimationJob @@ -140,14 +140,14 @@ public: class FinishedListener: public QAnimationJobChangeListener { public: - FinishedListener() : m_count(0) {} + FinishedListener() {} virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; } void clear() { m_count = 0; } int count() { return m_count; } private: - int m_count; + int m_count = 0; }; void tst_QSequentialAnimationGroupJob::setCurrentTime() diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index b34aaea61c..8f3011001b 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -735,23 +735,18 @@ public: }; Q_ENUMS(Enum1 Enum2) - Q_INVOKABLE TestQMetaObject() - : m_called(1) { - } + Q_INVOKABLE TestQMetaObject() {} Q_INVOKABLE TestQMetaObject(int) - : m_called(2) { - } + : m_called(2) {} Q_INVOKABLE TestQMetaObject(QString) - : m_called(3) { - } + : m_called(3) {} Q_INVOKABLE TestQMetaObject(QString, int) - : m_called(4) { - } + : m_called(4) {} int called() const { return m_called; } private: - int m_called; + int m_called = 1; }; void tst_QJSEngine::newQObjectPropertyCache() @@ -1300,8 +1295,8 @@ void tst_QJSEngine::errorMessage_QT679() struct Foo { public: - int x, y; - Foo() : x(-1), y(-1) { } + int x = -1, y = -1; + Foo() {} }; Q_DECLARE_METATYPE(Foo) @@ -3156,10 +3151,9 @@ class ThreadedTestEngine : public QThread { Q_OBJECT; public: - int result; + int result = 0; - ThreadedTestEngine() - : result(0) {} + ThreadedTestEngine() {} void run() { QJSEngine firstEngine; @@ -4058,9 +4052,9 @@ class TestObject : public QObject { Q_OBJECT public: - TestObject() : called(false) {} + TestObject() {} - bool called; + bool called = false; Q_INVOKABLE void callMe(QQmlV4Function *) { called = true; diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index e6e47bda28..b49832499e 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -45,13 +45,13 @@ struct Range template <typename T> struct Array { - Array() : array(nullptr), count(0) {} + Array() : array(nullptr) {} template<int N> Array(const T (&array)[N]) : array(array), count(N) {} T operator [](int index) const { return array[index]; } const T *array; - int count; + int count = 0; }; typedef Array<int> IndexArray; diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index c2c2413c98..eb6eb62648 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -1232,7 +1232,7 @@ class DateFormatter : public QObject { Q_OBJECT public: - DateFormatter() : QObject() {} + DateFormatter() {} Q_INVOKABLE QString getLocalizedForm(const QString &isoTimestamp); }; diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index 381ae98195..8811f779bb 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -46,21 +46,17 @@ class ExportedClass : public QObject Q_PROPERTY(int v4BindingProp2 READ v4BindingProp2 NOTIFY v4BindingProp2Changed) Q_PROPERTY(int scriptBindingProp READ scriptBindingProp NOTIFY scriptBindingPropChanged) public: - int qmlObjectPropConnections; - int cppObjectPropConnections; - int unboundPropConnections; - int v8BindingPropConnections; - int v4BindingPropConnections; - int v4BindingProp2Connections; - int scriptBindingPropConnections; - int boundSignalConnections; - int unusedSignalConnections; - - ExportedClass() - : qmlObjectPropConnections(0), cppObjectPropConnections(0), unboundPropConnections(0), - v8BindingPropConnections(0), v4BindingPropConnections(0), v4BindingProp2Connections(0), - scriptBindingPropConnections(0), boundSignalConnections(0), unusedSignalConnections(0) - {} + int qmlObjectPropConnections = 0; + int cppObjectPropConnections = 0; + int unboundPropConnections = 0; + int v8BindingPropConnections = 0; + int v4BindingPropConnections = 0; + int v4BindingProp2Connections = 0; + int scriptBindingPropConnections = 0; + int boundSignalConnections = 0; + int unusedSignalConnections = 0; + + ExportedClass() {} ~ExportedClass() { @@ -141,9 +137,7 @@ class tst_qqmlnotifier : public QQmlDataTest { Q_OBJECT public: - tst_qqmlnotifier() - : root(nullptr), exportedClass(nullptr), exportedObject(nullptr) - {} + tst_qqmlnotifier() {} private slots: void initTestCase() override; @@ -166,9 +160,9 @@ private: void createObjects(); QQmlEngine engine; - QObject *root; - ExportedClass *exportedClass; - ExportedClass *exportedObject; + QObject *root = nullptr; + ExportedClass *exportedClass = nullptr; + ExportedClass *exportedObject = nullptr; }; void tst_qqmlnotifier::initTestCase() diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 62a8cd117d..86229b95f3 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -72,7 +72,6 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus public: LazyPropertyMap() : QQmlPropertyMap(this, /*parent*/nullptr) - , value(0) {} virtual void classBegin() {} @@ -87,7 +86,7 @@ signals: void someFixedPropertyChanged(); private: - int value; + int value = 0; }; void tst_QQmlPropertyMap::initTestCase() @@ -313,7 +312,7 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap { Q_OBJECT public: - MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr), m_testSlotCalled(false) {} + MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr) {} bool testSlotCalled() const { return m_testSlotCalled; } signals: @@ -323,7 +322,7 @@ public slots: void testSlot() { m_testSlotCalled = true; } private: - bool m_testSlotCalled; + bool m_testSlotCalled = false; }; void tst_QQmlPropertyMap::metaObjectAccessibility() diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp index 12c3032eda..b353d23539 100644 --- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp +++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp @@ -88,10 +88,7 @@ class CppObject : public QObject public: CppObject(QObject *parent = nullptr) : QObject(parent), - m_intProperty(123), - m_boolProperty(true), - m_realProperty(1.23), - m_doubleProperty(3.45), + m_stringProperty("foo"), m_urlProperty("http://www.qt-project.org"), m_objectProperty(keyValueMap("foo", "bar")), @@ -127,10 +124,10 @@ signals: void fontPropertyChanged(const QFont &arg); private: - int m_intProperty; - bool m_boolProperty; - qreal m_realProperty; - double m_doubleProperty; + int m_intProperty = 123; + bool m_boolProperty = true; + qreal m_realProperty = 1.23; + double m_doubleProperty = 3.45; QString m_stringProperty; QUrl m_urlProperty; QVariant m_varProperty; diff --git a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp index 52e27af647..68ed22c01c 100644 --- a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp +++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp @@ -55,10 +55,7 @@ public: }; public: - CppObject() - : QObject() - , m_objectState(State0) - {} + CppObject() {} ObjectState objectState() const { return m_objectState; } void setObjectState(ObjectState objectState) { m_objectState = objectState; emit objectStateChanged();} @@ -68,7 +65,7 @@ signals: void mySignal(int signalState); private: - ObjectState m_objectState; + ObjectState m_objectState = State0; }; tst_qqmlstatemachine::tst_qqmlstatemachine() diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index 64f804c200..4e42d02514 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -89,11 +89,9 @@ class TimerHelper : public QObject { Q_OBJECT public: - TimerHelper() : QObject(), count(0) - { - } + TimerHelper() { } - int count; + int count = 0; public slots: void timeout() { @@ -101,9 +99,7 @@ public slots: } }; -tst_qqmltimer::tst_qqmltimer() -{ -} +tst_qqmltimer::tst_qqmltimer() { } void tst_qqmltimer::initTestCase() { diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index 1f1be122f1..77fda3b555 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -48,7 +48,7 @@ class tst_qquickfolderlistmodel : public QQmlDataTest { Q_OBJECT public: - tst_qquickfolderlistmodel() : removeStart(0), removeEnd(0) {} + tst_qquickfolderlistmodel() {} public slots: void removed(const QModelIndex &, int start, int end) { @@ -78,8 +78,8 @@ private: void checkNoErrors(const QQmlComponent& component); QQmlEngine engine; - int removeStart; - int removeEnd; + int removeStart = 0; + int removeEnd = 0; }; void tst_qquickfolderlistmodel::checkNoErrors(const QQmlComponent& component) diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index c9af5a5c34..79a9e5f757 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -76,9 +76,9 @@ private Q_SLOTS: void textureNodeRect(); private: - QOffscreenSurface *surface; - QOpenGLContext *context; - QSGDefaultRenderContext *renderContext; + QOffscreenSurface *surface = nullptr; + QOpenGLContext *context = nullptr; + QSGDefaultRenderContext *renderContext = nullptr; }; void NodesTest::initTestCase() @@ -147,9 +147,6 @@ public: int DummyRenderer::globalRendereringOrder; NodesTest::NodesTest() - : surface(nullptr) - , context(nullptr) - , renderContext(nullptr) { } diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index 42af7d4443..9d832066af 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -59,14 +59,6 @@ class TestDropTarget : public QQuickItem public: TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) - , enterEvents(0) - , moveEvents(0) - , leaveEvents(0) - , dropEvents(0) - , acceptAction(Qt::MoveAction) - , defaultAction(Qt::IgnoreAction) - , proposedAction(Qt::IgnoreAction) - , accept(true) { setFlags(ItemAcceptsDrops); } @@ -119,16 +111,16 @@ public: event->setAccepted(accept); } - int enterEvents; - int moveEvents; - int leaveEvents; - int dropEvents; - Qt::DropAction acceptAction; - Qt::DropAction defaultAction; - Qt::DropAction proposedAction; + int enterEvents = 0; + int moveEvents = 0; + int leaveEvents = 0; + int dropEvents = 0; + Qt::DropAction acceptAction = Qt::MoveAction; + Qt::DropAction defaultAction = Qt::IgnoreAction; + Qt::DropAction proposedAction = Qt::IgnoreAction; Qt::DropActions supportedActions; QPointF position; - bool accept; + bool accept = true; }; class tst_QQuickDrag: public QObject diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index 4298bc198b..d8464ebc74 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -393,7 +393,7 @@ void tst_qquickimageprovider::imageProviderId() class TestThreadProvider : public QQuickImageProvider { public: - TestThreadProvider() : QQuickImageProvider(Image), ok(false) {} + TestThreadProvider() : QQuickImageProvider(Image) {} ~TestThreadProvider() {} @@ -417,7 +417,7 @@ class TestThreadProvider : public QQuickImageProvider QWaitCondition cond; QMutex mutex; - bool ok; + bool ok = false; }; @@ -495,7 +495,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable class TestAsyncProvider : public QQuickAsyncImageProvider { public: - TestAsyncProvider() : ok(false) + TestAsyncProvider() { pool.setMaxThreadCount(4); } @@ -512,7 +512,7 @@ class TestAsyncProvider : public QQuickAsyncImageProvider QThreadPool pool; QMutex lock; QWaitCondition condition; - bool ok; + bool ok = false; }; diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index 599e8d92b4..1a289a2087 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -89,17 +89,12 @@ private slots: private: void mirroringCheck(int mirroring, int x, bool shouldMirror, const QImage &fb); - bool m_isMesaSoftwareRasterizer; - int m_mesaVersion; - bool m_isOpenGLRenderer; + bool m_isMesaSoftwareRasterizer = false; + int m_mesaVersion = 0; + bool m_isOpenGLRenderer = true; }; -tst_QQuickItemLayer::tst_QQuickItemLayer() - : m_isMesaSoftwareRasterizer(false) - , m_mesaVersion(0) - , m_isOpenGLRenderer(true) -{ -} +tst_QQuickItemLayer::tst_QQuickItemLayer() { } void tst_QQuickItemLayer::initTestCase() { diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 5c11628e97..30fc52f95a 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -54,11 +54,11 @@ class PeriodicIncubationController : public QObject, public QQmlIncubationController { public: - PeriodicIncubationController() : incubated(false) {} + PeriodicIncubationController() {} void start() { startTimer(20); } - bool incubated; + bool incubated = false; protected: virtual void timerEvent(QTimerEvent *) { diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 056b1fc020..73f3cab318 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickMultiPointTouchArea : public QQmlDataTest { Q_OBJECT public: - tst_QQuickMultiPointTouchArea() : device(nullptr) { } + tst_QQuickMultiPointTouchArea() { } private slots: void initTestCase() { @@ -73,7 +73,7 @@ private slots: private: QQuickView *createAndShowView(const QString &file); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; void tst_QQuickMultiPointTouchArea::properties() diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index fd81c0a67c..2571e4f288 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickPinchArea: public QQmlDataTest { Q_OBJECT public: - tst_QQuickPinchArea() : device(nullptr) { } + tst_QQuickPinchArea() { } private slots: void initTestCase(); void cleanupTestCase(); @@ -55,7 +55,7 @@ private slots: private: QQuickView *createView(); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; void tst_QQuickPinchArea::initTestCase() { diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index d6e1982b1e..0e06ee6f50 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -120,7 +120,7 @@ private: class MessUpNode : public QSGRenderNode, protected QOpenGLFunctions { public: - MessUpNode() : initialized(false) { } + MessUpNode() {} StateFlags changedStates() const override { @@ -157,7 +157,7 @@ public: glBindFramebuffer(GL_FRAMEBUFFER, fbo); } - bool initialized; + bool initialized = false; }; class MessUpItem : public QQuickItem diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 67a7c56099..a79ff4e78f 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -87,7 +87,7 @@ Q_SIGNALS: public: EventItem(QQuickItem *parent = nullptr) - : QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1) + : QQuickItem(parent) { setAcceptedMouseButtons(Qt::LeftButton); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -140,10 +140,10 @@ public: } QList<Event> eventList; - int touchUngrabCount; - bool acceptMouse; - bool acceptTouch; - bool filterTouch; // when used as event filter + int touchUngrabCount = 0; + bool acceptMouse = false; + bool acceptTouch = false; + bool filterTouch = false; // when used as event filter bool eventFilter(QObject *, QEvent *event) { @@ -162,7 +162,7 @@ public: } return false; } - int point0; + int point0 = -1; }; class tst_TouchMouse : public QQmlDataTest diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp index 0d6c80a859..1a0b987c64 100644 --- a/tools/qmlcachegen/generateloader.cpp +++ b/tools/qmlcachegen/generateloader.cpp @@ -58,12 +58,10 @@ struct VirtualDirectoryEntry { QString name; QVector<VirtualDirectoryEntry*> dirEntries; - int firstChildIndex; // node index inside generated data - bool isDirectory; + int firstChildIndex = -1; // node index inside generated data + bool isDirectory = true; VirtualDirectoryEntry() - : firstChildIndex(-1) - , isDirectory(true) {} ~VirtualDirectoryEntry() diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 9bfeca7897..bc7fe72d4c 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -145,21 +145,7 @@ struct Options }; Options() - : originalQml(false) - , originalQmlRaster(false) - , maximized(false) - , fullscreen(false) - , transparent(false) - , clip(false) - , versionDetection(true) - , slowAnimations(false) - , quitImmediately(false) - , resizeViewToRootItem(false) - , multisample(false) - , coreProfile(false) - , verbose(false) - , applicationType(DefaultQmlApplicationType) - , textRenderType(QQuickWindow::textRenderType()) + : textRenderType(QQuickWindow::textRenderType()) { // QtWebEngine needs a shared context in order for the GPU thread to // upload textures. @@ -167,22 +153,22 @@ struct Options } QUrl url; - bool originalQml; - bool originalQmlRaster; - bool maximized; - bool fullscreen; - bool transparent; - bool clip; - bool versionDetection; - bool slowAnimations; - bool quitImmediately; - bool resizeViewToRootItem; - bool multisample; - bool coreProfile; - bool verbose; + bool originalQml = false; + bool originalQmlRaster = false; + bool maximized = false; + bool fullscreen = false; + bool transparent = false; + bool clip = false; + bool versionDetection = true; + bool slowAnimations = false; + bool quitImmediately = false; + bool resizeViewToRootItem = false; + bool multisample = false; + bool coreProfile = false; + bool verbose = false; QVector<Qt::ApplicationAttribute> applicationAttributes; QString translationFile; - QmlApplicationType applicationType; + QmlApplicationType applicationType = DefaultQmlApplicationType; QQuickWindow::TextRenderType textRenderType; }; |