path: root/src/tools/uic/cpp/cppwriteinitialization.h
diff options
authorMarc Mutz <>2015-06-24 02:04:09 +0200
committerMarc Mutz <>2016-02-11 19:25:27 +0000
commit612e082fe2ad16fa4ba251c435092547efff69a1 (patch)
treeaabc6e541b8fb1d9b1d517c41ec9a9dda2afe908 /src/tools/uic/cpp/cppwriteinitialization.h
parentba08832a4e2152c21fb0f3175d50bc6dc9a303cc (diff)
uic: replace an inefficient QList with QVector
Buddy is larger than a void*, so holding it in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by marking it movable, and holding it in a QVector instead. Since QVector requires a default ctor, drop the pointless existing ctor and use aggregate initialization instead. Use QVector's rvalue append. Change-Id: I696ca4f03dbe362a5438be209debbcd966fe8130 Reviewed-by: Friedemann Kleint <>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteinitialization.h')
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h
index 03e84039a6..a9691e1de4 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.h
+++ b/src/tools/uic/cpp/cppwriteinitialization.h
@@ -251,16 +251,15 @@ private:
struct Buddy
- Buddy(const QString &oN, const QString &b)
- : objName(oN), buddy(b) {}
QString objName;
QString buddy;
+ friend class QTypeInfo<Buddy>;
QStack<DomWidget*> m_widgetChain;
QStack<DomLayout*> m_layoutChain;
QStack<DomActionGroup*> m_actionGroupChain;
- QList<Buddy> m_buddies;
+ QVector<Buddy> m_buddies;
QSet<QString> m_buttonGroups;
QHash<QString, DomWidget*> m_registeredWidgets;
@@ -323,6 +322,8 @@ private:
} // namespace CPP
+Q_DECLARE_TYPEINFO(CPP::WriteInitialization::Buddy, Q_MOVABLE_TYPE);