From ae07b9c19e1219a3a94f7002c46a1356776f201f Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Tue, 24 Mar 2026 14:54:48 +0800 Subject: [PATCH] =?UTF-8?q?fix=201=E3=80=81=E7=9B=B8=E6=9C=BA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9C=89=E6=95=88=E6=80=A7=E6=8E=A7=E5=88=B6bug?= =?UTF-8?q?=EF=BC=9B=202=E3=80=81=E7=9B=B8=E6=9C=BA=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E5=9B=BE=E5=83=8F=E5=A4=A7=E5=B0=8F=E8=B0=83=E6=95=B4=EF=BC=9B?= =?UTF-8?q?=203=E3=80=81=E5=B7=A5=E7=A8=8B=E7=9A=84realease=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E5=A4=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HPPA/HPPA.cpp | 4 +- HPPA/HPPA.vcxproj | 6 +- HPPA/HyperImagerControl.cpp | 78 ++++++++-- HPPA/HyperImagerControl.h | 3 +- HPPA/QDoubleSlider.cpp | 1 + HPPA/hyperImagerControl.ui | 294 +++++++++++++++++------------------- HPPA/imgControl.ui | 3 + 7 files changed, 221 insertions(+), 168 deletions(-) diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp index b293816..ad1bf3c 100644 --- a/HPPA/HPPA.cpp +++ b/HPPA/HPPA.cpp @@ -787,8 +787,10 @@ QWidget* HPPA::tmp(QWidget* a) void HPPA::initControlTabwidget() { m_hic = new HyperImagerControl(); - ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪")); + //ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪")); + ui.controlTabWidget->insertTab(0, m_hic, QString::fromLocal8Bit("光谱仪")); m_hic->setDisabled(true); + ui.controlTabWidget->setCurrentIndex(0); //rgb相机 m_RgbCameraThread = new QThread(); diff --git a/HPPA/HPPA.vcxproj b/HPPA/HPPA.vcxproj index dce55e0..f4c8929 100644 --- a/HPPA/HPPA.vcxproj +++ b/HPPA/HPPA.vcxproj @@ -36,8 +36,8 @@ debug - 5.9_msvc2017_64 - core;network;gui;widgets;serialport;websockets;charts + 5.13.2_msvc2017_64 + core;network;gui;svg;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts release @@ -57,10 +57,12 @@ D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;$(IncludePath) D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\x64\Debug;$(LibraryPath) + Spectral Insight D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;$(IncludePath) D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017_release;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Release;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\IrisMultiMotorController\x64\Release;C:\XIMEA\API\xiAPI;$(LibraryPath) + Spectral Insight diff --git a/HPPA/HyperImagerControl.cpp b/HPPA/HyperImagerControl.cpp index 90fbb94..0028c32 100644 --- a/HPPA/HyperImagerControl.cpp +++ b/HPPA/HyperImagerControl.cpp @@ -1,4 +1,4 @@ -#include "HyperImagerControl.h" +#include "HyperImagerControl.h" HyperImagerControl::HyperImagerControl(QWidget* parent) : QDialog(parent) @@ -17,15 +17,60 @@ HyperImagerControl::HyperImagerControl(QWidget* parent) connect(ui.GainSlider, &QSlider::valueChanged, this, &HyperImagerControl::onGainSliderChanged); connect(ui.GainSlider, &QSlider::sliderReleased, this, &HyperImagerControl::onGainSliderReleased); - ui.framerate_spinBox->setMinimum(1); - ui.framerate_spinBox->setMaximum(250); - ui.FramerateSlider->setMinimum(1); - ui.FramerateSlider->setMaximum(250); - - ui.gain_spinBox->setMinimum(0); - ui.gain_spinBox->setMaximum(12); - ui.GainSlider->setMinimum(0); ui.GainSlider->setMaximum(12); + ui.GainSlider->setMinimum(0); + + ui.gain_spinBox->setMaximum(12); + ui.gain_spinBox->setMinimum(0); + + ui.widget_3->setStyleSheet(R"( + QDoubleSpinBox { + border: 1px solid #999; + border-radius: 4px; + padding: 2px 20px 2px 6px; /* 右侧留空间给按钮 */ + background: #0e1c4c; + selection-background-color: #0078d7; + font-size: 12px; + color:#ACCDFF ; + } + + QDoubleSpinBox::up-button { + subcontrol-origin: border; + subcontrol-position: top right; + width: 16px; + border-left: 1px solid #ccc; + } + + QDoubleSpinBox::down-button { + subcontrol-origin: border; + subcontrol-position: bottom right; + width: 16px; + border-left: 1px solid #ccc; + } + + QDoubleSpinBox::up-arrow { + image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_up.svg); + width: 10px; + height: 10px; + } + + QDoubleSpinBox::down-arrow { + image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_down.svg); + width: 10px; + height: 10px; + } + + QDoubleSpinBox::up-button:hover, + QDoubleSpinBox::down-button:hover { + background: #e6f2ff; + } + + QDoubleSpinBox::up-button:pressed, + QDoubleSpinBox::down-button:pressed { + background: #cce4ff; + } + )"); + } HyperImagerControl::~HyperImagerControl() @@ -70,7 +115,7 @@ void HyperImagerControl::onFramerateSliderChanged(double framerate) void HyperImagerControl::onFramerateSliderReleased() { - double framerate = ui.framerate_spinBox->value();//ᴥQDoubleSpinBox::editingFinishedźţӶonFramerateSpinBoxEditingFinishedۺշframerateChangedźš + double framerate = ui.framerate_spinBox->value(); emit framerateChanged(framerate); } @@ -116,26 +161,35 @@ void HyperImagerControl::onGainSliderReleased() void HyperImagerControl::updateIntegrationTimeRange(double frameRate) { - double maxIntegrationTime = 1.0 / frameRate * 1000.0; // + double maxIntegrationTime = 1.0 / frameRate * 1000.0; // 毫秒 ui.IntegratioinTimeSlider->blockSignals(true); ui.IntegratioinTimeSlider->setMaximum(maxIntegrationTime); + ui.IntegratioinTimeSlider->setMinimum(1); ui.IntegratioinTimeSlider->blockSignals(false); ui.integratioin_time_spinBox->blockSignals(true); ui.integratioin_time_spinBox->setMaximum(maxIntegrationTime); + ui.integratioin_time_spinBox->setMinimum(1); ui.integratioin_time_spinBox->blockSignals(false); } void HyperImagerControl::updateFramerateRange(double integrationTime) { - double maxFramerate = 1.0 / (integrationTime / 1000.0); // ʱ()ת֡ + double maxFramerate = 1.0 / (integrationTime / 1000.0); // 积分时间(毫秒)转帧率 + + if(maxFramerate > m_frameRateLimit) + { + maxFramerate = m_frameRateLimit; + } ui.FramerateSlider->blockSignals(true); ui.FramerateSlider->setMaximum(maxFramerate); + ui.FramerateSlider->setMinimum(1); ui.FramerateSlider->blockSignals(false); ui.framerate_spinBox->blockSignals(true); ui.framerate_spinBox->setMaximum(maxFramerate); + ui.framerate_spinBox->setMinimum(1); ui.framerate_spinBox->blockSignals(false); } diff --git a/HPPA/HyperImagerControl.h b/HPPA/HyperImagerControl.h index 1b10ea0..2079d2a 100644 --- a/HPPA/HyperImagerControl.h +++ b/HPPA/HyperImagerControl.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include @@ -41,6 +41,7 @@ private Q_SLOTS: private: void updateIntegrationTimeRange(double frameRate); void updateFramerateRange(double integrationTime); + double m_frameRateLimit = 150;//相机的最大帧率限制为250fps Ui::HyperImagerControl ui; }; diff --git a/HPPA/QDoubleSlider.cpp b/HPPA/QDoubleSlider.cpp index 3e98fa5..b3aaad9 100644 --- a/HPPA/QDoubleSlider.cpp +++ b/HPPA/QDoubleSlider.cpp @@ -7,6 +7,7 @@ m_Multiplier(100.0) connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int))); setSingleStep(1); + setRange(1, 500); setOrientation(Qt::Horizontal); setFocusPolicy(Qt::NoFocus); diff --git a/HPPA/hyperImagerControl.ui b/HPPA/hyperImagerControl.ui index 3efc50a..8036fa9 100644 --- a/HPPA/hyperImagerControl.ui +++ b/HPPA/hyperImagerControl.ui @@ -6,8 +6,8 @@ 0 0 - 462 - 385 + 437 + 372 @@ -117,7 +117,7 @@ QSlider::handle:horizontal:pressed { background: #1f4fff; } - + @@ -131,142 +131,40 @@ QSlider::handle:horizontal:pressed { - + 0 0 - - 0 + + 16 - - 0 - - - 0 - - - 0 - - - 10 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - color: rgb(255, 255, 255); - - - 帧率 - - - Qt::AlignCenter - - - - - - - - - 0 - 0 - - - - 2 - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - + - + 0 0 - - - 16777215 - 16777215 - - - - color: rgb(255, 255, 255); - - - 积分时间 - - - Qt::AlignCenter + + 2 - - - - - - - 0 - 0 - - - - 2 - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - + + + + + 0 + 0 + + + + Qt::Horizontal + + @@ -299,35 +197,127 @@ QSlider::handle:horizontal:pressed { + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + color: rgb(255, 255, 255); + + + 积分时间 + + + Qt::AlignCenter + + + - - - - - - 0 - 0 - - - - 2 - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - + + + + 0 + 0 + + + + 2 + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + 2 + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + color: rgb(255, 255, 255); + + + 帧率 + + + Qt::AlignCenter + + + + + + + hz + + + + + + + ms + + diff --git a/HPPA/imgControl.ui b/HPPA/imgControl.ui index a9091c0..121abd6 100644 --- a/HPPA/imgControl.ui +++ b/HPPA/imgControl.ui @@ -132,6 +132,9 @@ QSlider::handle:horizontal:pressed { 调整 + + 16 +