Aggregation: Modernize

modernize-use-nullptr

Change-Id: I8775e7f4bdfed143a59c791d86f4b1acf11bcc73
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2018-07-27 15:27:27 +02:00
parent 11632bbedd
commit 3fa22f19a6

View File

@@ -40,7 +40,7 @@ class AGGREGATION_EXPORT Aggregate : public QObject
Q_OBJECT
public:
Aggregate(QObject *parent = 0);
Aggregate(QObject *parent = nullptr);
~Aggregate() override;
void add(QObject *component);
@@ -52,7 +52,7 @@ public:
if (T *result = qobject_cast<T *>(component))
return result;
}
return (T *)0;
return nullptr;
}
template <typename T> QList<T *> components() {
@@ -84,19 +84,19 @@ private:
template <typename T> T *query(Aggregate *obj)
{
if (!obj)
return (T *)0;
return nullptr;
return obj->template component<T>();
}
template <typename T> T *query(QObject *obj)
{
if (!obj)
return (T *)0;
return nullptr;
T *result = qobject_cast<T *>(obj);
if (!result) {
QReadLocker locker(&Aggregate::lock());
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
result = (parentAggregation ? query<T>(parentAggregation) : 0);
result = (parentAggregation ? query<T>(parentAggregation) : nullptr);
}
return result;
}