Use QObjectList alias

Change-Id: I11d4071088e2b44c37d4a8ac59945fe49fe68351
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2024-07-15 18:17:46 +02:00
parent c343e9b8f7
commit 3fe4928626
17 changed files with 42 additions and 42 deletions

View File

@@ -185,7 +185,7 @@ Aggregate::Aggregate(QObject *parent)
*/ */
Aggregate::~Aggregate() Aggregate::~Aggregate()
{ {
QList<QObject *> components; QObjectList components;
{ {
QWriteLocker locker(&lock()); QWriteLocker locker(&lock());
for (QObject *component : std::as_const(m_components)) { for (QObject *component : std::as_const(m_components)) {
@@ -262,11 +262,11 @@ void Aggregate::remove(QObject *component)
\sa Aggregate \sa Aggregate
*/ */
void aggregate(QList<QObject *> components) void aggregate(const QObjectList &components)
{ {
QWriteLocker locker(&Aggregate::lock()); QWriteLocker locker(&Aggregate::lock());
Aggregate *agg = nullptr; Aggregate *agg = nullptr;
QList<QObject *> toAdd; QObjectList toAdd;
for (QObject *comp : components) { for (QObject *comp : components) {
Aggregate *existing = Aggregate::aggregateMap().value(comp); Aggregate *existing = Aggregate::aggregateMap().value(comp);
if (existing) { if (existing) {

View File

@@ -51,7 +51,7 @@ signals:
void changed(); void changed();
private: private:
friend AGGREGATION_EXPORT void aggregate(QList<QObject *>); friend AGGREGATION_EXPORT void aggregate(const QObjectList &);
enum PrivateConstructor { PrivateConstructor }; enum PrivateConstructor { PrivateConstructor };
Aggregate(enum PrivateConstructor); Aggregate(enum PrivateConstructor);
void construct(); void construct();
@@ -60,10 +60,10 @@ private:
static QHash<QObject *, Aggregate *> &aggregateMap(); static QHash<QObject *, Aggregate *> &aggregateMap();
QList<QObject *> m_components; QObjectList m_components;
}; };
AGGREGATION_EXPORT void aggregate(QList<QObject *> components); AGGREGATION_EXPORT void aggregate(const QObjectList &components);
// get a component via global template function // get a component via global template function
template <typename T> T *query(Aggregate *obj) template <typename T> T *query(Aggregate *obj)

View File

@@ -297,7 +297,7 @@ void PluginManager::removeObject(QObject *obj)
\sa PluginManager::getObject() \sa PluginManager::getObject()
*/ */
QVector<QObject *> PluginManager::allObjects() QObjectList PluginManager::allObjects()
{ {
return d->allObjects; return d->allObjects;
} }
@@ -1152,7 +1152,7 @@ static QStringList matchingTestFunctions(const QStringList &testFunctions,
return matchingFunctions; return matchingFunctions;
} }
static QObject *objectWithClassName(const QVector<QObject *> &objects, const QString &className) static QObject *objectWithClassName(const QObjectList &objects, const QString &className)
{ {
return Utils::findOr(objects, nullptr, [className] (QObject *object) -> bool { return Utils::findOr(objects, nullptr, [className] (QObject *object) -> bool {
QString candidate = QString::fromUtf8(object->metaObject()->className()); QString candidate = QString::fromUtf8(object->metaObject()->className());
@@ -1193,7 +1193,7 @@ static int executeTestPlan(const TestPlan &testPlan)
/// Resulting plan consists of all test functions of the plugin object and /// Resulting plan consists of all test functions of the plugin object and
/// all test functions of all test objects of the plugin. /// all test functions of all test objects of the plugin.
static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QVector<QObject *> &testObjects) static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QObjectList &testObjects)
{ {
TestPlan testPlan; TestPlan testPlan;
@@ -1214,7 +1214,7 @@ static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QVector<QObject
/// Since multiple match texts can match the same function, a test function might /// Since multiple match texts can match the same function, a test function might
/// be included multiple times for a test object. /// be included multiple times for a test object.
static TestPlan generateCustomTestPlan(IPlugin *plugin, static TestPlan generateCustomTestPlan(IPlugin *plugin,
const QVector<QObject *> &testObjects, const QObjectList &testObjects,
const QStringList &matchTexts) const QStringList &matchTexts)
{ {
TestPlan testPlan; TestPlan testPlan;
@@ -1222,7 +1222,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin,
const QStringList testFunctionsOfPluginObject = testFunctions(plugin->metaObject()); const QStringList testFunctionsOfPluginObject = testFunctions(plugin->metaObject());
QStringList matchedTestFunctionsOfPluginObject; QStringList matchedTestFunctionsOfPluginObject;
QStringList remainingMatchTexts = matchTexts; QStringList remainingMatchTexts = matchTexts;
QVector<QObject *> remainingTestObjectsOfPlugin = testObjects; QObjectList remainingTestObjectsOfPlugin = testObjects;
while (!remainingMatchTexts.isEmpty()) { while (!remainingMatchTexts.isEmpty()) {
const QString matchText = remainingMatchTexts.takeFirst(); const QString matchText = remainingMatchTexts.takeFirst();
@@ -1289,7 +1289,7 @@ void PluginManagerPrivate::startTests()
continue; // plugin not loaded continue; // plugin not loaded
const QList<TestCreator> testCreators = g_testCreators[plugin]; const QList<TestCreator> testCreators = g_testCreators[plugin];
const QVector<QObject *> testObjects = Utils::transform(testCreators, &TestCreator::operator()); const QObjectList testObjects = Utils::transform(testCreators, &TestCreator::operator());
const QScopeGuard cleanup([&] { qDeleteAll(testObjects); }); const QScopeGuard cleanup([&] { qDeleteAll(testObjects); });
const bool hasDuplicateTestObjects = testObjects.size() const bool hasDuplicateTestObjects = testObjects.size()

View File

@@ -35,14 +35,14 @@ public:
// Object pool operations // Object pool operations
static void addObject(QObject *obj); static void addObject(QObject *obj);
static void removeObject(QObject *obj); static void removeObject(QObject *obj);
static QVector<QObject *> allObjects(); static QObjectList allObjects();
static QReadWriteLock *listLock(); static QReadWriteLock *listLock();
// This is useful for soft dependencies using pure interfaces. // This is useful for soft dependencies using pure interfaces.
template <typename T> static T *getObject() template <typename T> static T *getObject()
{ {
QReadLocker lock(listLock()); QReadLocker lock(listLock());
const QVector<QObject *> all = allObjects(); const QObjectList all = allObjects();
for (QObject *obj : all) { for (QObject *obj : all) {
if (T *result = qobject_cast<T *>(obj)) if (T *result = qobject_cast<T *>(obj))
return result; return result;
@@ -52,7 +52,7 @@ public:
template <typename T, typename Predicate> static T *getObject(Predicate predicate) template <typename T, typename Predicate> static T *getObject(Predicate predicate)
{ {
QReadLocker lock(listLock()); QReadLocker lock(listLock());
const QVector<QObject *> all = allObjects(); const QObjectList all = allObjects();
for (QObject *obj : all) { for (QObject *obj : all) {
if (T *result = qobject_cast<T *>(obj)) if (T *result = qobject_cast<T *>(obj))
if (predicate(result)) if (predicate(result))

View File

@@ -93,7 +93,7 @@ public:
std::vector<TestSpec> testSpecs; std::vector<TestSpec> testSpecs;
Utils::FilePaths pluginPaths; Utils::FilePaths pluginPaths;
QString pluginIID; QString pluginIID;
QVector<QObject *> allObjects; // ### make this a QVector<QPointer<QObject> > > ? QObjectList allObjects; // ### make this a QList<QPointer<QObject> > > ?
QStringList defaultDisabledPlugins; // Plugins/Ignored from install settings QStringList defaultDisabledPlugins; // Plugins/Ignored from install settings
QStringList defaultEnabledPlugins; // Plugins/ForceEnabled from install settings QStringList defaultEnabledPlugins; // Plugins/ForceEnabled from install settings
QStringList disabledPlugins; QStringList disabledPlugins;

View File

@@ -17,7 +17,7 @@ struct Group
{ {
Group(Utils::Id id) : id(id) {} Group(Utils::Id id) : id(id) {}
Utils::Id id; Utils::Id id;
QList<QObject *> items; // Command * or ActionContainer * QObjectList items; // Command * or ActionContainer *
}; };
class ActionContainerPrivate : public ActionContainer class ActionContainerPrivate : public ActionContainer

View File

@@ -376,7 +376,7 @@ void FormEditorData::fullInit()
/** /**
* This will initialize our TabOrder, Signals and slots and Buddy editors. * This will initialize our TabOrder, Signals and slots and Buddy editors.
*/ */
const QList<QObject *> plugins = QPluginLoader::staticInstances() + m_formeditor->pluginInstances(); const QObjectList plugins = QPluginLoader::staticInstances() + m_formeditor->pluginInstances();
for (QObject *plugin : plugins) { for (QObject *plugin : plugins) {
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) { if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
if (!formEditorPlugin->isInitialized()) if (!formEditorPlugin->isInitialized())

View File

@@ -99,7 +99,7 @@ private:
QMenu *m_filterMenu = nullptr; QMenu *m_filterMenu = nullptr;
QToolButton *m_aggregateButton = nullptr; QToolButton *m_aggregateButton = nullptr;
QToolButton *m_tracePointsButton = nullptr; QToolButton *m_tracePointsButton = nullptr;
QList<QObject *> m_objectsToDelete; QObjectList m_objectsToDelete;
PerfProfilerTraceView *m_traceView = nullptr; PerfProfilerTraceView *m_traceView = nullptr;
PerfProfilerStatisticsView *m_statisticsView = nullptr; PerfProfilerStatisticsView *m_statisticsView = nullptr;

View File

@@ -150,7 +150,7 @@ class GenericModel : public TreeModel<GenericItem, GenericItem>
public: public:
GenericModel(QObject *parent) : TreeModel(parent) { } GenericModel(QObject *parent) : TreeModel(parent) { }
void rebuild(const QList<QObject *> &objects) void rebuild(const QObjectList &objects)
{ {
clear(); clear();
for (QObject * const e : objects) for (QObject * const e : objects)
@@ -249,8 +249,8 @@ public:
explicit ProjectListView(QWidget *parent = nullptr) : SelectorView(parent) explicit ProjectListView(QWidget *parent = nullptr) : SelectorView(parent)
{ {
const auto model = new GenericModel(this); const auto model = new GenericModel(this);
model->rebuild(transform<QList<QObject *>>(ProjectManager::projects(), model->rebuild(transform<QObjectList>(ProjectManager::projects(),
[](Project *p) { return p; })); [](Project *p) { return p; }));
connect(ProjectManager::instance(), &ProjectManager::projectAdded, connect(ProjectManager::instance(), &ProjectManager::projectAdded,
this, [this, model](Project *project) { this, [this, model](Project *project) {
const GenericItem *projectItem = model->addItemForObject(project); const GenericItem *projectItem = model->addItemForObject(project);
@@ -322,7 +322,7 @@ signals:
void changeActiveProjectConfiguration(QObject *pc); void changeActiveProjectConfiguration(QObject *pc);
public: public:
void setProjectConfigurations(const QList<QObject *> &list, QObject *active) void setProjectConfigurations(const QObjectList &list, QObject *active)
{ {
theModel()->rebuild(list); theModel()->rebuild(list);
resetOptimalWidth(); resetOptimalWidth();
@@ -1194,13 +1194,13 @@ void MiniProjectTargetSelector::changeStartupProject(Project *project)
} }
if (project) { if (project) {
QList<QObject *> list; QObjectList list;
const QList<Target *> targets = project->targets(); const QList<Target *> targets = project->targets();
for (Target *t : targets) for (Target *t : targets)
list.append(t); list.append(t);
m_listWidgets[TARGET]->setProjectConfigurations(list, project->activeTarget()); m_listWidgets[TARGET]->setProjectConfigurations(list, project->activeTarget());
} else { } else {
m_listWidgets[TARGET]->setProjectConfigurations(QList<QObject *>(), nullptr); m_listWidgets[TARGET]->setProjectConfigurations({}, nullptr);
} }
updateActionAndSummary(); updateActionAndSummary();
@@ -1239,17 +1239,17 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target)
this, &MiniProjectTargetSelector::updateActionAndSummary); this, &MiniProjectTargetSelector::updateActionAndSummary);
if (m_target) { if (m_target) {
QList<QObject *> bl; QObjectList bl;
for (BuildConfiguration *bc : target->buildConfigurations()) for (BuildConfiguration *bc : target->buildConfigurations())
bl.append(bc); bl.append(bc);
m_listWidgets[BUILD]->setProjectConfigurations(bl, target->activeBuildConfiguration()); m_listWidgets[BUILD]->setProjectConfigurations(bl, target->activeBuildConfiguration());
QList<QObject *> dl; QObjectList dl;
for (DeployConfiguration *dc : target->deployConfigurations()) for (DeployConfiguration *dc : target->deployConfigurations())
dl.append(dc); dl.append(dc);
m_listWidgets[DEPLOY]->setProjectConfigurations(dl, target->activeDeployConfiguration()); m_listWidgets[DEPLOY]->setProjectConfigurations(dl, target->activeDeployConfiguration());
QList<QObject *> rl; QObjectList rl;
for (RunConfiguration *rc : target->runConfigurations()) for (RunConfiguration *rc : target->runConfigurations())
rl.append(rc); rl.append(rc);
m_listWidgets[RUN]->setProjectConfigurations(rl, target->activeRunConfiguration()); m_listWidgets[RUN]->setProjectConfigurations(rl, target->activeRunConfiguration());
@@ -1278,9 +1278,9 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target)
connect(m_target, &Target::activeRunConfigurationChanged, connect(m_target, &Target::activeRunConfigurationChanged,
this, &MiniProjectTargetSelector::activeRunConfigurationChanged); this, &MiniProjectTargetSelector::activeRunConfigurationChanged);
} else { } else {
m_listWidgets[BUILD]->setProjectConfigurations(QList<QObject *>(), nullptr); m_listWidgets[BUILD]->setProjectConfigurations({}, nullptr);
m_listWidgets[DEPLOY]->setProjectConfigurations(QList<QObject *>(), nullptr); m_listWidgets[DEPLOY]->setProjectConfigurations({}, nullptr);
m_listWidgets[RUN]->setProjectConfigurations(QList<QObject *>(), nullptr); m_listWidgets[RUN]->setProjectConfigurations({}, nullptr);
m_buildConfiguration = nullptr; m_buildConfiguration = nullptr;
m_deployConfiguration = nullptr; m_deployConfiguration = nullptr;
m_runConfiguration = nullptr; m_runConfiguration = nullptr;

View File

@@ -693,7 +693,7 @@ void Edit3DView::createSeekerSliderAction()
QPoint Edit3DView::resolveToolbarPopupPos(Edit3DAction *action) const QPoint Edit3DView::resolveToolbarPopupPos(Edit3DAction *action) const
{ {
QPoint pos; QPoint pos;
const QList<QObject *> &objects = action->action()->associatedObjects(); const QObjectList &objects = action->action()->associatedObjects();
for (QObject *obj : objects) { for (QObject *obj : objects) {
if (auto button = qobject_cast<QToolButton *>(obj)) { if (auto button = qobject_cast<QToolButton *>(obj)) {
if (auto toolBar = qobject_cast<QWidget *>(button->parent())) { if (auto toolBar = qobject_cast<QWidget *>(button->parent())) {

View File

@@ -75,7 +75,7 @@ private:
void addSpacing(int width); void addSpacing(int width);
void setupCurrentFrameValidator(); void setupCurrentFrameValidator();
QList<QObject *> m_grp; QObjectList m_grp;
QLabel *m_timelineLabel = nullptr; QLabel *m_timelineLabel = nullptr;
QLabel *m_stateLabel = nullptr; QLabel *m_stateLabel = nullptr;

View File

@@ -56,7 +56,7 @@ private:
void createRightControls(); void createRightControls();
void addSpacing(int width); void addSpacing(int width);
QList<QObject *> m_grp; QObjectList m_grp;
QComboBox *m_transitionComboBox = nullptr; QComboBox *m_transitionComboBox = nullptr;
QSlider *m_scale = nullptr; QSlider *m_scale = nullptr;

View File

@@ -746,7 +746,7 @@ QList<QQmlContext *> NodeInstanceServer::allSubContextsForObject(QObject *object
QList<QQmlContext *> contextList; QList<QQmlContext *> contextList;
if (object) { if (object) {
const QList<QObject *> subObjects = object->findChildren<QObject *>(); const QObjectList subObjects = object->findChildren<QObject *>();
for (QObject *subObject : subObjects) { for (QObject *subObject : subObjects) {
QQmlContext *contextOfObject = QQmlEngine::contextForObject(subObject); QQmlContext *contextOfObject = QQmlEngine::contextForObject(subObject);
if (contextOfObject) { if (contextOfObject) {
@@ -759,9 +759,9 @@ QList<QQmlContext *> NodeInstanceServer::allSubContextsForObject(QObject *object
return contextList; return contextList;
} }
QList<QObject *> NodeInstanceServer::allSubObjectsForObject(QObject *object) QObjectList NodeInstanceServer::allSubObjectsForObject(QObject *object)
{ {
QList<QObject *> subChildren; QObjectList subChildren;
if (object) if (object)
subChildren = object->findChildren<QObject *>(); subChildren = object->findChildren<QObject *>();

View File

@@ -291,7 +291,7 @@ protected:
QList<ServerNodeInstance> setupInstances(const CreateSceneCommand &command); QList<ServerNodeInstance> setupInstances(const CreateSceneCommand &command);
QList<QQmlContext*> allSubContextsForObject(QObject *object); QList<QQmlContext*> allSubContextsForObject(QObject *object);
static QList<QObject*> allSubObjectsForObject(QObject *object); static QObjectList allSubObjectsForObject(QObject *object);
virtual void resizeCanvasToRootItem() = 0; virtual void resizeCanvasToRootItem() = 0;
void setupState(qint32 stateInstanceId); void setupState(qint32 stateInstanceId);

View File

@@ -151,7 +151,7 @@ private:
QSet<QObject *> m_view3Ds; QSet<QObject *> m_view3Ds;
QMultiHash<QObject *, QObject *> m_3DSceneMap; // key: scene root, value: node QMultiHash<QObject *, QObject *> m_3DSceneMap; // key: scene root, value: node
QObject *m_active3DView = nullptr; QObject *m_active3DView = nullptr;
QList<QObject *> m_priorityView3DsToRender; QObjectList m_priorityView3DsToRender;
QObject *m_active3DScene = nullptr; QObject *m_active3DScene = nullptr;
QSet<ServerNodeInstance> m_parentChangedSet; QSet<ServerNodeInstance> m_parentChangedSet;
QList<ServerNodeInstance> m_completedComponentList; QList<ServerNodeInstance> m_completedComponentList;

View File

@@ -217,7 +217,7 @@ QStringList QuickItemNodeInstance::allStates() const
{ {
QStringList list; QStringList list;
QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem()); QObjectList stateList = QQuickDesignerSupport::statesForItem(quickItem());
for (QObject *state : stateList) { for (QObject *state : stateList) {
QQmlProperty property(state, "name"); QQmlProperty property(state, "name");
if (property.isValid()) if (property.isValid())
@@ -493,7 +493,7 @@ bool QuickItemNodeInstance::isRenderable() const
QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const
{ {
QList<ServerNodeInstance> instanceList; QList<ServerNodeInstance> instanceList;
const QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem()); const QObjectList stateList = QQuickDesignerSupport::statesForItem(quickItem());
for (QObject *state : stateList) for (QObject *state : stateList)
{ {
if (state && nodeInstanceServer()->hasInstanceForObject(state)) if (state && nodeInstanceServer()->hasInstanceForObject(state))

View File

@@ -762,7 +762,7 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta
if (!nodeInstanceServer->hasInstanceForObject(item)) if (!nodeInstanceServer->hasInstanceForObject(item))
emitComponentComplete(object); emitComponentComplete(object);
QList<QObject*> childList = object->children(); QObjectList childList = object->children();
if (item) { if (item) {
const QList<QQuickItem *> childItems = item->childItems(); const QList<QQuickItem *> childItems = item->childItems();