#ifndef SHAREDATA_H #define SHAREDATA_H #include "serialcontroller.h" #include "qserialproto.h" #include #include #include "lua_wraper.h" class ShareData : public QObject { Q_OBJECT Q_PROPERTY(QString _txt READ rtxt WRITE settxt NOTIFY txtchanged) public: explicit ShareData(QObject *parent = nullptr); QString rtxt() const{ return _txt; } void settxt(QString s){ _txt = s; emit txtchanged(); } Q_INVOKABLE void getValFromQml(int v) { qDebug() << "value from qml is :" << v; emit valueFromCpp(456); } Q_INVOKABLE int OpenUart(QString port,QString baudRate,QString dataBits,QString stopBits, QString flow); Q_INVOKABLE int CloseSerial(); Q_INVOKABLE int TestLua(); Q_INVOKABLE int TestShowData(); QString _txt = "hello world\r\n"; void SetProtoDebug(QObject * ); signals: void txtchanged(); void valueFromCpp(int val); private: SerialController *mSerialController; LuaDelegate mLua; QObject *mProtoDebug; }; #endif // SHAREDATA_H