#ifndef QQuickFunctionLibrary_h__ #define QQuickFunctionLibrary_h__ #include #include #include #include "export.hpp" class QQuickLambdaHolder; class QQuickLambdaHolder_OneParam; class DIAGRAM_DESIGNER_PUBLIC QQuickFunctionLibrary : public QObject { Q_OBJECT public: static QQuickFunctionLibrary* Get(); Q_INVOKABLE QString numberToString(QVariant var,int precision); Q_INVOKABLE void setCursorPos(qreal x, qreal y); Q_INVOKABLE void setOverrideCursorShape(Qt::CursorShape shape); Q_INVOKABLE void restoreOverrideCursorShape(); Q_INVOKABLE void setCursorPosTest(QQuickItem* item, qreal x, qreal y); static QMetaObject::Connection connect(QObject* sender, const char* signal, QObject* receiver, std::function callback); static QMetaObject::Connection connect(QObject* sender, const char* signal, QObject* receiver, std::function callback); static QMetaObject::Connection connect(QObject* sender, const char* signal, QObject* receiver, std::function callback); }; class DIAGRAM_DESIGNER_PUBLIC QQuickLambdaHolder : public QObject { Q_OBJECT std::function mCallback; public: QQuickLambdaHolder(std::function callback, QObject* parent) : QObject(parent) , mCallback(std::move(callback)) {} Q_SLOT void call() { mCallback(); } }; class DIAGRAM_DESIGNER_PUBLIC QQuickLambdaHolder_OneParam : public QObject { Q_OBJECT std::function mCallback; public: QQuickLambdaHolder_OneParam(std::function callback, QObject* parent) : QObject(parent) , mCallback(std::move(callback)) { } Q_SLOT void call(QVariant inParam0) { mCallback(inParam0); } }; class DIAGRAM_DESIGNER_PUBLIC QQuickLambdaHolder_TwoParams : public QObject { Q_OBJECT std::function mCallback; public: QQuickLambdaHolder_TwoParams(std::function callback, QObject* parent) : QObject(parent) , mCallback(std::move(callback)) { } Q_SLOT void call(QVariant inParam0, QVariant inParam1) { mCallback(inParam0, inParam1); } }; #endif // QQuickFunctionLibrary_h__