Commit da10d978 authored by ym0408's avatar ym0408

7

parent b25211ae
......@@ -4,49 +4,50 @@
#include <QPainter> // 用于绘制弹窗圆角(必须包含)
MultiFunctionDialog::MultiFunctionDialog(DialogType type,QWidget *parent) :
QDialog(parent),m_dialogType(type),
ui(new Ui::MultiFunctionDialog)
QDialog(parent),m_dialogType(type)
//ui(new Ui::MultiFunctionDialog)
{
//ui->setupUi(this);
// ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
// -------------------------- 关键修改1:弹窗样式(白色背景+圆角+边框) --------------------------
setStyleSheet(R"(
QDialog {
background-color: white; /* 弹窗背景设为白色,非透明 */
border-radius: 12px; /* 弹窗圆角(可调整数值,越大越圆) */
border: 1px solid #f0f0f0; /* 可选:添加淡灰色边框,更显圆角效果 */
}
)");
QDialog {
background-color: white; /* 弹窗背景设为白色,非透明 */
border-radius: 12px; /* 弹窗圆角(可调整数值,越大越圆) */
border: 1px solid #f0f0f0; /* 可选:添加淡灰色边框,更显圆角效果 */
}
)");
// 弹窗基础设置
setWindowTitle("选择设置");
// setFixedSize(1900, 700); // 修正:原1800x800太大,改为适配弹窗的尺寸(可按需调整)
// setFixedSize(1900, 700);
// move(40,440);
// 根据类型初始化对应的UI
switch (m_dialogType) {
case WorkStationType:
setWindowTitle("请选择要设置的工位");
setFixedSize(1900, 700); // 修正:原1800x800太大,改为适配弹窗的尺寸(可按需调整)
move(40,440);
initWorkStationUI();
break;
case DeviceType:
setWindowTitle("请选择设备名称");
setFixedSize(1900, 700); // 修正:原1800x800太大,改为适配弹窗的尺寸(可按需调整)
move(40,440);
initDeviceUI();
break;
case InspectionType:
setWindowTitle("请选择抽检项类型");
setFixedSize(1900, 700); // 修正:原1800x800太大,改为适配弹窗的尺寸(可按需调整)
move(40,440);
initInspectionUI();
break;
case TimeRangeType:
setWindowTitle("请选择时间范围");
setFixedSize(400, 320); // 时间弹窗稍大
initTimeRangeUI();
break;
case WorkStationType:
setWindowTitle("请选择要设置的工位");
setFixedSize(1940, 720);
move(40,400);
initWorkStationUI();
break;
case DeviceType:
setWindowTitle("请选择设备名称");
setFixedSize(1940, 320);
move(40,780);
initDeviceUI();
break;
case InspectionType:
setWindowTitle("请选择抽检项类型");
setFixedSize(1940, 500);
move(40,620);
initInspectionUI();
break;
case TimeRangeType:
setWindowTitle("请选择时间范围");
setFixedSize(1900, 1000); // 时间弹窗稍大
move(40,50);
initTimeRangeUI();
break;
}
}
......@@ -55,7 +56,7 @@ MultiFunctionDialog::~MultiFunctionDialog()
//delete ui;
}
// -------------------------- 关键补充:重写paintEvent实现圆角(必须,否则弹窗圆角不生效) --------------------------
// -------------------------- 重写paintEvent实现圆角 --------------------------
void MultiFunctionDialog::paintEvent(QPaintEvent *event) {
QStyleOption opt;
opt.initFrom(this);
......@@ -69,7 +70,7 @@ void MultiFunctionDialog::initWorkStationUI() {
// 标题
QLabel *titleLabel = new QLabel("请选择要设置的工位", this);
titleLabel->setAlignment(Qt::AlignLeft);
titleLabel->setStyleSheet("font-size: 25px; font-weight: bold; margin-bottom: 15px;"); // 标题加粗加大,增加底部间距
titleLabel->setStyleSheet("font-size: 25px; font-weight: bold; margin-bottom: 15px;margin-top: 30px;"); // 标题加粗加大,增加底部间距
// 工位列表
m_listWidget = new QListWidget(this);
......@@ -82,30 +83,30 @@ void MultiFunctionDialog::initWorkStationUI() {
QListWidgetItem *item = m_listWidget->item(i);
item->setTextAlignment(Qt::AlignCenter); // 等同于 Qt::AlignHCenter | Qt::AlignVCenter
}
// // 开启循环滚动
// m_enableCycleScroll = true;
// // 给列表安装事件过滤器
// m_listWidget->installEventFilter(this);
// // 开启循环滚动
// m_enableCycleScroll = true;
// // 给列表安装事件过滤器
// m_listWidget->installEventFilter(this);
// 列表样式
m_listWidget->setStyleSheet(R"(
QListWidget { border: none;
QListWidget { border: none;
outline: none;
font-size: 25px;
border-radius: 25px;
border-radius: 25px;
} /* 去掉列表边框 */
QListWidget::item {
padding: 25px; /* 选项内边距加大,更宽松 */
text-align: center;
QListWidget::item {
padding: 25px; /* 选项内边距加大,更宽松 */
text-align: center;
outline: none;
}
QListWidget::item:selected {
background-color: #f0f0f0;
color: #000000;
border-radius: 8px; /* 选中项也加圆角(可选) */
outline: none;
}
)");
outline: none;
}
QListWidget::item:selected {
background-color: #f0f0f0;
color: #000000;
border-radius: 8px; /* 选中项也加圆角(可选) */
outline: none;
}
)");
// 按钮
QPushButton *confirmBtn = new QPushButton("确认修改", this);
......@@ -120,32 +121,32 @@ void MultiFunctionDialog::initWorkStationUI() {
border-radius: 16px; /* 按钮圆角(越大越圆,推荐16px) */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 70px; /* 固定高度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #00acc1; /* hover时加深颜色(可选) */
}
)");
QPushButton:hover {
background-color: #00acc1; /* hover时加深颜色(可选) */
}
)");
cancelBtn->setStyleSheet(R"(
QPushButton {
background-color: #e0e0e0;
color: #333;
padding: 10px;
border: none;
border-radius: 16px; /* 取消按钮同样加大圆角 */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 70px; /* 固定高度 */
}
QPushButton:hover {
background-color: #d0d0d0; /* hover时加深颜色(可选) */
}
)");
QPushButton {
background-color: #e0e0e0;
color: #333;
padding: 10px;
border: none;
border-radius: 16px; /* 取消按钮同样加大圆角 */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #d0d0d0; /* hover时加深颜色(可选) */
}
)");
// 布局
QVBoxLayout *mainLayout = new QVBoxLayout(this);
// 布局内边距(避免内容贴弹窗边缘)
mainLayout->setContentsMargins(20, 30, 20, 20);
mainLayout->setContentsMargins(30, 20, 30, 20);
// 布局间距(控件之间的距离)
mainLayout->setSpacing(25);
......@@ -162,225 +163,391 @@ void MultiFunctionDialog::initWorkStationUI() {
connect(confirmBtn, &QPushButton::clicked, this, &QDialog::accept);
connect(cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
}
//// 事件过滤器实现:处理上下键循环滚动
//bool MultiFunctionDialog::eventFilter(QObject *watched, QEvent *event) {
// // 仅处理QListWidget的按键事件,且开启了循环滚动
// if (watched == m_listWidget && m_enableCycleScroll && event->type() == QEvent::KeyPress) {
// QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
// int currentRow = m_listWidget->currentRow();
// int itemCount = m_listWidget->count();
// // 按下下键:最后一项 -> 第一项
// if (keyEvent->key() == Qt::Key_Down) {
// if (currentRow == itemCount - 1) {
// m_listWidget->setCurrentRow(0);
// return true; // 拦截默认事件,避免继续向下滚动
// }
// }
// // 按上键:第一项 -> 最后一项
// else if (keyEvent->key() == Qt::Key_Up) {
// if (currentRow == 0) {
// m_listWidget->setCurrentRow(itemCount - 1);
// return true; // 拦截默认事件
// }
// }
// }
// // 其他事件交给父类处理
// return QDialog::eventFilter(watched, event);
//}
// -------------------------- 2. 初始化设备选择UI(按钮样式同步修改) --------------------------
// -------------------------- 2. 初始化设备选择UI --------------------------
void MultiFunctionDialog::initDeviceUI() {
QLabel *titleLabel = new QLabel("请选择设备名称", this);
titleLabel->setAlignment(Qt::AlignLeft);
titleLabel->setStyleSheet("font-size: 16px; font-weight: bold; margin-bottom: 15px;margin-left: 10px;");
m_listWidget = new QListWidget(this);
QStringList devices = {"设备A", "设备B", "设备C", "设备D", "设备E"};
m_listWidget->addItems(devices);
m_listWidget->setSelectionMode(QListWidget::SingleSelection);
m_listWidget->setCurrentRow(0);
m_listWidget->setStyleSheet(R"(
QListWidget { border: none; }
QListWidget::item { padding: 12px; text-align: center; font-size: 14px; }
QListWidget::item:selected { background-color: #f0f0f0; color: #00bcd4; border-radius: 8px; }
)");
QLabel *deviceLabel = new QLabel("设备名称", this);
deviceLabel->setStyleSheet("font-size: 25px; "); // 标题加粗加大,增加底部间距
QLineEdit *deviceEdit = new QLineEdit(this);
deviceEdit->setPlaceholderText("请输入设备名称"); // 输入框占位提示
deviceEdit->setStyleSheet(R"(
QLineEdit {
border: 1px solid #e0e0e0;
border-radius: 30px; /* 关键:调整这个数值控制圆角大小(默认25px,改为30px更圆) */
padding: 15px 25px; /* 优化:内边距同步加大,避免文字贴圆角 */
font-size: 25px;
background-color: #ffffff;
min-height: 50px; /* 优化:最小高度,让输入框更饱满,匹配大圆角 */
}
)");
QPushButton *confirmBtn = new QPushButton("确认", this);
QPushButton *cancelBtn = new QPushButton("取消", this);
// 按钮圆角同步加大
// 2. 创建“确认修改”“取消修改”按钮
QPushButton *confirmBtn = new QPushButton("确认修改", this);
QPushButton *cancelBtn = new QPushButton("取消修改", this);
confirmBtn->setStyleSheet(R"(
QPushButton { background-color: #00bcd4; color: white; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #00acc1; }
)");
QPushButton {
background-color:#1EC9D4;
color: white;
padding: 10px; /* 按钮内边距加大,更饱满 */
border: none;
border-radius: 16px; /* 按钮圆角(越大越圆,推荐16px) */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #00acc1; /* hover时加深颜色(可选) */
}
)");
cancelBtn->setStyleSheet(R"(
QPushButton { background-color: #e0e0e0; color: #333; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #d0d0d0; }
)");
QPushButton {
background-color: #e0e0e0;
color: #333;
padding: 10px;
border: none;
border-radius: 16px; /* 取消按钮同样加大圆角 */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #d0d0d0; /* hover时加深颜色(可选) */
}
)");
// 3. 构建布局(水平布局放标签+输入框,垂直布局嵌套所有组件)
QHBoxLayout *inputLayout = new QHBoxLayout;
inputLayout->setSpacing(10);
inputLayout->addWidget(deviceLabel);
inputLayout->addWidget(deviceEdit); // 标签+输入框横向排列
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(20, 20, 20, 20);
mainLayout->setSpacing(15);
QHBoxLayout *btnLayout = new QHBoxLayout;
btnLayout->setSpacing(12);
btnLayout->addWidget(confirmBtn);
btnLayout->addWidget(cancelBtn);
mainLayout->addWidget(titleLabel);
mainLayout->addWidget(m_listWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(30, 20, 30, 20);
mainLayout->setSpacing(20);
mainLayout->addLayout(inputLayout);
mainLayout->addLayout(btnLayout);
connect(confirmBtn, &QPushButton::clicked, this, &QDialog::accept);
// 4. 绑定按钮事件(确认时可获取输入框内容)
connect(confirmBtn, &QPushButton::clicked, this, [=]() {
m_deviceName = deviceEdit->text(); // 保存输入的设备名称(需在类中声明m_deviceName成员)
accept();
});
connect(cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
}
// -------------------------- 3. 初始化抽检项选择UI(按钮样式同步修改) --------------------------
// -------------------------- 3. 抽检项选择UI --------------------------
void MultiFunctionDialog::initInspectionUI() {
QLabel *titleLabel = new QLabel("请选择抽检项类型", this);
titleLabel->setAlignment(Qt::AlignCenter);
titleLabel->setStyleSheet("font-size: 16px; font-weight: bold; margin-bottom: 15px;");
// 1. 标题:左对齐,调整文本
QLabel *titleLabel = new QLabel("请选择是否存在抽检项", this);
titleLabel->setAlignment(Qt::AlignLeft);
titleLabel->setStyleSheet("font-size: 25px; font-weight: bold; margin-bottom: 20px;margin-top: 30px;");
// 单选按钮组
// 2. 核心:文字左、单选框右(用 QLabel + QRadioButton + 水平布局实现)
m_radioGroup = new QButtonGroup(this);
QRadioButton *rbMust = new QRadioButton("必检", this);
QRadioButton *rbSample = new QRadioButton("抽检", this);
QRadioButton *rbBoth = new QRadioButton("必检&抽检", this);
// 必检选项:标签(文字)+ 单选框(右侧)
QWidget *mustWidget = new QWidget(this);
QHBoxLayout *mustLayout = new QHBoxLayout(mustWidget);
mustLayout->setContentsMargins(0, 0, 0, 0); // 取消布局边距
QLabel *mustLabel = new QLabel("必检", this);
mustLabel->setStyleSheet("font-size: 25px;");
QRadioButton *rbMust = new QRadioButton(this); // 单独的单选框(无文字)
m_radioGroup->addButton(rbMust);
mustLayout->addWidget(mustLabel); // 先加文字标签
mustLayout->addStretch(1); // 拉伸占位,把单选框推到右侧
mustLayout->addWidget(rbMust); // 后加单选框
// 抽检选项:同上
QWidget *sampleWidget = new QWidget(this);
QHBoxLayout *sampleLayout = new QHBoxLayout(sampleWidget);
sampleLayout->setContentsMargins(0, 0, 0, 0);
QLabel *sampleLabel = new QLabel("抽检", this);
sampleLabel->setStyleSheet("font-size: 25px;");
QRadioButton *rbSample = new QRadioButton(this);
m_radioGroup->addButton(rbSample);
sampleLayout->addWidget(sampleLabel);
sampleLayout->addStretch(1);
sampleLayout->addWidget(rbSample);
// 必检&抽检选项:同上(默认选中)
QWidget *bothWidget = new QWidget(this);
QHBoxLayout *bothLayout = new QHBoxLayout(bothWidget);
bothLayout->setContentsMargins(0, 0, 0, 0);
QLabel *bothLabel = new QLabel("必检&抽检", this);
bothLabel->setStyleSheet("font-size: 25px;");
QRadioButton *rbBoth = new QRadioButton(this);
m_radioGroup->addButton(rbBoth);
rbBoth->setChecked(true); // 默认选中
// 单选按钮样式优化
rbMust->setStyleSheet("margin: 12px; font-size: 16px;");
rbSample->setStyleSheet("margin: 12px; font-size: 16px;");
rbBoth->setStyleSheet("margin: 12px; font-size: 16px;");
bothLayout->addWidget(bothLabel);
bothLayout->addStretch(1);
bothLayout->addWidget(rbBoth);
// 3. 按钮:调整样式和布局
QPushButton *confirmBtn = new QPushButton("确认", this);
QPushButton *cancelBtn = new QPushButton("取消", this);
// 按钮圆角同步加大
confirmBtn->setStyleSheet(R"(
QPushButton { background-color: #00bcd4; color: white; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #00acc1; }
)");
cancelBtn->setStyleSheet(R"(
QPushButton { background-color: #e0e0e0; color: #333; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #d0d0d0; }
)");
QPushButton {
background-color:#1EC9D4;
color: white;
padding: 10px; /* 按钮内边距加大,更饱满 */
border: none;
border-radius: 16px; /* 按钮圆角(越大越圆,推荐16px) */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #00acc1; /* hover时加深颜色(可选) */
}
)");
cancelBtn->setStyleSheet(R"(
QPushButton {
background-color: #e0e0e0;
color: #333;
padding: 10px;
border: none;
border-radius: 16px; /* 取消按钮同样加大圆角 */
font-size: 25px;
width: 800px; /* 固定宽度 */
height: 50px; /* 固定高度 */
}
QPushButton:hover {
background-color: #d0d0d0; /* hover时加深颜色(可选) */
}
)");
// 4. 顶层布局
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(20, 20, 20, 20);
mainLayout->setSpacing(15);
mainLayout->setContentsMargins(50, 20, 30, 20);
mainLayout->setSpacing(20);
QHBoxLayout *btnLayout = new QHBoxLayout;
btnLayout->setSpacing(12);
btnLayout->addWidget(confirmBtn);
btnLayout->addWidget(cancelBtn);
btnLayout->addWidget(confirmBtn, 1);
btnLayout->addWidget(cancelBtn, 1);
// 加入“文字+单选框”的组合组件
mainLayout->addWidget(titleLabel);
mainLayout->addWidget(rbMust);
mainLayout->addWidget(rbSample);
mainLayout->addWidget(rbBoth);
mainLayout->addWidget(mustWidget);
mainLayout->addWidget(sampleWidget);
mainLayout->addWidget(bothWidget);
mainLayout->addLayout(btnLayout);
connect(confirmBtn, &QPushButton::clicked, this, &QDialog::accept);
connect(cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
}
// -------------------------- 4. 初始化时间范围选择UI(按钮样式同步修改) --------------------------
// -------------------------- 4. 初始化时间范围选择UI(完整改写) --------------------------
void MultiFunctionDialog::initTimeRangeUI() {
// 1. 标题(保持不变)
QLabel *titleLabel = new QLabel("请选择时间范围", this);
titleLabel->setAlignment(Qt::AlignCenter);
titleLabel->setStyleSheet("font-size: 16px; font-weight: bold; margin-bottom: 15px;");
// 日历控件(辅助选择)
QCalendarWidget *calendar = new QCalendarWidget(this);
calendar->setSelectedDate(QDate::currentDate());
calendar->setGridVisible(true);
calendar->setMaximumHeight(180);
calendar->setStyleSheet("border: none;"); // 去掉日历边框
titleLabel->setAlignment(Qt::AlignLeft);
titleLabel->setStyleSheet("font-size: 25px; font-weight: bold; margin-bottom: 30px; margin-top: 30px;");
// 2. 替换为自定义RangeCalendar(支持区间背景)
RangeCalendar *calendar = new RangeCalendar(this);
// 日历样式(保持你的原样式)
calendar->setStyleSheet(R"(
QCalendarWidget {
background-color: white;
font-size: 25px;
border: none;
}
QCalendarWidget QWidget#qt_calendar_navigationbar {
background-color: #1EC9D4;
color: white;
font-weight: bold;
font-size: 25px;
}
QCalendarWidget QHeaderView::section {
background-color: #1EC9D4;
border: none;
padding: 10px;
font-size: 26px;
font-weight: bold;
color: white;
}
QCalendarWidget QTableView {
selection-background-color: #1EC9D4;
selection-color: white;
outline: none;
}
QCalendarWidget QAbstractItemView::item:hover:!selected {
background-color: #f0f0f0;
}
QCalendarWidget QAbstractItemView::item:disabled {
color: #ccc;
}
)");
calendar->setGridVisible(false);
calendar->setMinimumHeight(500);
// 日期编辑框
// 3. 日期编辑框(保持不变)
QLabel *startLabel = new QLabel("开始日期:", this);
QLabel *endLabel = new QLabel("结束日期:", this);
startLabel->setStyleSheet("font-size: 20px; margin-right: 15px;");
endLabel->setStyleSheet("font-size: 20px; margin-right: 15px; margin-left: 50px;");
m_startDateEdit = new QDateEdit(QDate::currentDate(), this);
m_endDateEdit = new QDateEdit(QDate::currentDate().addDays(2), this);
m_startDateEdit->setCalendarPopup(true);
m_endDateEdit->setCalendarPopup(true);
m_startDateEdit->setFixedWidth(120);
m_endDateEdit->setFixedWidth(120);
// 日期编辑框样式优化
m_startDateEdit->setStyleSheet(R"(
QString dateEditStyle = R"(
QDateEdit {
padding: 6px;
border: 1px solid #e0e0e0;
border-radius: 8px;
font-size: 14px;
border-radius: 16px;
padding: 12px 20px;
font-size: 20px;
background-color: white;
min-width: 250px;
min-height: 40px;
}
)");
m_endDateEdit->setStyleSheet(R"(
QDateEdit {
padding: 6px;
border: 1px solid #e0e0e0;
border-radius: 8px;
font-size: 14px;
QDateEdit::drop-down {
border: none;
background-color: transparent;
}
)");
// 日期布局
QHBoxLayout *dateLayout = new QHBoxLayout;
dateLayout->addWidget(startLabel);
dateLayout->addWidget(m_startDateEdit);
dateLayout->addSpacing(20);
dateLayout->addWidget(endLabel);
dateLayout->addWidget(m_endDateEdit);
)";
m_startDateEdit->setStyleSheet(dateEditStyle);
m_endDateEdit->setStyleSheet(dateEditStyle);
m_startDateEdit->setCalendarPopup(true);
m_endDateEdit->setCalendarPopup(true);
m_startDateEdit->setDisplayFormat("yyyy-MM-dd");
m_endDateEdit->setDisplayFormat("yyyy-MM-dd");
// 4. 联动逻辑:选择日期时更新区间,触发背景渲染
connect(calendar, &QCalendarWidget::clicked, this, [=](const QDate &date) {
static QDate firstSelectDate;
if (!firstSelectDate.isValid()) {
firstSelectDate = date;
m_startDateEdit->setDate(date);
calendar->setDateRange(QDate(), QDate()); // 重置区间
} else {
QDate start = qMin(firstSelectDate, date);
QDate end = qMax(firstSelectDate, date);
m_startDateEdit->setDate(start);
m_endDateEdit->setDate(end);
calendar->setDateRange(start, end); // 设置区间,触发背景绘制
firstSelectDate = QDate(); // 重置,支持重新选择
}
});
// 编辑框修改时同步更新区间
connect(m_startDateEdit, &QDateEdit::dateChanged, this, [=](const QDate &date) {
calendar->setDateRange(date, m_endDateEdit->date());
});
connect(m_endDateEdit, &QDateEdit::dateChanged, this, [=](const QDate &date) {
calendar->setDateRange(m_startDateEdit->date(), date);
});
// 5. 按钮(保持不变)
QPushButton *confirmBtn = new QPushButton("确认", this);
QPushButton *cancelBtn = new QPushButton("取消", this);
// 按钮圆角同步加大
confirmBtn->setStyleSheet(R"(
QPushButton { background-color: #00bcd4; color: white; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #00acc1; }
QPushButton {
background-color: #1EC9D4;
color: white;
padding: 10px;
border: none;
border-radius: 16px;
font-size: 25px;
width: 800px;
height: 50px;
}
QPushButton:hover {
background-color: #00acc1;
}
)");
cancelBtn->setStyleSheet(R"(
QPushButton { background-color: #e0e0e0; color: #333; padding: 10px; border: none; border-radius: 16px; font-size: 14px; }
QPushButton:hover { background-color: #d0d0d0; }
QPushButton {
background-color: #e0e0e0;
color: #333;
padding: 10px;
border: none;
border-radius: 16px;
font-size: 25px;
width: 800px;
height: 50px;
}
QPushButton:hover {
background-color: #d0d0d0;
}
)");
// 6. 布局(保持不变)
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(20, 20, 20, 20);
mainLayout->setSpacing(15);
mainLayout->setContentsMargins(40, 40, 40, 40);
mainLayout->setSpacing(30);
QHBoxLayout *dateEditLayout = new QHBoxLayout;
dateEditLayout->setSpacing(20);
dateEditLayout->addWidget(startLabel);
dateEditLayout->addWidget(m_startDateEdit);
dateEditLayout->addWidget(endLabel);
dateEditLayout->addWidget(m_endDateEdit);
dateEditLayout->addStretch(1);
QHBoxLayout *btnLayout = new QHBoxLayout;
btnLayout->setSpacing(12);
btnLayout->addWidget(confirmBtn);
btnLayout->addWidget(cancelBtn);
mainLayout->addWidget(titleLabel);
mainLayout->addWidget(calendar);
mainLayout->addLayout(dateLayout);
mainLayout->addLayout(dateEditLayout);
mainLayout->addLayout(btnLayout);
connect(confirmBtn, &QPushButton::clicked, this, &QDialog::accept);
connect(cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
connect(confirmBtn, &QPushButton::clicked, this, [=]() {
// 关键:先校验指针是否为空
if (!m_startDateEdit || !m_endDateEdit) {
qDebug() << "日期编辑框未初始化!";
reject(); // 避免崩溃,直接关闭弹窗
return;
}
// 再校验日期合法性
QDate start = m_startDateEdit->date();
QDate end = m_endDateEdit->date();
if (end < start) {
end = start.addDays(2);
m_endDateEdit->setDate(end); // 更新编辑框显示
}
accept(); // 正常关闭弹窗
});
}
// -------------------------- 获取选择结果 --------------------------
QString MultiFunctionDialog::getStringResult() const {
switch (m_dialogType) {
case WorkStationType:
// 返回选中的工位
if (m_listWidget &&m_listWidget->currentItem()) {
return m_listWidget->currentItem()->text();
}
break;
case DeviceType:
// 返回选中的设备
if (m_listWidget->currentItem()) {
return m_listWidget->currentItem()->text();
}
break;
case InspectionType:
// 返回选中的抽检项
if (m_radioGroup->checkedButton()) {
return m_radioGroup->checkedButton()->text();
case WorkStationType:
if (m_listWidget && m_listWidget->currentItem()) {
return m_listWidget->currentItem()->text();
}
break;
case DeviceType:
return m_deviceName; // 修正:返回输入的设备名称(原代码用了m_listWidget,错误)
break;
case InspectionType:
// 修正:抽检项用QLabel显示文字,需通过按钮关联标签文本(原代码返回按钮文本为空)
if (m_radioGroup->checkedButton()) {
QRadioButton *checkedBtn = qobject_cast<QRadioButton*>(m_radioGroup->checkedButton());
if (checkedBtn) {
// 找到对应的标签(通过父Widget查找)
QWidget *parentWidget = checkedBtn->parentWidget();
if (parentWidget) {
QLabel *textLabel = parentWidget->findChild<QLabel*>();
if (textLabel) {
return textLabel->text(); // 返回“必检”“抽检”等文本
}
}
}
break;
default:
break;
}
break;
default:
break;
}
return "";
}
......
#ifndef MULTIFUNCTIONDIALOG_H
#define MULTIFUNCTIONDIALOG_H
#include <QCalendarWidget>
#include<QDebug>
#include <QPainter>
#include <QDate>
#include <QDialog>
#include <QLineEdit>
#include<QMessageBox>
#include <QLabel> // 解决 QLabel 未声明的问题
#include <QPushButton> // 解决 QPushButton 不完整类型的问题
#include <QListWidget> // 用到了 QListWidget
......@@ -19,10 +24,39 @@ enum DialogType {
InspectionType, // 抽检项选择
TimeRangeType // 时间范围选择
};
// 仅在头文件中定义一次RangeCalendar
class RangeCalendar : public QCalendarWidget
{
Q_OBJECT
public:
explicit RangeCalendar(QWidget *parent = nullptr)
: QCalendarWidget(parent), m_startDate(QDate()), m_endDate(QDate()) {}
void setDateRange(const QDate &start, const QDate &end) {
m_startDate = start;
m_endDate = end;
updateCells();
}
protected:
void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const override {
// 1. 先绘制区间背景(在默认样式之前)
if (m_startDate.isValid() && m_endDate.isValid()) {
if (date > m_startDate && date < m_endDate) {
painter->save();
painter->fillRect(rect.adjusted(1, 1, -1, -1), QColor(220, 240, 250));
painter->restore();
}
}
// 2. 再绘制默认样式(包含文字)
QCalendarWidget::paintCell(painter, rect, date);
}
private:
QDate m_startDate;
QDate m_endDate;
};
namespace Ui {
class MultiFunctionDialog;
}
class MultiFunctionDialog : public QDialog
{
......@@ -36,7 +70,7 @@ public:
QPair<QDate, QDate> getTimeRangeResult() const; // 用于:时间范围(返回日期对)
private slots:
// 事件过滤器:处理QListWidget的按键事件(实现循环滚动)
// bool eventFilter(QObject *watched, QEvent *event);
// bool eventFilter(QObject *watched, QEvent *event);
private:
// 根据类型创建对应的UI
void initWorkStationUI(); // 初始化工位选择UI
......@@ -48,10 +82,15 @@ private:
DialogType m_dialogType; // 当前弹窗类型
QListWidget *m_listWidget; // 列表控件(工位/设备用)
QButtonGroup *m_radioGroup; // 单选按钮组(抽检项用)
QDateEdit *m_startDateEdit; // 开始日期编辑框(时间用)
QDateEdit *m_endDateEdit; // 结束日期编辑框(时间用)
QDateEdit *m_startDateEdit=nullptr; // 开始日期编辑框(时间用)
QDateEdit *m_endDateEdit=nullptr; // 结束日期编辑框(时间用)
QLineEdit *m_deviceEdit; // 设备输入框成员(原代码可能遗漏)
QDate m_firstSelectDate;
QString m_deviceName; // 设备名称存储变量
// bool m_enableCycleScroll = false;
Ui::MultiFunctionDialog *ui;
// Ui::MultiFunctionDialog *ui;
};
......
USB.png

800 Bytes

USBconncet.png

612 Bytes

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2025-12-03T15:06:26. -->
<!-- Written by QtCreator 4.11.1, 2025-12-04T14:46:12. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -7,9 +7,9 @@ carMachineDetectionWidget::carMachineDetectionWidget(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::carMachineDetectionWidget)
{
//setWindowFlags(windowFlags() & ~Qt::WindowFullscreenButtonHint);
//setMaximumSize(2000, 1200);
ui->setupUi(this);
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
//初始状态
// ui->widget_search->hide();
// ui->SoftControlwidget->hide();
......@@ -23,8 +23,6 @@ carMachineDetectionWidget::~carMachineDetectionWidget()
delete ui;
}
void carMachineDetectionWidget::on_pushButton_btnSoftwareControl_clicked()
{
ui->containerMain->hide();
......@@ -75,15 +73,37 @@ void carMachineDetectionWidget::on_pushButton_inspectionItemt_clicked()
void carMachineDetectionWidget::on_pushButton_chooseTime_clicked()
{
MultiFunctionDialog dialog(TimeRangeType, this);
if (dialog.exec() == QDialog::Accepted) {
QPair<QDate, QDate> timeRange = dialog.getTimeRangeResult();
QDate startDate = timeRange.first;
QDate endDate = timeRange.second;
if (startDate.isValid() && endDate.isValid()) {
QMessageBox::information(this, "选择结果",
QString("时间范围:%1 至 %2").arg(startDate.toString("yyyy-MM-dd")).arg(endDate.toString("yyyy-MM-dd")));
// 业务逻辑:更新时间范围设置
}
MultiFunctionDialog *dialog = new MultiFunctionDialog(TimeRangeType, this);
if (dialog->exec() == QDialog::Accepted) {
QPair<QDate, QDate> timeRange = dialog->getTimeRangeResult();
QDate startDate = timeRange.first;
QDate endDate = timeRange.second;
if (startDate.isValid() && endDate.isValid()) {
QMessageBox::information(this, "选择结果",
QString("时间范围:%1 至 %2")
.arg(startDate.toString("yyyy-MM-dd"))
.arg(endDate.toString("yyyy-MM-dd")));
}
}
delete dialog; // 手动销毁,避免内存泄漏
}
void carMachineDetectionWidget::onMinimizeButtonClicked()
{
}
void carMachineDetectionWidget::onCloseButtonClicked()
{
}
void carMachineDetectionWidget::on_pushButton_min_clicked()
{
this->showMinimized();
}
void carMachineDetectionWidget::on_pushButton_off_clicked()
{
this->close();
}
......@@ -2,7 +2,11 @@
#define CARMACHINEDETECTIONWIDGET_H
#include <QMainWindow>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QApplication>
#include <QLabel>
#include <QPushButton>
QT_BEGIN_NAMESPACE
namespace Ui { class carMachineDetectionWidget; }
QT_END_NAMESPACE
......@@ -30,7 +34,22 @@ private slots:
void on_pushButton_chooseTime_clicked();
void onMinimizeButtonClicked();
void onCloseButtonClicked();
void on_pushButton_min_clicked();
void on_pushButton_off_clicked();
private:
QLabel *m_titleLabel;
QLabel *m_stationLabel;
QLabel *m_usbStatusLabel;
QLabel *m_signalIconLabel;
QLabel *m_networkStatusLabel;
QPushButton *m_minimizeButton;
QPushButton *m_closeButton;
Ui::carMachineDetectionWidget *ui;
};
#endif // CARMACHINEDETECTIONWIDGET_H
......@@ -7,9 +7,15 @@
<x>0</x>
<y>0</y>
<width>2000</width>
<height>1250</height>
<height>1200</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
......@@ -459,18 +465,24 @@
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#carMachineDetectionWidget, #centralwidget {
background-color: #d9e2f1;
}</string>
</property>
<widget class="QFrame" name="statusFrame">
<widget class="QWidget" name="containerMain" native="true">
<property name="geometry">
<rect>
<x>39</x>
<y>70</y>
<width>1911</width>
<height>191</height>
<x>30</x>
<y>320</y>
<width>1981</width>
<height>821</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -479,464 +491,81 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="styleSheet">
<string notr="true">QFrame#statusFrame {
background-color: #E4EBF6;
border-radius: 25px; /* 圆角半径,数值越大越圆 */
border: none; /* 去掉QFrame默认边框(可选) */
padding: 8px; /* 内边距,避免子控件贴圆角边缘 */
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<string notr="true">QWidget#containerMain {
background-color: #D9E2F1 !important; /* 核心:容器背景色 */
padding: 15px; /* 可选:内边距,避免控件贴边 */
}</string>
</property>
<widget class="QLabel" name="label_connectionStatus">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>161</width>
<height>61</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="text">
<string>未连接</string>
</property>
</widget>
<widget class="QLabel" name="label_carSeries">
<property name="geometry">
<rect>
<x>80</x>
<y>130</y>
<width>151</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>车系 --</string>
</property>
</widget>
<widget class="QLabel" name="label_carModel">
<property name="geometry">
<rect>
<x>300</x>
<y>130</y>
<width>211</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>车型 --</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_start">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>1571</x>
<y>77</y>
<width>291</width>
<height>81</height>
<x>40</x>
<y>60</y>
<width>1900</width>
<height>800</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"> QPushButton {
background-color: #1EC9D4; /* 主色调(蓝色) */
color: #FFFFFF;
border: none; /* 去掉原生边框 */
border-radius: 25px; /* 圆角半径(车机建议10~20px) */
<string notr="true">
/* 1. QTabWidget整体容器 */
QTabWidget {
background-color: #D9E2F1; /* 极浅灰背景,衬托白底标签 */
border-radius: 12px; /* 整体圆角(车机适配) */
padding: 2px;
}
}</string>
</property>
<property name="text">
<string>开始</string>
</property>
</widget>
<widget class="QLabel" name="label_startTime">
<property name="geometry">
<rect>
<x>830</x>
<y>130</y>
<width>411</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #6F7A84; /* 浅蓝色文字(和图中一致) */
}</string>
</property>
<property name="text">
<string>开始执行时间:--:--:--</string>
</property>
</widget>
<widget class="QLabel" name="label_time">
<property name="geometry">
<rect>
<x>1240</x>
<y>130</y>
<width>411</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel#label_time{
color: #6F7A84; /* 浅蓝色文字(和图中一致) */
}</string>
</property>
<property name="text">
<string> 执行用时:--:--:--</string>
</property>
</widget>
<widget class="QLabel" name="label_StartupState">
<property name="geometry">
<rect>
<x>800</x>
<y>30</y>
<width>431</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>未启动</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>470</x>
<y>10</y>
<width>41</width>
<height>271</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"> QLabel {
border-right: 2px solid #E0E0E0; /* 纯直线竖线,无圆角 */
padding-right: 10px;
margin-right: 10px;
}</string>
</property>
<property name="text">
<string/>
/* 2. 标签栏整体 */
QTabBar {
background-color: #D9E2F1; /* 透明,继承整体背景 */
}
/* 3. 单个标签(未选中状态) */
QTabBar::tab {
background-color: #CCD8E6;
color: #424242; /* 极深灰文字,保证可读性 */
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding: 16px 24px; /* 上16px 下16px 左24px 右24px(车机触控更友好) */
margin-right: 6px; /* 标签间距适当增大(配合大标签) */
font-size: 25px; /* 目标字体大小 */
min-height: 45px; /* 关键修改2:最小高度=字体大小+上下内边距(40+16+16=72,预留少量冗余) */
min-width: 170px;
}
/* 4. 选中标签(核心:白底黑字) */
QTabBar::tab:selected {
background-color: #FFFFFF; /* 纯白色背景 */
color: #000000; /* 纯黑色文字 */
font-weight: 500; /* 可选:文字稍加粗,突出选中态 */
}
/* 5. 标签悬浮(未选中时) */
QTabBar::tab:hover:!selected {
background-color: #F0F0F0; /* 浅于未选中的灰色,提升交互感 */
}
QTabWidget::pane {
background-color: #D9E2F1;
border: none;
margin-top: -1px;
}</string>
</property>
</widget>
<widget class="QLabel" name="label_inspectionType">
<property name="geometry">
<rect>
<x>210</x>
<y>50</y>
<width>71</width>
<height>31</height>
</rect>
<property name="currentIndex">
<number>1</number>
</property>
<property name="font">
<font>
<family>等线</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #23C6D9; /* 浅蓝色文字(和图中一致) */
background-color: #CAEBF1; /* 浅蓝背景(和图中一致) */
border-radius: 10px; /* 可选:轻微圆角更美观,不需要可删除 */
padding: 2px 4px; /* 内边距避免文字贴边 */
}</string>
</property>
<property name="text">
<string>必检</string>
</property>
</widget>
<widget class="QLabel" name="label_stpicture">
<property name="geometry">
<rect>
<x>800</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_stpicture {
border-image: url(:/startTime.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_car">
<property name="geometry">
<rect>
<x>635</x>
<y>50</y>
<width>141</width>
<height>111</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_car
{
border-image: url(:/hcar.png);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_tpicture">
<property name="geometry">
<rect>
<x>1215</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_tpicture {
border-image: url(:/time.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_carSeriesp">
<property name="geometry">
<rect>
<x>50</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_carSeriesp{
border-image: url(:/carSeries.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_carModelp">
<property name="geometry">
<rect>
<x>270</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_carModelp{
border-image: url(:/carModel.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>797</x>
<y>99</y>
<width>721</width>
<height>10</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true"> QProgressBar {
border: 2px solid #E4EBF6; /* 边框颜色 */
border-radius: 25px; /* 边框圆角 */
background-color: #ecf0f1; /* 进度条背景色(未填充部分) */
height: 20px; /* 进度条高度 */
}
QProgressBar::chunk {
background-color: #1EC9D4; /* 进度条填充颜色(核心) */
border-radius: 25px; /* 填充部分圆角(与外层呼应) */
background-image: linear-gradient(to right, #3498db, #2ecc71); /* 渐变颜色(可选) */
}</string>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="textDirection">
<enum>QProgressBar::TopToBottom</enum>
</property>
<property name="format">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_bar">
<property name="geometry">
<rect>
<x>1445</x>
<y>30</y>
<width>131</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>0%</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="containerMain" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>290</y>
<width>2000</width>
<height>921</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#containerMain {
background-color: #D9E2F1 !important; /* 核心:容器背景色 */
padding: 15px; /* 可选:内边距,避免控件贴边 */
}</string>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>1900</width>
<height>800</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">
/* 1. QTabWidget整体容器 */
QTabWidget {
background-color: #D9E2F1; /* 极浅灰背景,衬托白底标签 */
border-radius: 12px; /* 整体圆角(车机适配) */
padding: 2px;
}
/* 2. 标签栏整体 */
QTabBar {
background-color: #D9E2F1; /* 透明,继承整体背景 */
}
/* 3. 单个标签(未选中状态) */
QTabBar::tab {
background-color: #CCD8E6;
color: #424242; /* 极深灰文字,保证可读性 */
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding: 16px 24px; /* 上16px 下16px 左24px 右24px(车机触控更友好) */
margin-right: 6px; /* 标签间距适当增大(配合大标签) */
font-size: 25px; /* 目标字体大小 */
min-height: 45px; /* 关键修改2:最小高度=字体大小+上下内边距(40+16+16=72,预留少量冗余) */
min-width: 170px;
}
/* 4. 选中标签(核心:白底黑字) */
QTabBar::tab:selected {
background-color: #FFFFFF; /* 纯白色背景 */
color: #000000; /* 纯黑色文字 */
font-weight: 500; /* 可选:文字稍加粗,突出选中态 */
}
/* 5. 标签悬浮(未选中时) */
QTabBar::tab:hover:!selected {
background-color: #F0F0F0; /* 浅于未选中的灰色,提升交互感 */
}
QTabWidget::pane {
background-color: #D9E2F1;
border: none;
margin-top: -1px;
}</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<widget class="QWidget" name="tab_cur">
<property name="styleSheet">
......@@ -947,10 +576,10 @@
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1">
<property name="spacing">
<number>86</number>
<number>105</number>
</property>
<property name="leftMargin">
<number>19</number>
<number>0</number>
</property>
<property name="topMargin">
<number>30</number>
......@@ -1377,9 +1006,9 @@ QListWidget#listWidget_history::item {
<widget class="QWidget" name="widget_search" native="true">
<property name="geometry">
<rect>
<x>10</x>
<x>-10</x>
<y>30</y>
<width>1881</width>
<width>1901</width>
<height>95</height>
</rect>
</property>
......@@ -1440,7 +1069,7 @@ QWidget#widget_SearchCriteria {
<rect>
<x>170</x>
<y>10</y>
<width>141</width>
<width>271</width>
<height>51</height>
</rect>
</property>
......@@ -1457,6 +1086,9 @@ QWidget#widget_SearchCriteria {
<string>请选择时间范围</string>
</property>
</widget>
<zorder>label_histime</zorder>
<zorder>label_choosetime</zorder>
<zorder>pushButton_chooseTime</zorder>
</widget>
</item>
<item>
......@@ -1669,29 +1301,22 @@ QLineEdit#lineEdit_Model {
<string>软件控制</string>
</property>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>140</y>
<width>1880</width>
<height>700</height>
</rect>
</property>
</widget>
<zorder>listWidget</zorder>
<zorder>tabWidget</zorder>
<zorder>pushButton_btnSoftwareControl</zorder>
</widget>
<widget class="QWidget" name="SoftControlwidget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>290</y>
<width>1981</width>
<height>921</height>
<x>30</x>
<y>320</y>
<width>1961</width>
<height>821</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
......@@ -1706,10 +1331,10 @@ QLineEdit#lineEdit_Model {
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<x>20</x>
<y>100</y>
<width>1921</width>
<height>761</height>
<width>1941</width>
<height>731</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_control" stretch="1,1,1,1,1">
......@@ -1723,13 +1348,19 @@ QLineEdit#lineEdit_Model {
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
<number>20</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QWidget" name="widget_softwname" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">/* widget_SearchCriteria 样式:背景色+圆角 */
QWidget#widget_softwname {
......@@ -2166,23 +1797,649 @@ QPushButton#pushButton_return {
<string>软件控制</string>
</property>
</widget>
<zorder>label_return</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>pushButton_return</zorder>
</widget>
<zorder>SoftControlwidget</zorder>
<zorder>containerMain</zorder>
<zorder>statusFrame</zorder>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>2000</width>
<height>21</height>
</rect>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>2001</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame {
background-color: #E4EBF6;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label_title">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>441</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string> 车机自动化测试客户端 | 客户端名称</string>
</property>
</widget>
<widget class="QLabel" name="label_web">
<property name="geometry">
<rect>
<x>1650</x>
<y>20</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>等线</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #23C6D9; /* 浅蓝色文字(和图中一致) */
background-color: #CAEBF1; /* 浅蓝背景(和图中一致) */
border-radius: 20px; /* 可选:轻微圆角更美观,不需要可删除 */
padding: 2px 4px; /* 内边距避免文字贴边 */
}</string>
</property>
<property name="text">
<string>网络已连接</string>
</property>
</widget>
<widget class="QLabel" name="label_usb">
<property name="geometry">
<rect>
<x>1460</x>
<y>20</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>等线</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #23C6D9;
background-color: #CAEBF1;
border: 1px solid #CAEBF1;
border-radius: 30px;
padding: 2px 4px;
}</string>
</property>
<property name="text">
<string>USB已连接</string>
</property>
</widget>
<widget class="QLabel" name="label_usbpicture">
<property name="geometry">
<rect>
<x>1420</x>
<y>20</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_usbpicture{
border-image: url(:/USBconncet.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_signalpicture">
<property name="geometry">
<rect>
<x>1610</x>
<y>20</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_signalpicture{
border-image: url(:/signalconnect.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_work">
<property name="geometry">
<rect>
<x>1140</x>
<y>11</y>
<width>261</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel#label_work{
color: #6F7A84; /* 浅蓝色文字(和图中一致) */
}</string>
</property>
<property name="text">
<string>执行工位 · KOER</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_min">
<property name="geometry">
<rect>
<x>1820</x>
<y>20</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"> QPushButton#pushButton_min {
border-image: url(:/min.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="pushButton_off">
<property name="geometry">
<rect>
<x>1930</x>
<y>20</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"> QPushButton#pushButton_off {
border-image: url(:/off.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<widget class="QFrame" name="statusFrame">
<property name="geometry">
<rect>
<x>50</x>
<y>90</y>
<width>1891</width>
<height>221</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="styleSheet">
<string notr="true">QFrame#statusFrame {
background-color: #E4EBF6;
border-radius: 25px; /* 圆角半径,数值越大越圆 */
border: none; /* 去掉QFrame默认边框(可选) */
padding: 8px; /* 内边距,避免子控件贴圆角边缘 */
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label_connectionStatus">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>161</width>
<height>61</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="text">
<string>未连接</string>
</property>
</widget>
<widget class="QLabel" name="label_carSeries">
<property name="geometry">
<rect>
<x>80</x>
<y>130</y>
<width>151</width>
<height>41</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>车系 --</string>
</property>
</widget>
<widget class="QLabel" name="label_carModel">
<property name="geometry">
<rect>
<x>300</x>
<y>130</y>
<width>211</width>
<height>41</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>车型 --</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_start">
<property name="geometry">
<rect>
<x>1571</x>
<y>77</y>
<width>291</width>
<height>81</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"> QPushButton {
background-color: #1EC9D4; /* 主色调(蓝色) */
color: #FFFFFF;
border: none; /* 去掉原生边框 */
border-radius: 25px; /* 圆角半径(车机建议10~20px) */
}</string>
</property>
<property name="text">
<string>开始</string>
</property>
</widget>
<widget class="QLabel" name="label_startTime">
<property name="geometry">
<rect>
<x>830</x>
<y>130</y>
<width>411</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #6F7A84; /* 浅蓝色文字(和图中一致) */
}</string>
</property>
<property name="text">
<string>开始执行时间:--:--:--</string>
</property>
</widget>
<widget class="QLabel" name="label_time">
<property name="geometry">
<rect>
<x>1240</x>
<y>130</y>
<width>411</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel#label_time{
color: #6F7A84; /* 浅蓝色文字(和图中一致) */
}</string>
</property>
<property name="text">
<string> 执行用时:--:--:--</string>
</property>
</widget>
<widget class="QLabel" name="label_StartupState">
<property name="geometry">
<rect>
<x>800</x>
<y>30</y>
<width>431</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>未启动</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>470</x>
<y>10</y>
<width>41</width>
<height>271</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"> QLabel {
border-right: 2px solid #E0E0E0; /* 纯直线竖线,无圆角 */
padding-right: 10px;
margin-right: 10px;
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_inspectionType">
<property name="geometry">
<rect>
<x>180</x>
<y>40</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>等线</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
color: #23C6D9; /* 浅蓝色文字(和图中一致) */
background-color: #CAEBF1; /* 浅蓝背景(和图中一致) */
border-radius: 10px; /* 可选:轻微圆角更美观,不需要可删除 */
padding: 2px 4px; /* 内边距避免文字贴边 */
}</string>
</property>
<property name="text">
<string>必检</string>
</property>
</widget>
<widget class="QLabel" name="label_stpicture">
<property name="geometry">
<rect>
<x>800</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_stpicture {
border-image: url(:/startTime.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_car">
<property name="geometry">
<rect>
<x>635</x>
<y>50</y>
<width>141</width>
<height>111</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_car
{
border-image: url(:/hcar.png);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_tpicture">
<property name="geometry">
<rect>
<x>1215</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#label_tpicture {
border-image: url(:/time.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_carSeriesp">
<property name="geometry">
<rect>
<x>50</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_carSeriesp{
border-image: url(:/carSeries.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_carModelp">
<property name="geometry">
<rect>
<x>270</x>
<y>141</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">#label_carModelp{
border-image: url(:/carModel.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>797</x>
<y>99</y>
<width>721</width>
<height>10</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true"> QProgressBar {
border: 2px solid #E4EBF6; /* 边框颜色 */
border-radius: 25px; /* 边框圆角 */
background-color: #ecf0f1; /* 进度条背景色(未填充部分) */
height: 20px; /* 进度条高度 */
}
QProgressBar::chunk {
background-color: #1EC9D4; /* 进度条填充颜色(核心) */
border-radius: 25px; /* 填充部分圆角(与外层呼应) */
background-image: linear-gradient(to right, #3498db, #2ecc71); /* 渐变颜色(可选) */
}</string>
</property>
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="textDirection">
<enum>QProgressBar::TopToBottom</enum>
</property>
<property name="format">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_bar">
<property name="geometry">
<rect>
<x>1445</x>
<y>30</y>
<width>131</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>0%</string>
</property>
</widget>
</widget>
<zorder>statusFrame</zorder>
<zorder>SoftControlwidget</zorder>
<zorder>containerMain</zorder>
<zorder>frame</zorder>
</widget>
</widget>
<resources/>
......
min.png

259 Bytes

off.png

504 Bytes

......@@ -10,5 +10,11 @@
<file>carSeries.png</file>
<file>Default.png</file>
<file>choosetime.png</file>
<file>signal.png</file>
<file>signalconnect.png</file>
<file>USB.png</file>
<file>USBconncet.png</file>
<file>off.png</file>
<file>min.png</file>
</qresource>
</RCC>
signal.png

522 Bytes

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment