1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| ui.btnServerOn->setFont(font); ui.btnServerOn->setStyleSheet("background-color:#F0F0F0;"); connect(ui.btnServerOn, &QPushButton::clicked, this, [=]() { CustomMessageBox msgBox; msgBox.setText(QStringLiteral("一键上使能?")); msgBox.addButton(QStringLiteral("上使能"), QMessageBox::YesRole); msgBox.addButton(QStringLiteral("取消"), QMessageBox::NoRole); msgBox.setFont(QFont(WRYH, 16)); // 设置字体为微软雅黑 Light,大小为16 msgBox.setWindowFlags(msgBox.windowFlags() | Qt::WindowStaysOnTopHint); int iValue = msgBox.exec(); if (0 == iValue) { ui.btnServerOn->setStyleSheet("background-color:#FF0000;"); Sleep(50); ui.btnServerOn->repaint(); Sleep(50); ui.btnServerOn->setEnabled(false); for (int i = 0; i < s_pCardAdmin->mapCardInfo.size(); i++) { for (int j = 0; j < s_pCardAdmin->mapCardInfo[i]->cardAxisNum; j++) { if (MT_SEVER == s_pCardAdmin->mapCardInfo[i]->mapAxisInfo[j]->motoType) { s_pCardAdmin->AxisSetDO(i, j, 0, 0); //上使能 //s_pCardAdmin->AxisSetDO(i, j, 0, 1); //断使能 } } } ui.btnServerOn->setStyleSheet("background-color:#F0F0F0;"); ui.btnServerOn->setEnabled(true); } });
|