#include <QObject>
#include <QSharedPointer>
#include <QVariant>
Go to the source code of this file.
|
template<typename W , typename D > |
W * | wrapQObject (D data, QObject *parent) |
| Wraps a data object in a QObject.
|
|
template<typename W , typename D , typename It > |
QVariantList | wrapQVariantList (It begin, It end, QObject *parent) |
| Wraps a list of DTO items in a QVariantList of QObject's.
|
|
template<typename W , typename D , typename It > |
QObjectList | wrapQObjectList (It begin, It end, QObject *parent) |
| Wraps a list of DTO items in a QObjectList.
|
|
◆ wrapQObject()
template<typename W , typename D >
W * wrapQObject |
( |
D | data, |
|
|
QObject * | parent ) |
Wraps a data object in a QObject.
This class is made for use in the ViewModel namespace, since many objects follow the pattern of having a constructor with a QSharedPointer<DTO::SomeItem> and a parent.
The QObject wrapper class W must have a accessible constructor which takes only a QSharedPointer<D> as argument.
- Template Parameters
-
W | The QObject wrapper class |
D | The DTO class |
- Parameters
-
data | The data to wrap in a QObject |
parent | The QObject to set as the parent of the newly created type. |
◆ wrapQObjectList()
template<typename W , typename D , typename It >
QObjectList wrapQObjectList |
( |
It | begin, |
|
|
It | end, |
|
|
QObject * | parent ) |
Wraps a list of DTO items in a QObjectList.
- See also
- wrapQObject()
- Parameters
-
begin | The begin iterator of the list of DTO items |
end | The end iterator of the list of DTO items |
parent | The QObject to set as the parent of the QObjects in the newly created list. |
◆ wrapQVariantList()
template<typename W , typename D , typename It >
QVariantList wrapQVariantList |
( |
It | begin, |
|
|
It | end, |
|
|
QObject * | parent ) |
Wraps a list of DTO items in a QVariantList of QObject's.
- See also
- wrapQObject()
- Parameters
-
begin | The begin iterator of the list of DTO items |
end | The end iterator of the list of DTO items |
parent | The QObject to set as the parent of the QObjects in the newly created list. |