diff options
Diffstat (limited to 'src')
61 files changed, 359 insertions, 528 deletions
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; |