forked from qt-creator/qt-creator
Aggregation: Modernize
modernize-use-nullptr Change-Id: I8775e7f4bdfed143a59c791d86f4b1acf11bcc73 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ class AGGREGATION_EXPORT Aggregate : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Aggregate(QObject *parent = 0);
|
Aggregate(QObject *parent = nullptr);
|
||||||
~Aggregate() override;
|
~Aggregate() override;
|
||||||
|
|
||||||
void add(QObject *component);
|
void add(QObject *component);
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
if (T *result = qobject_cast<T *>(component))
|
if (T *result = qobject_cast<T *>(component))
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return (T *)0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> QList<T *> components() {
|
template <typename T> QList<T *> components() {
|
||||||
@@ -84,19 +84,19 @@ private:
|
|||||||
template <typename T> T *query(Aggregate *obj)
|
template <typename T> T *query(Aggregate *obj)
|
||||||
{
|
{
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return (T *)0;
|
return nullptr;
|
||||||
return obj->template component<T>();
|
return obj->template component<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> T *query(QObject *obj)
|
template <typename T> T *query(QObject *obj)
|
||||||
{
|
{
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return (T *)0;
|
return nullptr;
|
||||||
T *result = qobject_cast<T *>(obj);
|
T *result = qobject_cast<T *>(obj);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
QReadLocker locker(&Aggregate::lock());
|
QReadLocker locker(&Aggregate::lock());
|
||||||
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
|
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
|
||||||
result = (parentAggregation ? query<T>(parentAggregation) : 0);
|
result = (parentAggregation ? query<T>(parentAggregation) : nullptr);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user