12 #include "cppwebframework_global.h" 20 class CPPWEBFRAMEWORKSHARED_EXPORT
QListObject :
public QObject
24 bool autoDelete =
false;
30 explicit QListObject(QObject *parent = 0) : QObject(parent) {}
34 explicit QListObject(QObject *parent,
const std::initializer_list<QObject *> &objects) : QObject(parent) { add(objects); }
38 explicit QListObject(
const std::initializer_list<QObject *> &objects) : QObject(nullptr) { add(objects); }
48 inline QObject *operator [](
int index)
const {
return children()[index]; }
53 inline int size()
const {
return children().count(); }
58 inline void add(QObject *
object) {
object->setParent(
this); }
62 inline void add(
const std::initializer_list<QObject *> &objects)
64 std::for_each(objects.begin(), objects.end(), [&](QObject *o){ o->setParent(
this); });
70 inline void remove(QObject *object) {
object->setParent(
nullptr); }
85 #endif // QLISTOBJECT_H QListObject(const std::initializer_list< QObject *> &objects)
Contructs a QListObject with N elements.
Definition: qlistobject.h:38
void add(const std::initializer_list< QObject *> &objects)
This method add a N new QObjects to the list.
Definition: qlistobject.h:62
QListObject(QObject *parent=0)
This constructor can receive a parent.
Definition: qlistobject.h:30
bool getAutoDelete() const
getAutoDelete
Definition: qlistobject.h:75
int size() const
This method returns the number of elements in this QListObject.
Definition: qlistobject.h:53
void add(QObject *object)
This method add a new QObject to the list.
Definition: qlistobject.h:58
QListObject(QObject *parent, const std::initializer_list< QObject *> &objects)
Contructs a QListObject with N elements.
Definition: qlistobject.h:34
The QListObject class is used to pass a list of object to a view page. NOTE: Always when you need to ...
Definition: qlistobject.h:20
void setAutoDelete(bool value)
setAutoDelete
Definition: qlistobject.h:80