2015-12-27 15:40:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <functional>
|
|
|
|
|
2015-12-27 17:58:49 +01:00
|
|
|
namespace DOS
|
|
|
|
{
|
|
|
|
|
2015-12-27 15:40:33 +01:00
|
|
|
class DynamicQObjectFactory;
|
|
|
|
|
|
|
|
class DynamicQObject2 : public QObject
|
|
|
|
{
|
|
|
|
public:
|
2015-12-27 17:58:49 +01:00
|
|
|
using OnSlotExecuted = std::function<QVariant(const QString&, const std::vector<QVariant>&)>;
|
2015-12-27 15:40:33 +01:00
|
|
|
|
|
|
|
DynamicQObject2(const DynamicQObjectFactory* factory,
|
|
|
|
OnSlotExecuted handler);
|
|
|
|
|
|
|
|
void emitSignal(const QString& name, const std::vector<QVariant>& arguments);
|
|
|
|
const QMetaObject* metaObject() const override;
|
|
|
|
int qt_metacall(QMetaObject::Call callType, int index, void**args) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool executeSlot(int index, void** args);
|
|
|
|
bool readProperty(int index, void** args);
|
|
|
|
bool writeProperty(int index, void** args);
|
|
|
|
|
|
|
|
const DynamicQObjectFactory* const m_factory;
|
|
|
|
const OnSlotExecuted m_handler;
|
|
|
|
};
|
2015-12-27 17:58:49 +01:00
|
|
|
|
|
|
|
} // namespace DOS
|