修复在windows中字体颜色不对的问题
This commit is contained in:
parent
8802762a9a
commit
e098025c47
@ -620,10 +620,33 @@ void LightStripManager::onClearSnListClicked()
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = QMessageBox::question(this, "确认清空",
|
||||
QString("确定要清空所有 %1 个灯条SN吗?").arg(uniqueSnSet.size()),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("确认清空");
|
||||
msgBox.setText(QString("确定要清空所有 %1 个灯条SN吗?").arg(uniqueSnSet.size()));
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == QMessageBox::Yes) {
|
||||
// 清空所有灯条widget
|
||||
@ -665,14 +688,60 @@ void LightStripManager::onDeleteSelectedClicked()
|
||||
{
|
||||
QStringList selectedSns = getSelectedSns();
|
||||
if (selectedSns.isEmpty()) {
|
||||
QMessageBox::information(this, "提示", "请先选择要删除的灯条SN。");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("提示");
|
||||
msgBox.setText("请先选择要删除的灯条SN。");
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = QMessageBox::question(this, "确认删除",
|
||||
QString("确定要删除选中的 %1 个灯条SN吗?").arg(selectedSns.size()),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("确认删除");
|
||||
msgBox.setText(QString("确定要删除选中的 %1 个灯条SN吗?").arg(selectedSns.size()));
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == QMessageBox::Yes) {
|
||||
// 从后往前删除,避免索引问题
|
||||
@ -800,7 +869,30 @@ void LightStripManager::onSendLightSelectedClicked()
|
||||
{
|
||||
QStringList selectedSns = getSelectedSns();
|
||||
if (selectedSns.isEmpty()) {
|
||||
QMessageBox::information(this, "提示", "请先选择要点亮的灯条。");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("提示");
|
||||
msgBox.setText("请先选择要点亮的灯条。");
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -812,14 +904,59 @@ void LightStripManager::onSendLightSelectedClicked()
|
||||
|
||||
emit lightControlRequested(selectedSns, color, flash, interval, duration, sound);
|
||||
|
||||
QMessageBox::information(this, "发送成功",
|
||||
QString("已向 %1 个选中的灯条发送点亮指令。").arg(selectedSns.size()));
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("发送成功");
|
||||
msgBox.setText(QString("已向 %1 个选中的灯条发送点亮指令。").arg(selectedSns.size()));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void LightStripManager::onSendLightAllClicked()
|
||||
{
|
||||
if (uniqueSnSet.isEmpty()) {
|
||||
QMessageBox::information(this, "提示", "没有可点亮的灯条。");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("提示");
|
||||
msgBox.setText("没有可点亮的灯条。");
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -849,8 +986,30 @@ void LightStripManager::onSendLightAllClicked()
|
||||
}
|
||||
|
||||
// 显示总数量的提示信息
|
||||
QMessageBox::information(this, "发送成功",
|
||||
QString("已向所有灯条发送点亮指令。"));
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("发送成功");
|
||||
msgBox.setText("已向所有灯条发送点亮指令。");
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void LightStripManager::onCheckBoxStateChanged()
|
||||
@ -869,7 +1028,30 @@ void LightStripManager::onRefreshClicked()
|
||||
updateSnCount();
|
||||
updateControlButtons();
|
||||
|
||||
QMessageBox::information(this, "刷新完成", "界面已刷新。");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("刷新完成");
|
||||
msgBox.setText("界面已刷新。");
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
// 删除整个函数实现:
|
||||
@ -974,7 +1156,30 @@ void LightStripManager::onBindIdentitySelectedClicked()
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
QMessageBox::warning(this, "警告", "请先选择要绑定身份信息的灯条");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("警告");
|
||||
msgBox.setText("请先选择要绑定身份信息的灯条");
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -989,7 +1194,30 @@ void LightStripManager::onBindIdentitySelectedClicked()
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
QMessageBox::warning(this, "警告", "请填写完整的Label1、Label2、Label3参数");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("警告");
|
||||
msgBox.setText("请填写完整的Label1、Label2、Label3参数");
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1032,7 +1260,30 @@ void LightStripManager::onBindIdentityAllClicked()
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
QMessageBox::warning(this, "警告", "没有可绑定身份信息的灯条");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("警告");
|
||||
msgBox.setText("没有可绑定身份信息的灯条");
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1144,7 +1395,30 @@ void LightStripManager::onGroupLightClicked()
|
||||
{
|
||||
// 检查身份信息配置
|
||||
if (label1Edit->text().isEmpty() || label2Edit->text().isEmpty() || label3Edit->text().isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请先配置完整的身份信息(label1、label2、label3)!");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("警告");
|
||||
msgBox.setText("请先配置完整的身份信息(label1、label2、label3)!");
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStyleSheet(
|
||||
"QMessageBox { "
|
||||
" color: #000000; " // 消息文本颜色设为黑色
|
||||
"} "
|
||||
"QPushButton { "
|
||||
" color: #000000; " // 按钮文字颜色设为黑色
|
||||
" background-color: #f0f0f0; "
|
||||
" border: 1px solid #ccc; "
|
||||
" border-radius: 4px; "
|
||||
" padding: 6px 12px; "
|
||||
" min-width: 60px; "
|
||||
"} "
|
||||
"QPushButton:hover { "
|
||||
" background-color: #e0e0e0; "
|
||||
"} "
|
||||
"QPushButton:pressed { "
|
||||
" background-color: #d0d0d0; "
|
||||
"}"
|
||||
);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1173,6 +1447,7 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
identityBindingGroup = new QGroupBox("身份信息绑定", this);
|
||||
identityBindingGroup->setStyleSheet(
|
||||
"QGroupBox { "
|
||||
" color: #000000; "
|
||||
" font-weight: bold; "
|
||||
" font-size: 14px; "
|
||||
" border: 2px solid #cccccc; "
|
||||
@ -1181,6 +1456,7 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
" padding-top: 10px; "
|
||||
"} "
|
||||
"QGroupBox::title { "
|
||||
" color: #000000; "
|
||||
" subcontrol-origin: margin; "
|
||||
" left: 10px; "
|
||||
" padding: 0 5px 0 5px; "
|
||||
@ -1195,9 +1471,9 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label1Label->setMinimumWidth(60);
|
||||
label1Label->setStyleSheet(
|
||||
"QLabel { "
|
||||
" color: #000000; "
|
||||
" font-weight: bold; "
|
||||
" font-size: 12px; "
|
||||
" color: #333; "
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
@ -1208,6 +1484,7 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label1Edit->setMinimumHeight(35);
|
||||
label1Edit->setStyleSheet(
|
||||
"QLineEdit { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
@ -1227,13 +1504,15 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
rule1ComboBox->setMinimumWidth(120);
|
||||
rule1ComboBox->setStyleSheet(
|
||||
"QComboBox { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
" font-size: 12px; "
|
||||
" background-color: white; "
|
||||
"} "
|
||||
"QComboBox:focus { border-color: #2196F3; }"
|
||||
"QComboBox:focus { border-color: #2196F3; } "
|
||||
"QComboBox QAbstractItemView { color: #000000; }"
|
||||
);
|
||||
label1Layout->addWidget(rule1ComboBox);
|
||||
|
||||
@ -1245,9 +1524,9 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label2Label->setMinimumWidth(60);
|
||||
label2Label->setStyleSheet(
|
||||
"QLabel { "
|
||||
" color: #000000; "
|
||||
" font-weight: bold; "
|
||||
" font-size: 12px; "
|
||||
" color: #333; "
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
@ -1258,6 +1537,7 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label2Edit->setMinimumHeight(35);
|
||||
label2Edit->setStyleSheet(
|
||||
"QLineEdit { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
@ -1277,13 +1557,15 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
rule2ComboBox->setMinimumWidth(120);
|
||||
rule2ComboBox->setStyleSheet(
|
||||
"QComboBox { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
" font-size: 12px; "
|
||||
" background-color: white; "
|
||||
"} "
|
||||
"QComboBox:focus { border-color: #2196F3; }"
|
||||
"QComboBox:focus { border-color: #2196F3; } "
|
||||
"QComboBox QAbstractItemView { color: #000000; }"
|
||||
);
|
||||
label2Layout->addWidget(rule2ComboBox);
|
||||
|
||||
@ -1295,9 +1577,9 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label3Label->setMinimumWidth(60);
|
||||
label3Label->setStyleSheet(
|
||||
"QLabel { "
|
||||
" color: #000000; "
|
||||
" font-weight: bold; "
|
||||
" font-size: 12px; "
|
||||
" color: #333; "
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
@ -1308,6 +1590,7 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
label3Edit->setMinimumHeight(35);
|
||||
label3Edit->setStyleSheet(
|
||||
"QLineEdit { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
@ -1327,13 +1610,15 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
rule3ComboBox->setMinimumWidth(120);
|
||||
rule3ComboBox->setStyleSheet(
|
||||
"QComboBox { "
|
||||
" color: #000000; "
|
||||
" padding: 8px; "
|
||||
" border: 2px solid #ddd; "
|
||||
" border-radius: 4px; "
|
||||
" font-size: 12px; "
|
||||
" background-color: white; "
|
||||
"} "
|
||||
"QComboBox:focus { border-color: #2196F3; }"
|
||||
"QComboBox:focus { border-color: #2196F3; } "
|
||||
"QComboBox QAbstractItemView { color: #000000; }"
|
||||
);
|
||||
label3Layout->addWidget(rule3ComboBox);
|
||||
|
||||
@ -1381,9 +1666,9 @@ void LightStripManager::setupIdentityBindingArea()
|
||||
bindingStatusLabel = new QLabel("状态: 就绪");
|
||||
bindingStatusLabel->setStyleSheet(
|
||||
"QLabel { "
|
||||
" color: #000000; "
|
||||
" font-weight: bold; "
|
||||
" font-size: 12px; "
|
||||
" color: #4CAF50; "
|
||||
" padding: 5px; "
|
||||
"}"
|
||||
);
|
||||
|
||||
@ -823,7 +823,7 @@ void MainWindow::sendSearchLightStripCommand() {
|
||||
messageDisplay->append("---");
|
||||
|
||||
// 弹出提示框
|
||||
QMessageBox::information(this, "搜索灯条", "正在搜索灯条,请等待2分钟返回结果...");
|
||||
QMessageBox::information(this, "搜索灯条", "不要做其他指令,正在搜索灯条,请等待2分钟返回结果...");
|
||||
} else {
|
||||
messageDisplay->append(QString("[%1] 发送搜索灯条命令失败")
|
||||
.arg(QDateTime::currentDateTime().toString("hh:mm:ss")));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user