You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
584 B
27 lines
584 B
4 years ago
|
#ifndef USLIST_H
|
||
|
#define USLIST_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QDebug>
|
||
|
|
||
|
#define US_LIST(TYPE, NAME) \
|
||
|
Q_PROPERTY(QList<TYPE> NAME READ NAME WRITE NAME NOTIFY NAME ## Changed) \
|
||
|
public: \
|
||
|
QList<TYPE> NAME() const { return _ ## NAME; } \
|
||
|
void NAME(QList<TYPE> value) { \
|
||
|
if(_ ## NAME == value)return; \
|
||
|
_ ## NAME.clear(); \
|
||
|
for(int i = 0; i < value.length(); i++) \
|
||
|
{ \
|
||
|
_ ## NAME.append(value[i]); \
|
||
|
} \
|
||
|
emit NAME ## Changed(value); \
|
||
|
send(); \
|
||
|
} \
|
||
|
Q_SIGNAL void NAME ## Changed(QList<TYPE> value); \
|
||
|
private: \
|
||
|
QList<TYPE> _ ## NAME; \
|
||
|
|
||
|
|
||
|
#endif //USLIST_H
|