2025-03-17T17:30:53
This commit is contained in:
parent
859dde6b50
commit
1e41597024
23
src/.vscode/launch.json
vendored
Normal file
23
src/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "QtBuild",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${command:cmake.launchTargetPath}",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"environment": [
|
||||||
|
{
|
||||||
|
"name": "PATH",
|
||||||
|
"value": "D:/qt/Qt5.14.2/5.14.2/mingw73_64/bin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"externalConsole": false,
|
||||||
|
"miDebuggerPath": "D:/qt/Qt5.14.2/5.14.2/mingw73_64/bin/gdb.exe"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
src/.vscode/settings.json
vendored
Normal file
3
src/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"qtConfigure.qtKitDir": "D:/qt/Qt5.14.2/5.14.2/mingw73_64"
|
||||||
|
}
|
||||||
@ -16,6 +16,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
data/filemanager.cpp \
|
||||||
global.cpp \
|
global.cpp \
|
||||||
ui/centralwidget.cpp \
|
ui/centralwidget.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
@ -28,6 +29,7 @@ SOURCES += \
|
|||||||
ui/realtimedataform.cpp
|
ui/realtimedataform.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
data/filemanager.h \
|
||||||
defines.h \
|
defines.h \
|
||||||
global.h \
|
global.h \
|
||||||
ui/centralwidget.h \
|
ui/centralwidget.h \
|
||||||
@ -47,7 +49,8 @@ FORMS += \
|
|||||||
|
|
||||||
INCLUDEPATH += serialport \
|
INCLUDEPATH += serialport \
|
||||||
ui \
|
ui \
|
||||||
thirdparty/qcustomplot
|
thirdparty/qcustomplot \
|
||||||
|
data
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
|||||||
21
src/CMakeLists.txt
Normal file
21
src/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.5) # CMake install : https://cmake.org/download/
|
||||||
|
project(qt_new_proj LANGUAGES CXX)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
set(CMAKE_PREFIX_PATH "D:/qt/Qt5.14.2/5.14.2/mingw73_64") # Qt Kit Dir
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
find_package(Qt5 COMPONENTS Widgets REQUIRED) # Qt COMPONENTS
|
||||||
|
aux_source_directory(./src srcs)
|
||||||
|
|
||||||
|
# Specify MSVC UTF-8 encoding
|
||||||
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME}
|
||||||
|
WIN32 # If you need a terminal for debug, please comment this statement
|
||||||
|
${srcs}
|
||||||
|
)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets) # Qt5 Shared Library
|
||||||
55
src/data/filemanager.cpp
Normal file
55
src/data/filemanager.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include <QFile>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "filemanager.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void FileManager::writeExperimentFile(const CommonData &cd, QFile &file)
|
||||||
|
{
|
||||||
|
// double sampleTemp = cd.sample_temp;
|
||||||
|
// double dsc = cd.dsc;
|
||||||
|
|
||||||
|
// write data to file
|
||||||
|
// QFile file("experiment_data.txt");
|
||||||
|
// if (!file.open(QIODevice::Append | QIODevice::Text)) {
|
||||||
|
// qDebug() << "无法打开文件";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
QTextStream out(&file);
|
||||||
|
out.setRealNumberPrecision(3); // 设置精度为三位小数
|
||||||
|
out.setFieldWidth(12); // 设置字段宽度,确保对齐
|
||||||
|
out.setPadChar(' '); // 设置填充字符为空格
|
||||||
|
|
||||||
|
// 写入数据
|
||||||
|
out << cd.sample_temp << ", "
|
||||||
|
<< cd.dsc << endl;
|
||||||
|
|
||||||
|
// 关闭文件
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileManager::createExperimentFile(const QString &fileName, QFile &file)
|
||||||
|
{
|
||||||
|
// 使用传入的文件名创建QFile对象
|
||||||
|
file.setFileName(fileName);
|
||||||
|
|
||||||
|
// 尝试以写入文本模式打开文件,如果文件不存在则创建它
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||||
|
qDebug() << "无法打开文件";
|
||||||
|
} else {
|
||||||
|
qDebug() << "文件打开成功";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileManager::test()
|
||||||
|
{
|
||||||
|
QString fileName = "experiment.txt";
|
||||||
|
|
||||||
|
QFile file;
|
||||||
|
createExperimentFile(fileName,file);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
16
src/data/filemanager.h
Normal file
16
src/data/filemanager.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef FILE_MANAGER_H
|
||||||
|
#define FILE_MANAGER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
#include "protocol.h"
|
||||||
|
|
||||||
|
namespace FileManager{
|
||||||
|
void createExperimentFile(const QString&,QFile &);
|
||||||
|
void writeExperimentFile(const CommonData&, QFile &);
|
||||||
|
|
||||||
|
void test();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -13,10 +13,11 @@ public:
|
|||||||
enum Mode{
|
enum Mode{
|
||||||
Analysis,
|
Analysis,
|
||||||
ConnectedToDev,
|
ConnectedToDev,
|
||||||
ExperimentStart
|
DeliveredData,
|
||||||
|
ExperimentStart,
|
||||||
|
// ExperimentStop = Analysis
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void setMode(const Mode);
|
void setMode(const Mode);
|
||||||
Mode getMode(){return _mode;}
|
Mode getMode(){return _mode;}
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ public:
|
|||||||
void setDeviceConnectionStatus(const DeviceConnectionStatus);
|
void setDeviceConnectionStatus(const DeviceConnectionStatus);
|
||||||
DeviceConnectionStatus getDeviceConnectionStatus(){return _deviceConnectStatus;}
|
DeviceConnectionStatus getDeviceConnectionStatus(){return _deviceConnectStatus;}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigModeModify(const Mode);
|
void sigModeModify(const Mode);
|
||||||
void sigDeviceConnnectionStatusModify(const DeviceConnectionStatus);
|
void sigDeviceConnnectionStatusModify(const DeviceConnectionStatus);
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "centralwidget.h"
|
#include "centralwidget.h"
|
||||||
#include "serialport/serialport.h"
|
#include "serialport/serialport.h"
|
||||||
#include "ui/realtimedataform.h"
|
#include "realtimedataform.h"
|
||||||
#include "experimentsettingform.h"
|
#include "experimentsettingform.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|||||||
@ -19,7 +19,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
setActionEnable(false);
|
setActionEnable(false);
|
||||||
|
|
||||||
this->setToolTip(".....");
|
this->setToolTip(".....");
|
||||||
// resize(2222,1111);
|
|
||||||
|
|
||||||
setCentralWidget(_centralWidget);
|
setCentralWidget(_centralWidget);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
||||||
@ -43,14 +42,15 @@ MainWindow::~MainWindow()
|
|||||||
void MainWindow::connections()
|
void MainWindow::connections()
|
||||||
{
|
{
|
||||||
//ui
|
//ui
|
||||||
connect(_expertmentSettingForm,&ExperimentSettingForm::sigConnectToDevice,
|
connect(_expertmentSettingForm,&ExperimentSettingForm::sigDeliverData,
|
||||||
SerialPort::instance(),&SerialPort::slotConnectToDevice);
|
SerialPort::instance(),&SerialPort::slotDeliverData);
|
||||||
//dynamic data
|
|
||||||
#if 1
|
#if 1
|
||||||
|
//dynamic data
|
||||||
connect(SerialPort::instance(),&SerialPort::sigSendCommonData,
|
connect(SerialPort::instance(),&SerialPort::sigSendCommonData,
|
||||||
_centralWidget,&CentralWidget::slotRevCommonData);
|
_centralWidget,&CentralWidget::slotRevCommonData);
|
||||||
connect(SerialPort::instance(),&SerialPort::sigSendCommonData,
|
connect(SerialPort::instance(),&SerialPort::sigSendCommonData,
|
||||||
_realTimeDataForm,&RealTimeDataForm::slotRevCommonData);
|
_realTimeDataForm,&RealTimeDataForm::slotRevCommonData);
|
||||||
|
|
||||||
connect(SerialPort::instance(),&SerialPort::sigSendCommonDataToRealDataForm,
|
connect(SerialPort::instance(),&SerialPort::sigSendCommonDataToRealDataForm,
|
||||||
_realTimeDataForm,&RealTimeDataForm::slotRevCommonData);
|
_realTimeDataForm,&RealTimeDataForm::slotRevCommonData);
|
||||||
#endif
|
#endif
|
||||||
@ -111,7 +111,7 @@ void MainWindow::on_actionRealTimeWidget_triggered()
|
|||||||
void MainWindow::on_actionConnectToDev_triggered()
|
void MainWindow::on_actionConnectToDev_triggered()
|
||||||
{
|
{
|
||||||
if(SerialPort::instance()->openSp()){
|
if(SerialPort::instance()->openSp()){
|
||||||
setActionEnable(true);
|
ui->actionNew->setEnabled(true);
|
||||||
Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||||
}else{
|
}else{
|
||||||
QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
||||||
|
|||||||
@ -102,22 +102,27 @@ void SerialPort::slotReadData()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
||||||
qDebug()<<"header:"<<QString::number(spp->head,16).toUpper();
|
// qDebug()<<"header:"<<QString::number(spp->head,16).toUpper();
|
||||||
if(FRANE_HEAD != spp->head){
|
if (FRANE_HEAD != spp->head)
|
||||||
|
{
|
||||||
qDebug() << "Data header error.";
|
qDebug() << "Data header error.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = spp->len - 5;
|
int dataLength = spp->len - 5;
|
||||||
|
|
||||||
CommonData cd;
|
CommonData cd;
|
||||||
u8 *cdPtr = (u8 *)&cd;
|
u8 *cdPtr = (u8 *)&cd;
|
||||||
memcpy(cdPtr + spp->addr,spp->data_buf,length);
|
memcpy(cdPtr + spp->addr, spp->data_buf, dataLength);
|
||||||
|
|
||||||
if(WRITE_CMD == spp->cmd){
|
if (WRITE_CMD == spp->cmd)
|
||||||
writeCmdHandle(spp->len,spp->addr,cd);
|
{
|
||||||
}else{
|
writeCmdHandle(dataLength, spp->addr, cd);
|
||||||
if(Global::Mode::ExperimentStart == Global::instance()->getMode()){
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Global::Mode::ExperimentStart == Global::instance()->getMode())
|
||||||
|
{
|
||||||
emit sigSendCommonData(cd);
|
emit sigSendCommonData(cd);
|
||||||
}
|
}
|
||||||
emit sigSendCommonDataToRealDataForm(cd);
|
emit sigSendCommonDataToRealDataForm(cd);
|
||||||
@ -125,38 +130,81 @@ void SerialPort::slotReadData()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::writeCmdHandle(const int dataLength,const u16 addr,const CommonData&cd)
|
void SerialPort::writeCmdHandle(const int dataLength, const u16 addr,
|
||||||
|
const CommonData &cd)
|
||||||
{
|
{
|
||||||
#if 0
|
int localLength = dataLength;
|
||||||
SerialPortProtocol spp;
|
int localAddr = addr;
|
||||||
memcpy(&spp,ba.data(),ba.size());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
int phaseByteSize = sizeof(Phase);
|
||||||
// int length = spp->len - 5;
|
auto phaseParserFunc = [&](const int index){
|
||||||
|
Phase phase;
|
||||||
|
phase.onoff = 1;
|
||||||
|
phase.gas = cd.phase_data[index].gas;
|
||||||
|
phase.temp_flow = cd.phase_data[index].temp_flow;
|
||||||
|
phase.cutoff_temp = cd.phase_data[index].cutoff_temp;
|
||||||
|
phase.constant_temp_time_min =
|
||||||
|
cd.phase_data[index].constant_temp_time_min;
|
||||||
|
|
||||||
// CommonData cd;
|
localLength -= phaseByteSize;
|
||||||
// u8* cdPtr = (u8*)&cd;
|
localAddr += phaseByteSize;
|
||||||
|
};
|
||||||
|
|
||||||
// memcpy(cdPtr + spp->addr,spp->data_buf,length);
|
while (localLength)
|
||||||
|
{
|
||||||
qDebug()<<"revDataParser run_type:"<<cd.run_mode;
|
switch (localAddr)
|
||||||
|
{
|
||||||
int length = dataLength;
|
case offsetof(CommonData, current_gas): //当前气氛
|
||||||
|
// gas_type_set(dev->temp, msg_data.current_gas);
|
||||||
while(dataLength){
|
localAddr += 1;
|
||||||
switch(addr){
|
localLength -= 1;
|
||||||
case offsetof(CommonData,run_mode):
|
|
||||||
// Global::Mode mode = (Global::Mode)cd.run_mode;
|
|
||||||
length--;
|
|
||||||
break;
|
break;
|
||||||
|
case offsetof(CommonData, auto_pid_temp_flow): //自整定升温速率
|
||||||
|
localAddr += 4;
|
||||||
|
localLength -= 4;
|
||||||
|
break;
|
||||||
|
case offsetof(CommonData, run_mode):
|
||||||
|
{
|
||||||
|
DeviceStartMode mode = (DeviceStartMode)cd.run_mode;
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case DeviceStartMode::Stop:
|
||||||
|
Global::instance()->setMode(Global::Mode::Analysis);
|
||||||
|
break;
|
||||||
|
case DeviceStartMode::Start:
|
||||||
|
Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
localLength--;
|
||||||
|
localAddr++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case offsetof(CommonData, phase_data[0].onoff):
|
||||||
|
phaseParserFunc(0); break;
|
||||||
|
case offsetof(CommonData, phase_data[1].onoff):
|
||||||
|
phaseParserFunc(1); break;
|
||||||
|
case offsetof(CommonData, phase_data[2].onoff):
|
||||||
|
phaseParserFunc(2); break;
|
||||||
|
case offsetof(CommonData, phase_data[3].onoff):
|
||||||
|
phaseParserFunc(3); break;
|
||||||
|
case offsetof(CommonData, phase_data[4].onoff):
|
||||||
|
phaseParserFunc(4); break;
|
||||||
|
case offsetof(CommonData, phase_data[5].onoff):
|
||||||
|
phaseParserFunc(5); break;
|
||||||
|
default:break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerialPort::openSp()
|
bool SerialPort::openSp()
|
||||||
{
|
{
|
||||||
if(_sp != nullptr && _sp->isOpen()){
|
if (_sp != nullptr && _sp->isOpen())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +253,6 @@ bool SerialPort::openSp()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
@ -347,7 +394,7 @@ void SerialPort::parserTest()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::slotConnectToDevice(const QByteArray &ba)
|
void SerialPort::slotDeliverData(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
openSp();
|
openSp();
|
||||||
|
|
||||||
@ -356,11 +403,21 @@ void SerialPort::slotConnectToDevice(const QByteArray &ba)
|
|||||||
|
|
||||||
void SerialPort::slotSendData(const QByteArray &ba)
|
void SerialPort::slotSendData(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
|
/***
|
||||||
|
* 写入的数据有
|
||||||
|
* 1、阶段设置。
|
||||||
|
*/
|
||||||
|
if(WRITE_CMD == ba.at(3)){
|
||||||
|
_lastWriteBa = ba;
|
||||||
|
}
|
||||||
qDebug() << "slotSendData:" << ba.size();
|
qDebug() << "slotSendData:" << ba.size();
|
||||||
|
|
||||||
if(_sp != nullptr && _sp->isOpen()){
|
if (_sp != nullptr && _sp->isOpen())
|
||||||
|
{
|
||||||
_sp->write(ba);
|
_sp->write(ba);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
qDebug() << "sp not open.";
|
qDebug() << "sp not open.";
|
||||||
// qErrnoWarning("sp not open.");
|
// qErrnoWarning("sp not open.");
|
||||||
return;
|
return;
|
||||||
@ -369,7 +426,8 @@ void SerialPort::slotSendData(const QByteArray &ba)
|
|||||||
|
|
||||||
void SerialPort::slotCloseSp()
|
void SerialPort::slotCloseSp()
|
||||||
{
|
{
|
||||||
if(_sp != nullptr && _sp->isOpen()){
|
if (_sp != nullptr && _sp->isOpen())
|
||||||
|
{
|
||||||
_sp->close();
|
_sp->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,8 @@ public:
|
|||||||
static void parserTest();
|
static void parserTest();
|
||||||
bool openSp();
|
bool openSp();
|
||||||
public slots:
|
public slots:
|
||||||
void slotConnectToDevice(const QByteArray&);
|
void slotDeliverData(const QByteArray&);
|
||||||
|
// void slotConnectToDevice(const QByteArray&);
|
||||||
void slotSendData(const QByteArray&);
|
void slotSendData(const QByteArray&);
|
||||||
void slotCloseSp();
|
void slotCloseSp();
|
||||||
signals:
|
signals:
|
||||||
@ -42,6 +43,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
SerialPort(QObject* parent=nullptr);
|
SerialPort(QObject* parent=nullptr);
|
||||||
QSerialPort *_sp;
|
QSerialPort *_sp;
|
||||||
|
QByteArray _lastWriteBa;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERIALPORT_H
|
#endif // SERIALPORT_H
|
||||||
|
|||||||
12
src/src/main.cpp
Normal file
12
src/src/main.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "qt_new_proj.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#pragma comment(lib, "user32.lib")
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
qt_new_proj w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
13
src/src/qt_new_proj.cpp
Normal file
13
src/src/qt_new_proj.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "qt_new_proj.h"
|
||||||
|
|
||||||
|
qt_new_proj::qt_new_proj(QWidget* parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
, ui(new Ui_qt_new_proj)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
qt_new_proj::~qt_new_proj()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
14
src/src/qt_new_proj.h
Normal file
14
src/src/qt_new_proj.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ui_qt_new_proj.h"
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
class qt_new_proj : public QMainWindow {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
qt_new_proj(QWidget* parent = nullptr);
|
||||||
|
~qt_new_proj();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui_qt_new_proj* ui;
|
||||||
|
};
|
||||||
22
src/src/qt_new_proj.ui
Normal file
22
src/src/qt_new_proj.ui
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>qt_new_proj</class>
|
||||||
|
<widget class="QMainWindow" name="qt_new_proj">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>qt_new_proj</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
<widget class="QMenuBar" name="menubar"/>
|
||||||
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -55,6 +55,7 @@ void CentralWidget::slotModeModify(const Global::Mode mode)
|
|||||||
|
|
||||||
void CentralWidget::slotRevCommonData(const CommonData &cd)
|
void CentralWidget::slotRevCommonData(const CommonData &cd)
|
||||||
{
|
{
|
||||||
|
qDebug()<<"slotRevCommonData";
|
||||||
_customPlot->graph(0)->addData(cd.sample_temp, cd.dsc); // 添加数据到曲线
|
_customPlot->graph(0)->addData(cd.sample_temp, cd.dsc); // 添加数据到曲线
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,9 +166,9 @@ void ExperimentSettingForm::slotConnectToDevice()
|
|||||||
|
|
||||||
QByteArray ba = DataParser::connectToDevice(phaseVtr);
|
QByteArray ba = DataParser::connectToDevice(phaseVtr);
|
||||||
qDebug()<<"ba size:"<<ba.size();
|
qDebug()<<"ba size:"<<ba.size();
|
||||||
emit sigConnectToDevice(ba);
|
emit sigDeliverData(ba);
|
||||||
|
|
||||||
Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
QByteArray startBa = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
QByteArray startBa = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
||||||
@ -223,7 +223,7 @@ void ExperimentSettingForm::slotPhaseCheck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentSettingForm::on_pushButton_connect_to_device_clicked()
|
void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
||||||
{
|
{
|
||||||
slotConnectToDevice();
|
slotConnectToDevice();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,9 @@ public:
|
|||||||
~ExperimentSettingForm();
|
~ExperimentSettingForm();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigConnectToDevice(const QByteArray&);
|
void sigDeliverData(const QByteArray&);
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_connect_to_device_clicked();
|
void on_pushButton_deliverData_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void uiReset();
|
void uiReset();
|
||||||
|
|||||||
@ -460,7 +460,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButton_connect_to_device">
|
<widget class="QPushButton" name="pushButton_deliverData">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>471</x>
|
<x>471</x>
|
||||||
@ -470,7 +470,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>连接仪器</string>
|
<string>下发数据</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButton_cancel">
|
<widget class="QPushButton" name="pushButton_cancel">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user