添加check说明功能
This commit is contained in:
@@ -197,7 +197,42 @@ void CommandUI::loadCommandJson(const QString& jsonFilename)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CommandUI::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
||||
{
|
||||
//找到消息的发送者
|
||||
QObjectList list = ui->groupBox_Command->children();
|
||||
|
||||
for(QJsonValue info: CMD_infoArray) {
|
||||
if (!info.isObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(command == info.toObject().find(_commandJsonKey).value().toInt())
|
||||
{
|
||||
foreach (QObject *obj, list)
|
||||
{
|
||||
QPushButton *btn = qobject_cast<QPushButton *>(obj);
|
||||
if(btn)
|
||||
{
|
||||
if(btn->text() == info.toObject().find(_TextJsonKey).value().toString())
|
||||
{
|
||||
if(flag)
|
||||
{
|
||||
btn->setProperty("state",state::success);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn->setProperty("state",state::failure);
|
||||
}
|
||||
btn->style()->unpolish(btn);
|
||||
btn->style()->polish(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ public:
|
||||
explicit CommandUI(QWidget *parent = nullptr);
|
||||
~CommandUI();
|
||||
|
||||
public slots:
|
||||
|
||||
void commandAccepted(bool flag,uint16_t command,uint8_t result);
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user