Quarts/Quartz/ArrDifferentTypes.h
2025-05-21 18:40:33 +07:00

44 lines
1.1 KiB
C++

#ifndef ARRDIFFERENTTYPES_H
#define ARRDIFFERENTTYPES_H
#include <QObject>
#include <QQmlEngine>
#include <QList>
#include <QObject>
#include <QList>
#include <QVariant>
class ArrDifferentTypes : public QObject
{
Q_OBJECT
Q_PROPERTY(QList<QVariant> arrDifferentTypes READ getArrDifferentTypes WRITE setArrDifferentTypes NOTIFY arrDifferentTypesChanged)
QML_ELEMENT
public:
explicit ArrDifferentTypes(QObject *parent = nullptr) : QObject(parent) {}
~ArrDifferentTypes() override {
qDebug() << "ArrDifferentTypes object is being destroyed:" << this;
}
QList<QVariant> getArrDifferentTypes() const { return arrDifferentTypes; }
void setArrDifferentTypes(const QList<QVariant> &arr) {
if (arrDifferentTypes != arr) {
arrDifferentTypes = arr;
emit arrDifferentTypesChanged();
}
}
public slots:
void addVarToData(const QVariant& value) {
arrDifferentTypes.append(value);
emit arrDifferentTypesChanged();
}
signals:
void arrDifferentTypesChanged();
private:
QList<QVariant> arrDifferentTypes;
};
#endif // ARRDIFFERENTTYPES_H