添加主控单元过滤

This commit is contained in:
2025-06-11 16:36:43 +08:00
parent 98bd5fb3b0
commit 82388559ad
8 changed files with 86 additions and 46 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.idea/ .idea/
*.user *.user
build_cmake/
build_qt/

View File

@ -7,8 +7,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
#设置必须支持C++设定版本
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_PREFIX_PATH "C:/Path/Qt5.12.12/5.12.12/mingw73_64")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(Qt5 COMPONENTS PrintSupport REQUIRED) find_package(Qt5 COMPONENTS PrintSupport REQUIRED)
@ -33,17 +36,17 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
MANUAL_FINALIZATION MANUAL_FINALIZATION
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
# Define target properties for Android with Qt 6 as: # Define target properties for Android with Qt 6 as:
# set_property(TARGET ReadLog APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # set_property(TARGET ReadLog APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android) # ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else() else()
if(ANDROID) if(ANDROID)
add_library(ReadLog SHARED add_library(ReadLog SHARED
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
# Define properties for Android with Qt 5 after find_package() calls as: # Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else() else()
add_executable(ReadLog add_executable(ReadLog
${PROJECT_SOURCES} ${PROJECT_SOURCES}

View File

@ -12,7 +12,7 @@ void CustomThread::run() {
m_PlotView.clear(); m_PlotView.clear();
rule.clear(); rule.clear();
for (int var = 0; var < 4; ++var) { for (int var = 0; var < 5; ++var) {
xData[var].clear(); xData[var].clear();
yData[var].clear(); yData[var].clear();
} }

View File

@ -10,7 +10,7 @@
#include <QDateTime> #include <QDateTime>
#include "qcustomplot.h" #include "qcustomplot.h"
extern QVector<QMap<QString, QString>> g_param[4]; //存储4条基带的数据 extern QVector<QMap<QString, QString>> g_param[5]; //存储4条基带的数据+其他
extern QMap<QString, bool> namelist; //存储数据名以及数据是否是数字 extern QMap<QString, bool> namelist; //存储数据名以及数据是否是数字
extern QFile file; //打开文件 extern QFile file; //打开文件
extern QCompleter *completer; //下拉框选项 extern QCompleter *completer; //下拉框选项
@ -19,8 +19,8 @@ extern QDateTime beginTime; //开始时间
extern QDateTime endTime; //结束时间 extern QDateTime endTime; //结束时间
extern QVector<QCustomPlot *> m_PlotView; //custom图 extern QVector<QCustomPlot *> m_PlotView; //custom图
extern QVector<QString> rule; //Y轴映射 extern QVector<QString> rule; //Y轴映射
extern QVector<double> xData[4]; //X轴数据 extern QVector<double> xData[5]; //X轴数据
extern QVector<double> yData[4]; //Y轴数据 extern QVector<double> yData[5]; //Y轴数据
#endif //READLOG_GLOBAL_H #endif //READLOG_GLOBAL_H

View File

@ -7,7 +7,7 @@
//初始化数据 //初始化数据
QVector<QMap<QString, QString>> g_param[4]; QVector<QMap<QString, QString>> g_param[5];
QMap<QString, bool> namelist; QMap<QString, bool> namelist;
QFile file; QFile file;
QCompleter *completer; QCompleter *completer;
@ -16,14 +16,14 @@ QDateTime beginTime;
QDateTime endTime; QDateTime endTime;
QVector<QCustomPlot *> m_PlotView; QVector<QCustomPlot *> m_PlotView;
QVector<QString> rule; QVector<QString> rule;
QVector<double> xData[4]; QVector<double> xData[5];
QVector<double> yData[4]; QVector<double> yData[5];
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
//设置logo //设置logo
QApplication::setWindowIcon(QIcon("logo.ico")); QApplication::setWindowIcon(QIcon("logo.ico"));
//放大窗口 //放大窗口
// qputenv("QT_SCALE_FACTOR", "2.0"); qputenv("QT_SCALE_FACTOR", "1.0");
//设置使用UTF8字符集正确显示中文 //设置使用UTF8字符集正确显示中文
QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec); QTextCodec::setCodecForLocale(codec);

View File

@ -105,6 +105,9 @@ bool MainWindow::inspectionData() {
if (ui->jd4->isChecked()) { if (ui->jd4->isChecked()) {
jd.append(3); jd.append(3);
} }
if (ui->mainCtrl->isChecked()) {
jd.append(4);
}
//判断基带是否为空 //判断基带是否为空
if (jd.isEmpty()) { if (jd.isEmpty()) {
QMessageBox::warning(this, "警告", "请至少选择一个基带"); QMessageBox::warning(this, "警告", "请至少选择一个基带");
@ -181,7 +184,12 @@ void MainWindow::setPlotView(int jd, bool isNum, bool isTime) {
//标题 //标题
QCPTextElement *m_title; QCPTextElement *m_title;
qCustomPlot->plotLayout()->insertRow(0); qCustomPlot->plotLayout()->insertRow(0);
if (jd==4){
m_title = new QCPTextElement(qCustomPlot, "主控单元");
}
else{
m_title = new QCPTextElement(qCustomPlot, QString("基带 %1").arg(jd + 1)); m_title = new QCPTextElement(qCustomPlot, QString("基带 %1").arg(jd + 1));
}
qCustomPlot->plotLayout()->addElement(0, 0, m_title); qCustomPlot->plotLayout()->addElement(0, 0, m_title);
// X轴 // X轴

View File

@ -12,7 +12,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>529</width>
<height>700</height> <height>700</height>
</rect> </rect>
</property> </property>
@ -161,11 +161,11 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<layout class="QGridLayout" name="gridLayout_11"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="2"> <item row="0" column="0">
<widget class="QCheckBox" name="jd3"> <widget class="QCheckBox" name="jd1">
<property name="text"> <property name="text">
<string>基带 3</string> <string>基带 1</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -176,6 +176,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QCheckBox" name="jd3">
<property name="text">
<string>基带 3</string>
</property>
</widget>
</item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QCheckBox" name="jd4"> <widget class="QCheckBox" name="jd4">
<property name="text"> <property name="text">
@ -183,10 +190,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="4">
<widget class="QCheckBox" name="jd1"> <widget class="QCheckBox" name="mainCtrl">
<property name="text"> <property name="text">
<string>基带 1</string> <string>主控单元</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -60,7 +60,6 @@ void ReadThread::run() {
QMap<QString, QString> temMap; QMap<QString, QString> temMap;
int JD; int JD;
QString temtime; QString temtime;
QString temjd;
matchDateTime = dateTimeRegex.match(line); matchDateTime = dateTimeRegex.match(line);
if (matchDateTime.hasMatch()) { if (matchDateTime.hasMatch()) {
temtime = matchDateTime.captured(1); temtime = matchDateTime.captured(1);
@ -68,13 +67,34 @@ void ReadThread::run() {
} else { } else {
continue; continue;
} }
// //匹配基带
// QString temjd;
// matchLogLevel = jdRegex.match(line);//正则表达式匹配
// if (matchLogLevel.hasMatch()) {//是否匹配
// temjd = matchLogLevel.captured(1);//匹配之后取第一个匹配的值
// temMap["基带"] = temjd;
// JD = temjd.toInt() - 1;
// } else {
// continue;
// }
//匹配基带 //匹配基带
matchLogLevel = jdRegex.match(line); if (line.contains("基带 1")){
if (matchLogLevel.hasMatch()) { temMap["基带"] = "1";
temjd = matchLogLevel.captured(1); JD = 0;
temMap["基带"] = temjd; }else if(line.contains("基带 2")){
JD = temjd.toInt() - 1; temMap["基带"] = "2";
} else { JD = 1;
}else if(line.contains("基带 3")){
temMap["基带"] = "3";
JD = 2;
}else if(line.contains("基带 4")){
temMap["基带"] = "4";
JD = 3;
}else if(line.contains("其他单元")){
temMap["基带"] = "5";
JD = 4;
}else {
continue; continue;
} }