2023-01-04 15:50:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
2023-01-13 12:42:30 +00:00
|
|
|
#include <QJSValue>
|
|
|
|
|
|
|
|
#include "ContextPropertiesModel.h"
|
2023-01-04 15:50:37 +00:00
|
|
|
|
|
|
|
class QQmlApplicationEngine;
|
|
|
|
class QQmlEngine;
|
|
|
|
class QJSEngine;
|
|
|
|
|
|
|
|
class Monitor : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-01-13 12:42:30 +00:00
|
|
|
Q_PROPERTY(ContextPropertiesModel* contexPropertiesModel
|
|
|
|
READ contexPropertiesModel CONSTANT)
|
2023-01-04 15:50:37 +00:00
|
|
|
|
|
|
|
Monitor() = default;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void initialize(QQmlApplicationEngine *engine);
|
2023-01-13 12:42:30 +00:00
|
|
|
ContextPropertiesModel* contexPropertiesModel();
|
2023-01-04 15:50:37 +00:00
|
|
|
void addContextPropertyName(const QString &contextPropertyName);
|
|
|
|
|
2023-01-13 12:42:30 +00:00
|
|
|
Q_INVOKABLE bool isModel(const QVariant &obj) const;
|
|
|
|
Q_INVOKABLE QString typeName(const QVariant &obj) const;
|
|
|
|
Q_INVOKABLE QJSValue modelRoles(QAbstractItemModel *model) const;
|
|
|
|
|
2023-01-04 15:50:37 +00:00
|
|
|
static Monitor& instance();
|
|
|
|
static QObject* qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine);
|
|
|
|
|
|
|
|
private:
|
2023-01-13 12:42:30 +00:00
|
|
|
ContextPropertiesModel m_contexPropertiesModel;
|
2023-01-04 15:50:37 +00:00
|
|
|
};
|