Aggregation Namespace
The Aggregation namespace contains support for bundling related components, so that each component exposes the properties and behavior of the other components to the outside. More...
Header: | #include <Aggregation> |
Classes
class | Aggregate |
Functions
void | aggregate(const QObjectList &components) |
T * | query(QObject *obj) |
QList<T *> | query_all(QObject *obj) |
Detailed Description
Components that are bundled into an aggregate can be cast to each other and have a coupled life cycle. See the documentation of Aggregation::Aggregate for details and examples.
Classes
class Aggregate
The Aggregate class defines a collection of related components that can be viewed as a unit. More...
Function Documentation
void Aggregation::aggregate(const QObjectList &components)
This is a convenience function that creates a new Aggregate and adds all components to it. If any components already belong to an Aggregate, the remaining components are added to that instead. The components may not belong to different Aggregates to begin with.
See also Aggregate.
template <typename T> T *query(QObject *obj)
Performs a dynamic cast that is aware of a possible aggregate that obj might belong to. If obj itself is of the requested type, it is simply cast and returned. Otherwise, if obj belongs to an aggregate, all its components are checked. If it doesn't belong to an aggregate, null is returned.
See also Aggregate::component().
template <typename T> QList<T *> query_all(QObject *obj)
If obj belongs to an aggregate, all components that can be cast to the given type are returned. Otherwise, obj is returned if it is of the requested type.
See also Aggregate::components().
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.