forked from qt-creator/qt-creator
PluginManager::getObject(): Remove special support for aggregates
Since no one is using it and it's faster this way. Change-Id: Ib60d3a54aed98011b2fb4bb7d159e219abebfa7e Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -108,9 +108,7 @@ enum { debugLeaks = 0 };
|
|||||||
Plugins (and everybody else) can add objects to a common 'pool' that is located in
|
Plugins (and everybody else) can add objects to a common 'pool' that is located in
|
||||||
the plugin manager. Objects in the pool must derive from QObject, there are no other
|
the plugin manager. Objects in the pool must derive from QObject, there are no other
|
||||||
prerequisites. All objects of a specified type can be retrieved from the object pool
|
prerequisites. All objects of a specified type can be retrieved from the object pool
|
||||||
via the getObjects() and getObject() functions. They are aware of Aggregation::Aggregate, i.e.
|
via the getObjects() and getObject() functions.
|
||||||
these functions use the Aggregation::query functions instead of a qobject_cast to determine
|
|
||||||
the matching objects.
|
|
||||||
|
|
||||||
Whenever the state of the object pool changes a corresponding signal is emitted by the plugin manager.
|
Whenever the state of the object pool changes a corresponding signal is emitted by the plugin manager.
|
||||||
|
|
||||||
@@ -220,9 +218,7 @@ enum { debugLeaks = 0 };
|
|||||||
|
|
||||||
Retrieves the object of a given type from the object pool.
|
Retrieves the object of a given type from the object pool.
|
||||||
|
|
||||||
This function is aware of Aggregation::Aggregate. That is, it uses
|
This function uses \c qobject_cast to determine the type of an object.
|
||||||
the \c Aggregation::query functions instead of \c qobject_cast to
|
|
||||||
determine the type of an object.
|
|
||||||
If there are more than one object of the given type in
|
If there are more than one object of the given type in
|
||||||
the object pool, this function will choose an arbitrary one of them.
|
the object pool, this function will choose an arbitrary one of them.
|
||||||
|
|
||||||
@@ -234,9 +230,7 @@ enum { debugLeaks = 0 };
|
|||||||
|
|
||||||
Retrieves all objects of a given type from the object pool.
|
Retrieves all objects of a given type from the object pool.
|
||||||
|
|
||||||
This function is aware of Aggregation::Aggregate. That is, it uses
|
This function uses \c qobject_cast to determine the type of an object.
|
||||||
the \c Aggregation::query functions instead of \c qobject_cast to
|
|
||||||
determine the type of an object.
|
|
||||||
|
|
||||||
\sa addObject()
|
\sa addObject()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,10 +68,9 @@ public:
|
|||||||
QReadLocker lock(listLock());
|
QReadLocker lock(listLock());
|
||||||
QList<T *> results;
|
QList<T *> results;
|
||||||
QList<QObject *> all = allObjects();
|
QList<QObject *> all = allObjects();
|
||||||
QList<T *> result;
|
|
||||||
foreach (QObject *obj, all) {
|
foreach (QObject *obj, all) {
|
||||||
result = Aggregation::query_all<T>(obj);
|
T *result = qobject_cast<T *>(obj);
|
||||||
if (!result.isEmpty())
|
if (result)
|
||||||
results += result;
|
results += result;
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -80,12 +79,11 @@ public:
|
|||||||
{
|
{
|
||||||
QReadLocker lock(listLock());
|
QReadLocker lock(listLock());
|
||||||
QList<QObject *> all = allObjects();
|
QList<QObject *> all = allObjects();
|
||||||
T *result = 0;
|
|
||||||
foreach (QObject *obj, all) {
|
foreach (QObject *obj, all) {
|
||||||
if ((result = Aggregation::query<T>(obj)) != 0)
|
if (T *result = qobject_cast<T *>(obj))
|
||||||
break;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QObject *getObjectByName(const QString &name);
|
static QObject *getObjectByName(const QString &name);
|
||||||
|
|||||||
Reference in New Issue
Block a user