#ifndef HANDWRITINGENGINE_H #define HANDWRITINGENGINE_H #include #include #include #include #include "matrix.h" #include namespace handwriting { class HandwritingClient; } class HandwritingEngine final : public QObject { Q_OBJECT Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged) Q_PROPERTY(handwriting::Matrix *matrix READ matrix CONSTANT) public: explicit HandwritingEngine(QObject *parent = nullptr); virtual ~HandwritingEngine() = default; Q_INVOKABLE void recognize(); Q_INVOKABLE void setNeuralNetworkData(const QString &networkDataPath); Q_INVOKABLE void updateValue(int index, double value); int result() const { return m_result; } handwriting::Matrix *matrix() { return &m_matrix; } public slots: void setResult(int result) { if (m_result == result) return; m_result = result; emit resultChanged(m_result); } signals: void resultChanged(int result); private: std::shared_ptr m_client; int m_result; QtProtobuf::DoubleList m_data; handwriting::Matrix m_matrix; }; #endif // HANDWRITINGENGINE_H