1 Star 0 Fork 3

蜗牛的路/serialQuickCore

forked from 王徐晓/serialQuickCore 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
qmlconncpp.h 2.56 KB
一键复制 编辑 原始数据 按行查看 历史
wangxuxiao@win10 提交于 2019-09-28 14:07 . 固子设置与上报记录
#ifndef QMLCONNCPP_H
#define QMLCONNCPP_H
#include <QObject>
#include <QDebug>
#include "../serialQuickCommon/globalobject.h"
#include "../serialQuickCommon/station.h"
class qmlConnCpp : public QObject
{
Q_OBJECT
Q_PROPERTY(QString qmlDevice READ readqmlDevice NOTIFY manChanged)
public:
qmlConnCpp(){}
QString readqmlDevice(){return qmlEditDevice;}
Q_INVOKABLE void setqmlDevice(int deviceid){}
Q_INVOKABLE QString getqmlDevice(int deviceid) {qmlEditDevice=GetData::getJSON_Device(deviceid); return qmlEditDevice;}
Q_INVOKABLE QString getqmlDeviceProtocolGroup() {
QString strlist="[";
QVariantList varlist=GetData::getVariant_DeviceProtocolGroup();
for(int i=0;i<varlist.size();i++)
{
if(0!=i) strlist+=",";
strlist+="\""+varlist.at(i).value<QVariantMap>()["protocolGroup"].toString()+"\"";
}
return strlist+"]";
}
Q_INVOKABLE QString getqmlDeviceProtocolByGroup(QString group) {
// QString strlist="[";
// QVariantList varlist=GetData::getVariant_DeviceProtocolByGroup(group);
// return JsonHelper::getJson(varlist);
// for(int i=0;i<varlist.size();i++)
// {
// if(0!=i) strlist+=",";
// strlist+="{ \"protocolId\": \""+varlist.at(i).value<QVariantMap>()["protocolId"].toByteArray().toHex()+"\", \"protocolName\": \""+varlist.at(i).value<QVariantMap>()["protocolName"].toString()+"\", \"protocolText\": \""+varlist.at(i).value<QVariantMap>()["protocolText"].toString()+"\" }";
// }
// return strlist+"]";
return JsonHelper::getJson(GetData::getVariant_DeviceProtocolByGroup(group));
}
Q_INVOKABLE QString getqmlDeviceProtocolById(QString id) {return JsonHelper::getJson(GetData::getVariant_DeviceProtocol(id));}
Q_INVOKABLE QString getqmlServerSendTask() {return JsonHelper::getJson(GetData::getVariant_ServerSendTask());}
Q_INVOKABLE bool setsqlDevice(QString json){return SetData::Update_Device(json);}
QString man() {return QString("[{\"name\":\"Joy\",\"age\":30},{\"name\":\"James\",\"age\":36},{\"name\":\"Lily\",\"age\":20}]");}
Q_INVOKABLE void clickItem(int index){qDebug()<<index;}
Q_INVOKABLE void clickDeviceItem(int index){Station::clickDeviceItem(index);}
Q_INVOKABLE void clickHostItem(int index){Station::clickHostItem(index);}
Q_INVOKABLE void serialRefresh(){portlist.setText(serialbox.SerialRefresh(true));}
Q_INVOKABLE void goUpdate(){Station::goUpDate();}
signals:
void manChanged();
private:
QString qmlEditDevice;
};
#endif // QMLCONNCPP_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/492228993/serialQuickCore.git
git@gitee.com:492228993/serialQuickCore.git
492228993
serialQuickCore
serialQuickCore
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385