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

View File

@@ -51,7 +51,7 @@ signals:
void changed();
private:
friend AGGREGATION_EXPORT void aggregate(QList<QObject *>);
friend AGGREGATION_EXPORT void aggregate(const QObjectList &);
enum PrivateConstructor { PrivateConstructor };
Aggregate(enum PrivateConstructor);
void construct();
@@ -60,10 +60,10 @@ private:
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
template <typename T> T *query(Aggregate *obj)

View File

@@ -297,7 +297,7 @@ void PluginManager::removeObject(QObject *obj)
\sa PluginManager::getObject()
*/
QVector<QObject *> PluginManager::allObjects()
QObjectList PluginManager::allObjects()
{
return d->allObjects;
}
@@ -1152,7 +1152,7 @@ static QStringList matchingTestFunctions(const QStringList &testFunctions,
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 {
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
/// 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;
@@ -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
/// be included multiple times for a test object.
static TestPlan generateCustomTestPlan(IPlugin *plugin,
const QVector<QObject *> &testObjects,
const QObjectList &testObjects,
const QStringList &matchTexts)
{
TestPlan testPlan;
@@ -1222,7 +1222,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin,
const QStringList testFunctionsOfPluginObject = testFunctions(plugin->metaObject());
QStringList matchedTestFunctionsOfPluginObject;
QStringList remainingMatchTexts = matchTexts;
QVector<QObject *> remainingTestObjectsOfPlugin = testObjects;
QObjectList remainingTestObjectsOfPlugin = testObjects;
while (!remainingMatchTexts.isEmpty()) {
const QString matchText = remainingMatchTexts.takeFirst();
@@ -1289,7 +1289,7 @@ void PluginManagerPrivate::startTests()
continue; // plugin not loaded
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 bool hasDuplicateTestObjects = testObjects.size()

View File

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

View File

@@ -93,7 +93,7 @@ public:
std::vector<TestSpec> testSpecs;
Utils::FilePaths pluginPaths;
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 defaultEnabledPlugins; // Plugins/ForceEnabled from install settings
QStringList disabledPlugins;

View File

@@ -17,7 +17,7 @@ struct Group
{
Group(Utils::Id id) : id(id) {}
Utils::Id id;
QList<QObject *> items; // Command * or ActionContainer *
QObjectList items; // Command * or 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.
*/
const QList<QObject *> plugins = QPluginLoader::staticInstances() + m_formeditor->pluginInstances();
const QObjectList plugins = QPluginLoader::staticInstances() + m_formeditor->pluginInstances();
for (QObject *plugin : plugins) {
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
if (!formEditorPlugin->isInitialized())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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