dotherside/lib/include/DOtherSide/DynamicQObject2.h
Filippo Cucchetto 83893b2934 Introduced the concept of factories
The use of a factory decreased the creation time from 500ms for 1000 DynamicQObjects to 1.6ms
2016-04-10 14:39:20 +02:00

28 lines
799 B
C++

#pragma once
#include <QObject>
#include <functional>
class DynamicQObjectFactory;
class DynamicQObject2 : public QObject
{
public:
using OnSlotExecuted = std::function<QVariant(int, const QString&, const std::vector<QVariant>&)>;
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;
};