From 53362d9373447e564b3251882d7fbc9050f9e674 Mon Sep 17 00:00:00 2001 From: Sherlock <1297399478@qq.com> Date: Sat, 14 Sep 2024 10:37:03 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.1=20=E4=BC=98=E5=8C=96=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=90=9C=E7=B4=A2=EF=BC=8C=E5=B0=86=E7=A7=91=E5=AD=A6?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=B3=95=E6=94=B9=E4=B8=BA=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=A4=E4=BD=8D=E5=B0=8F=E6=95=B0=E6=98=BE=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=AD=A3=E7=A1=AE=E8=AF=86=E5=88=AB=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=AD=E7=9A=84=E7=A7=91=E5=AD=A6=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log7.pro.user | 6 +++--- mainwindow.cpp | 1 + qcustplot.cpp | 3 +++ threadread.cpp | 12 ++++++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/log7.pro.user b/log7.pro.user index ef52d4d..ff420cd 100644 --- a/log7.pro.user +++ b/log7.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -99,7 +99,7 @@ Qt 5.12.0 (mingw73_64) Qt 5.12.0 (mingw73_64) {edc54fcd-f681-4a0a-ba77-11a1a5c94a66} - 1 + 0 0 0 @@ -255,7 +255,7 @@ true true true - C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Release + C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Debug 1 diff --git a/mainwindow.cpp b/mainwindow.cpp index dc68454..7069aa0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -85,6 +85,7 @@ void MainWindow::addCombo(const QStringList &list) { ui->comboBox->addItems(list); //根据输入匹配下拉框 Gloab::completer = new QCompleter(list); + Gloab::completer->setFilterMode(Qt::MatchContains); ui->comboBox->setCompleter(Gloab::completer); } diff --git a/qcustplot.cpp b/qcustplot.cpp index d2cf850..957802c 100644 --- a/qcustplot.cpp +++ b/qcustplot.cpp @@ -35,6 +35,9 @@ QCustPlot::QCustPlot(QVector xData, QVector yData, int jd, bool QSharedPointer textTicker(new QCPAxisTickerText); textTicker->addTicks(ticks, labels); ui->plot->yAxis->setTicker(textTicker); + }else{ + ui->plot->yAxis->setNumberFormat("f"); + ui->plot->yAxis->setNumberPrecision(2); } // 添加图形 diff --git a/threadread.cpp b/threadread.cpp index 37e8f11..f8aae66 100644 --- a/threadread.cpp +++ b/threadread.cpp @@ -5,11 +5,19 @@ threadRead::threadRead(QObject *parent) } bool threadRead::isNumeric(QString data) { + bool flag = false; // 正则表达式匹配数字和可选的正负号 QRegularExpression pattern("^[+-]?([1-9][0-9]*|0)[.]?[0-9]*$"); QRegularExpressionMatch patternMatch =pattern.match(data); - // 使用std::regex_match来检查字符串是否完全匹配模式 - return patternMatch.hasMatch(); + if(patternMatch.hasMatch()){ + flag = true; + } + QRegularExpression kexue("^[0-9].[0-9]e[+-][0-9][0-9]"); + QRegularExpressionMatch kexueMatch =kexue.match(data); + if(kexueMatch.hasMatch()){ + flag = true; + } + return flag; } void threadRead::run() {