Commit 914ec9fd authored by ym0408's avatar ym0408

1

parent 1700a02c
Default.png

27.6 KB

This diff is collapsed.
#ifndef MULTIFUNCTIONDIALOG_H
#define MULTIFUNCTIONDIALOG_H
#include <QDialog>
#include <QLabel> // 解决 QLabel 未声明的问题
#include <QPushButton> // 解决 QPushButton 不完整类型的问题
#include <QListWidget> // 用到了 QListWidget
#include <QRadioButton> // 用到了 QRadioButton
#include <QButtonGroup> // 用到了 QButtonGroup
#include <QDateEdit> // 用到了 QDateEdit
#include <QCalendarWidget> // 用到了 QCalendarWidget
#include <QVBoxLayout> // 用到了布局
#include <QHBoxLayout>
// 枚举:4种弹窗类型
enum DialogType {
WorkStationType, // 工位选择
DeviceType, // 设备名称选择
InspectionType, // 抽检项选择
TimeRangeType // 时间范围选择
};
namespace Ui {
class MultiFunctionDialog;
}
class MultiFunctionDialog : public QDialog
{
Q_OBJECT
public:
explicit MultiFunctionDialog(DialogType type,QWidget *parent = nullptr);
~MultiFunctionDialog();
// 统一接口:获取选择结果(根据类型返回对应数据)
QString getStringResult() const; // 用于:工位/设备/抽检项(返回字符串)
QPair<QDate, QDate> getTimeRangeResult() const; // 用于:时间范围(返回日期对)
private:
// 根据类型创建对应的UI
void initWorkStationUI(); // 初始化工位选择UI
void initDeviceUI(); // 初始化设备选择UI
void initInspectionUI(); // 初始化抽检项选择UI
void initTimeRangeUI(); // 初始化时间范围选择UI
void paintEvent(QPaintEvent *event);
DialogType m_dialogType; // 当前弹窗类型
QListWidget *m_listWidget; // 列表控件(工位/设备用)
QButtonGroup *m_radioGroup; // 单选按钮组(抽检项用)
QDateEdit *m_startDateEdit; // 开始日期编辑框(时间用)
QDateEdit *m_endDateEdit; // 结束日期编辑框(时间用)
Ui::MultiFunctionDialog *ui;
};
#endif // MULTIFUNCTIONDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MultiFunctionDialog</class>
<widget class="QDialog" name="MultiFunctionDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1800</width>
<height>800</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">QDialog {
border: 1px solid #e0e0e0; /* 淡灰色边框 */
border-radius: 25px; /* 圆角(可选,图片中可能有轻微圆角) */
background-color: white; /* 弹窗背景色 */
}</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>281</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>请选择要设置的工位</string>
</property>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="geometry">
<rect>
<x>180</x>
<y>170</y>
<width>256</width>
<height>192</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<item>
<property name="text">
<string>dsad</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
<item>
<property name="text">
<string>dad</string>
</property>
</item>
<item>
<property name="text">
<string>dad</string>
</property>
</item>
<item>
<property name="text">
<string>fsd</string>
</property>
</item>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -16,19 +16,22 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
MultiFunctionDialog.cpp \
main.cpp \
carMachineDetectionWidget.cpp \
pageSoftwareControl.cpp
carMachineDetectionWidget.cpp
HEADERS += \
carMachineDetectionWidget.h \
pageSoftwareControl.h
MultiFunctionDialog.h \
carMachineDetectionWidget.h
FORMS += \
carMachineDetectionWidget.ui \
pageSoftwareControl.ui
MultiFunctionDialog.ui \
carMachineDetectionWidget.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
q.qrc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2025-12-01T18:01:53. -->
<!-- Written by QtCreator 4.11.1, 2025-12-03T10:14:14. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......@@ -287,8 +287,9 @@
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/text/carMachineDetect/carMachineDetect.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Qt/text/carMachineDetect/carMachineDetect.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">carMachineDetect2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/text/carMachineDetect1/carMachineDetect.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Qt/text/carMachineDetect1/carMachineDetect.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
......@@ -530,14 +531,14 @@
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Qt/text/carMachineDetect1/carMachineDetect.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Qt/text/carMachineDetect1/carMachineDetect.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
......
#include "carMachineDetectionWidget.h"
#include "ui_carMachineDetectionWidget.h"
#include "MultiFunctionDialog.h"
#include <QMessageBox>
carMachineDetectionWidget::carMachineDetectionWidget(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::carMachineDetectionWidget)
{
setWindowFlags(windowFlags() & ~Qt::WindowFullscreenButtonHint);
setMaximumSize(2000, 1300);
setMaximumSize(2000, 1200);
ui->setupUi(this);
//初始状态
// ui->widget_search->hide();
// ui->SoftControlwidget->hide();
// ui->listWidget_history->hide();
// ui->tableWidget_cur->hide();
// ui->listWidget_cur->hide();
}
carMachineDetectionWidget::~carMachineDetectionWidget()
......@@ -19,5 +27,48 @@ carMachineDetectionWidget::~carMachineDetectionWidget()
void carMachineDetectionWidget::on_pushButton_btnSoftwareControl_clicked()
{
ui->containerMain->hide();
ui->SoftControlwidget->show();
}
void carMachineDetectionWidget::on_pushButton_return_clicked()
{
ui->containerMain->show();
ui->SoftControlwidget->hide();
}
void carMachineDetectionWidget::on_pushButton_workName_clicked()
{
MultiFunctionDialog dialog(WorkStationType, this);
if (dialog.exec() == QDialog::Accepted) {
QString result = dialog.getStringResult();
if (!result.isEmpty()) {
QMessageBox::information(this, "选择结果", "选中工位:" + result);
// 业务逻辑:更新工位设置
}
}
}
void carMachineDetectionWidget::on_pushButton_deviceName_clicked()
{
MultiFunctionDialog dialog(DeviceType, this);
if (dialog.exec() == QDialog::Accepted) {
QString result = dialog.getStringResult();
if (!result.isEmpty()) {
QMessageBox::information(this, "选择结果", "选中设备:" + result);
// 业务逻辑:更新设备设置
}
}
}
void carMachineDetectionWidget::on_pushButton_inspectionItemt_clicked()
{
MultiFunctionDialog dialog(InspectionType, this);
if (dialog.exec() == QDialog::Accepted) {
QString result = dialog.getStringResult();
if (!result.isEmpty()) {
QMessageBox::information(this, "选择结果", "选中抽检项:" + result);
// 业务逻辑:更新抽检项设置
}
}
}
......@@ -20,6 +20,14 @@ public:
private slots:
void on_pushButton_btnSoftwareControl_clicked();
void on_pushButton_return_clicked();
void on_pushButton_workName_clicked();
void on_pushButton_deviceName_clicked();
void on_pushButton_inspectionItemt_clicked();
private:
Ui::carMachineDetectionWidget *ui;
};
......
This diff is collapsed.
This diff is collapsed.
carModel.png

762 Bytes

carSeries.png

880 Bytes

choosetime.png

701 Bytes

hcar.png

9.5 KB

lcar.png

10.7 KB

next.png

392 Bytes

#ifndef PAGESOFTWARECONTROL_H
#define PAGESOFTWARECONTROL_H
#include <QWidget>
namespace Ui {
class pageSoftwareControl;
}
class pageSoftwareControl : public QWidget
{
Q_OBJECT
public:
explicit pageSoftwareControl(QWidget *parent = nullptr);
~pageSoftwareControl();
private:
Ui::pageSoftwareControl *ui;
};
#endif // PAGESOFTWARECONTROL_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>pageSoftwareControl</class>
<widget class="QWidget" name="pageSoftwareControl">
<property name="geometry">
......@@ -15,7 +13,126 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>201</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>请选择要设置的工位</string>
</property>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="geometry">
<rect>
<x>60</x>
<y>70</y>
<width>256</width>
<height>192</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QListWidget {
border: none; /* 隐藏列表默认边框 */
background-color: transparent; /* 列表背景透明 */
}
QListWidget::item {
height: 30px; /* 列表项高度 */
color: #666666; /* 未选中文字颜色 */
background-color: #ffffff; /* 未选中项背景 */
qproperty-alignment: AlignCenter; /* 关键!让文字水平+垂直居中 */
}
QListWidget::item:selected {
background-color: #f0f0f0; /* 选中项高亮背景 */
color: #000000; /* 选中项文字颜色 */
font-weight: normal;
qproperty-alignment: AlignCenter; /* 选中项也保持居中 */
}
QListWidget::item:hover {
background-color: #f5f5f5; /* 悬浮背景 */
}</string>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
</property>
<property name="currentRow">
<number>-1</number>
</property>
<item>
<property name="text">
<string>KOER</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
<item>
<property name="text">
<string>KOEO</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
<item>
<property name="text">
<string>PEPS</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
<item>
<property name="text">
<string>KOGH</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
<item>
<property name="text">
<string>KMOK</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</item>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>40</x>
<y>250</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>210</x>
<y>250</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<pixmapfunction/>
<resources/>
<connections/>
</ui>
<RCC>
<qresource prefix="/">
<file>startTime.png</file>
<file>time.png</file>
<file>return.png</file>
<file>next.png</file>
<file>hcar.png</file>
<file>lcar.png</file>
<file>carModel.png</file>
<file>carSeries.png</file>
<file>Default.png</file>
<file>choosetime.png</file>
</qresource>
</RCC>
return.png

406 Bytes

time.png

1013 Bytes

This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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