螺杆的更新了一下页面的输入

This commit is contained in:
yiyi 2026-04-08 22:12:47 +08:00
parent 7725f9ce8d
commit 9fbd6b9d1a
11 changed files with 269 additions and 213 deletions

View File

@ -22,6 +22,7 @@ private:
public:
DetectPresenter(/* args */);
~DetectPresenter();
static QString GetAlgoVersion();
/// 螺杆检测接口
int DetectScrew( int cameraIndex,

View File

@ -59,6 +59,7 @@ public:
};
AlgoParams GetAlgoParams() const;
void SetAlgoParams(const AlgoParams& params);
QString GetAlgoVersion() const;
// 获取配置管理器
ConfigManager* GetConfigManager() { return m_pConfigManager; }

View File

@ -14,6 +14,11 @@ DetectPresenter::~DetectPresenter()
{
}
QString DetectPresenter::GetAlgoVersion()
{
return QString(wd_rodAndBarDetectionVersion());
}
int DetectPresenter::DetectScrew(
int cameraIndex,

View File

@ -652,6 +652,11 @@ ScrewPositionPresenter::AlgoParams ScrewPositionPresenter::GetAlgoParams() const
return params;
}
QString ScrewPositionPresenter::GetAlgoVersion() const
{
return DetectPresenter::GetAlgoVersion();
}
// 设置算法参数
void ScrewPositionPresenter::SetAlgoParams(const AlgoParams& params)
{

View File

@ -2,6 +2,7 @@
#define VERSION_H
#define SCREWPOSITION_APP_NAME "螺杆定位"
#define SCREWPOSITION_VERSION_STRING "1.1.0"
#define SCREWPOSITION_BUILD_STRING "1"
#define SCREWPOSITION_FULL_VERSION_STRING "V" SCREWPOSITION_VERSION_STRING "_" SCREWPOSITION_BUILD_STRING

View File

@ -1,15 +1,20 @@
#include "dialogalgoarg.h"
#include "ui_dialogalgoarg.h"
#include <QDoubleValidator>
#include <QIntValidator>
#include <QLineEdit>
#include "ScrewPositionPresenter.h"
#include "StyledMessageBox.h"
DialogAlgoArg::DialogAlgoArg(QWidget *parent)
: QDialog(parent)
, ui(new Ui::DialogAlgoArg)
, m_presenter(nullptr)
{
ui->setupUi(this);
setWindowTitle("算法参数设置");
setWindowTitle("Algorithm Parameters");
initNumericEditors();
}
DialogAlgoArg::~DialogAlgoArg()
@ -23,105 +28,166 @@ void DialogAlgoArg::SetPresenter(ScrewPositionPresenter* presenter)
loadParams();
}
void DialogAlgoArg::initNumericEditors()
{
auto setupDoubleEditor = [](QLineEdit* edit, double min, double max, int decimals) {
auto* validator = new QDoubleValidator(min, max, decimals, edit);
validator->setNotation(QDoubleValidator::StandardNotation);
edit->setValidator(validator);
};
auto setupIntEditor = [](QLineEdit* edit, int min, int max) {
edit->setValidator(new QIntValidator(min, max, edit));
};
setupDoubleEditor(ui->spinRodDiameter, 1.0, 100.0, 6);
setupDoubleEditor(ui->spinCornerTh, 0.0, 180.0, 6);
setupDoubleEditor(ui->spinScale, 0.0, 200.0, 6);
setupDoubleEditor(ui->spinMinEndingGap, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinMinEndingGapZ, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinJumpCornerTh1, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinJumpCornerTh2, 0.0, 180.0, 6);
setupDoubleEditor(ui->spinContinuityTh, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinOutlierTh, 0.0, 50.0, 6);
setupIntEditor(ui->spinMaxLineSkipNum, -1, 100);
setupDoubleEditor(ui->spinYDeviationMax, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinMaxSkipDistance, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinZDeviationMax, 0.0, 100.0, 6);
setupDoubleEditor(ui->spinMinLTypeTreeLen, 0.0, 1000.0, 6);
setupDoubleEditor(ui->spinMinVTypeTreeLen, 0.0, 1000.0, 6);
}
void DialogAlgoArg::setDoubleEditorText(QLineEdit* edit, double value)
{
if (edit) {
edit->setText(QString::number(value, 'g', 12));
}
}
void DialogAlgoArg::setIntEditorText(QLineEdit* edit, int value)
{
if (edit) {
edit->setText(QString::number(value));
}
}
bool DialogAlgoArg::tryGetDouble(QLineEdit* edit, const QString& label, double& value)
{
bool ok = false;
value = edit->text().trimmed().toDouble(&ok);
if (!ok) {
StyledMessageBox::warning(this, "Error",
QString("Invalid numeric input for \"%1\".").arg(label));
edit->setFocus();
edit->selectAll();
return false;
}
return true;
}
bool DialogAlgoArg::tryGetInt(QLineEdit* edit, const QString& label, int& value)
{
bool ok = false;
value = edit->text().trimmed().toInt(&ok);
if (!ok) {
StyledMessageBox::warning(this, "Error",
QString("Invalid integer input for \"%1\".").arg(label));
edit->setFocus();
edit->selectAll();
return false;
}
return true;
}
void DialogAlgoArg::loadParams()
{
if (!m_presenter) {
return;
}
auto params = m_presenter->GetAlgoParams();
const auto params = m_presenter->GetAlgoParams();
// 螺杆参数
ui->spinRodDiameter->setValue(params.screwParam.rodDiameter);
setDoubleEditorText(ui->spinRodDiameter, params.screwParam.rodDiameter);
ui->chkHorizonScan->setChecked(params.screwParam.isHorizonScan);
// 角点检测参数 (VrCornerParam)
ui->spinCornerTh->setValue(params.cornerParam.cornerTh);
ui->spinScale->setValue(params.cornerParam.scale);
ui->spinMinEndingGap->setValue(params.cornerParam.minEndingGap);
ui->spinMinEndingGapZ->setValue(params.cornerParam.minEndingGap_z);
ui->spinJumpCornerTh1->setValue(params.cornerParam.jumpCornerTh_1);
ui->spinJumpCornerTh2->setValue(params.cornerParam.jumpCornerTh_2);
setDoubleEditorText(ui->spinCornerTh, params.cornerParam.cornerTh);
setDoubleEditorText(ui->spinScale, params.cornerParam.scale);
setDoubleEditorText(ui->spinMinEndingGap, params.cornerParam.minEndingGap);
setDoubleEditorText(ui->spinMinEndingGapZ, params.cornerParam.minEndingGap_z);
setDoubleEditorText(ui->spinJumpCornerTh1, params.cornerParam.jumpCornerTh_1);
setDoubleEditorText(ui->spinJumpCornerTh2, params.cornerParam.jumpCornerTh_2);
// 滤波参数 (VrOutlierFilterParam)
ui->spinContinuityTh->setValue(params.filterParam.continuityTh);
ui->spinOutlierTh->setValue(params.filterParam.outlierTh);
setDoubleEditorText(ui->spinContinuityTh, params.filterParam.continuityTh);
setDoubleEditorText(ui->spinOutlierTh, params.filterParam.outlierTh);
// 树生长参数 (VrTreeGrowParam)
ui->spinMaxLineSkipNum->setValue(params.growParam.maxLineSkipNum);
ui->spinYDeviationMax->setValue(params.growParam.yDeviation_max);
ui->spinMaxSkipDistance->setValue(params.growParam.maxSkipDistance);
ui->spinZDeviationMax->setValue(params.growParam.zDeviation_max);
ui->spinMinLTypeTreeLen->setValue(params.growParam.minLTypeTreeLen);
ui->spinMinVTypeTreeLen->setValue(params.growParam.minVTypeTreeLen);
setIntEditorText(ui->spinMaxLineSkipNum, params.growParam.maxLineSkipNum);
setDoubleEditorText(ui->spinYDeviationMax, params.growParam.yDeviation_max);
setDoubleEditorText(ui->spinMaxSkipDistance, params.growParam.maxSkipDistance);
setDoubleEditorText(ui->spinZDeviationMax, params.growParam.zDeviation_max);
setDoubleEditorText(ui->spinMinLTypeTreeLen, params.growParam.minLTypeTreeLen);
setDoubleEditorText(ui->spinMinVTypeTreeLen, params.growParam.minVTypeTreeLen);
}
void DialogAlgoArg::saveParams()
bool DialogAlgoArg::saveParams()
{
if (!m_presenter) {
return;
return false;
}
auto params = m_presenter->GetAlgoParams();
// 螺杆参数
params.screwParam.rodDiameter = ui->spinRodDiameter->value();
if (!tryGetDouble(ui->spinRodDiameter, "Rod Diameter", params.screwParam.rodDiameter)) return false;
params.screwParam.isHorizonScan = ui->chkHorizonScan->isChecked();
// 角点检测参数 (VrCornerParam)
params.cornerParam.cornerTh = ui->spinCornerTh->value();
params.cornerParam.scale = ui->spinScale->value();
params.cornerParam.minEndingGap = ui->spinMinEndingGap->value();
params.cornerParam.minEndingGap_z = ui->spinMinEndingGapZ->value();
params.cornerParam.jumpCornerTh_1 = ui->spinJumpCornerTh1->value();
params.cornerParam.jumpCornerTh_2 = ui->spinJumpCornerTh2->value();
if (!tryGetDouble(ui->spinCornerTh, "Corner Threshold", params.cornerParam.cornerTh)) return false;
if (!tryGetDouble(ui->spinScale, "Scale", params.cornerParam.scale)) return false;
if (!tryGetDouble(ui->spinMinEndingGap, "Min Ending Gap Y", params.cornerParam.minEndingGap)) return false;
if (!tryGetDouble(ui->spinMinEndingGapZ, "Min Ending Gap Z", params.cornerParam.minEndingGap_z)) return false;
if (!tryGetDouble(ui->spinJumpCornerTh1, "Jump Corner Threshold 1", params.cornerParam.jumpCornerTh_1)) return false;
if (!tryGetDouble(ui->spinJumpCornerTh2, "Jump Corner Threshold 2", params.cornerParam.jumpCornerTh_2)) return false;
// 滤波参数 (VrOutlierFilterParam)
params.filterParam.continuityTh = ui->spinContinuityTh->value();
params.filterParam.outlierTh = ui->spinOutlierTh->value();
if (!tryGetDouble(ui->spinContinuityTh, "Continuity Threshold", params.filterParam.continuityTh)) return false;
if (!tryGetDouble(ui->spinOutlierTh, "Outlier Threshold", params.filterParam.outlierTh)) return false;
// 树生长参数 (VrTreeGrowParam)
params.growParam.maxLineSkipNum = ui->spinMaxLineSkipNum->value();
params.growParam.yDeviation_max = ui->spinYDeviationMax->value();
params.growParam.maxSkipDistance = ui->spinMaxSkipDistance->value();
params.growParam.zDeviation_max = ui->spinZDeviationMax->value();
params.growParam.minLTypeTreeLen = ui->spinMinLTypeTreeLen->value();
params.growParam.minVTypeTreeLen = ui->spinMinVTypeTreeLen->value();
if (!tryGetInt(ui->spinMaxLineSkipNum, "Max Line Skip Num", params.growParam.maxLineSkipNum)) return false;
if (!tryGetDouble(ui->spinYDeviationMax, "Y Deviation Max", params.growParam.yDeviation_max)) return false;
if (!tryGetDouble(ui->spinMaxSkipDistance, "Max Skip Distance", params.growParam.maxSkipDistance)) return false;
if (!tryGetDouble(ui->spinZDeviationMax, "Z Deviation Max", params.growParam.zDeviation_max)) return false;
if (!tryGetDouble(ui->spinMinLTypeTreeLen, "Min L Type Tree Len", params.growParam.minLTypeTreeLen)) return false;
if (!tryGetDouble(ui->spinMinVTypeTreeLen, "Min V Type Tree Len", params.growParam.minVTypeTreeLen)) return false;
m_presenter->SetAlgoParams(params);
return true;
}
void DialogAlgoArg::resetParams()
{
// 重置为默认值
ui->spinRodDiameter->setValue(10.0);
setDoubleEditorText(ui->spinRodDiameter, 10.0);
ui->chkHorizonScan->setChecked(true);
// 角点检测参数默认值
ui->spinCornerTh->setValue(60.0);
ui->spinScale->setValue(50.0);
ui->spinMinEndingGap->setValue(20.0);
ui->spinMinEndingGapZ->setValue(20.0);
ui->spinJumpCornerTh1->setValue(10.0);
ui->spinJumpCornerTh2->setValue(60.0);
setDoubleEditorText(ui->spinCornerTh, 60.0);
setDoubleEditorText(ui->spinScale, 50.0);
setDoubleEditorText(ui->spinMinEndingGap, 20.0);
setDoubleEditorText(ui->spinMinEndingGapZ, 20.0);
setDoubleEditorText(ui->spinJumpCornerTh1, 10.0);
setDoubleEditorText(ui->spinJumpCornerTh2, 60.0);
// 滤波参数默认值
ui->spinContinuityTh->setValue(20.0);
ui->spinOutlierTh->setValue(5.0);
setDoubleEditorText(ui->spinContinuityTh, 20.0);
setDoubleEditorText(ui->spinOutlierTh, 5.0);
// 树生长参数默认值
ui->spinMaxLineSkipNum->setValue(10);
ui->spinYDeviationMax->setValue(10.0);
ui->spinMaxSkipDistance->setValue(10.0);
ui->spinZDeviationMax->setValue(10.0);
ui->spinMinLTypeTreeLen->setValue(100.0);
ui->spinMinVTypeTreeLen->setValue(100.0);
setIntEditorText(ui->spinMaxLineSkipNum, 10);
setDoubleEditorText(ui->spinYDeviationMax, 10.0);
setDoubleEditorText(ui->spinMaxSkipDistance, 10.0);
setDoubleEditorText(ui->spinZDeviationMax, 10.0);
setDoubleEditorText(ui->spinMinLTypeTreeLen, 100.0);
setDoubleEditorText(ui->spinMinVTypeTreeLen, 100.0);
}
void DialogAlgoArg::on_btnOK_clicked()
{
saveParams();
accept();
if (saveParams()) {
accept();
}
}
void DialogAlgoArg::on_btnCancel_clicked()
@ -131,14 +197,15 @@ void DialogAlgoArg::on_btnCancel_clicked()
void DialogAlgoArg::on_btnApply_clicked()
{
saveParams();
StyledMessageBox::information(this, "提示", "参数已应用");
if (saveParams()) {
StyledMessageBox::information(this, "Info", "Parameters applied.");
}
}
void DialogAlgoArg::on_btnReset_clicked()
{
auto ret = StyledMessageBox::question(this, "确认重置",
"确定要重置为默认参数吗?");
auto ret = StyledMessageBox::question(this, "Reset",
"Reset parameters to defaults?");
if (ret == QMessageBox::Yes) {
resetParams();
}

View File

@ -2,16 +2,15 @@
#define DIALOGALGOARG_H
#include <QDialog>
#include <QString>
class QLineEdit;
class ScrewPositionPresenter;
namespace Ui {
class DialogAlgoArg;
}
class ScrewPositionPresenter;
/**
* @brief
*/
class DialogAlgoArg : public QDialog
{
Q_OBJECT
@ -29,13 +28,19 @@ private slots:
void on_btnReset_clicked();
private:
void initNumericEditors();
void loadParams();
void saveParams();
bool saveParams();
void resetParams();
void setDoubleEditorText(QLineEdit* edit, double value);
void setIntEditorText(QLineEdit* edit, int value);
bool tryGetDouble(QLineEdit* edit, const QString& label, double& value);
bool tryGetInt(QLineEdit* edit, const QString& label, int& value);
private:
Ui::DialogAlgoArg *ui;
ScrewPositionPresenter* m_presenter;
Ui::DialogAlgoArg *ui = nullptr;
ScrewPositionPresenter* m_presenter = nullptr;
};
#endif // DIALOGALGOARG_H

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>700</width>
<height>780</height>
<height>598</height>
</rect>
</property>
<property name="windowTitle">
@ -44,7 +44,7 @@
<x>40</x>
<y>80</y>
<width>620</width>
<height>620</height>
<height>431</height>
</rect>
</property>
<property name="font">
@ -57,8 +57,6 @@
QTabBar::tab { background-color: rgb(47, 48, 52); color: rgb(221, 225, 233); padding: 8px; min-width: 100px; }
QTabBar::tab:selected { background-color: rgb(70, 72, 78); border-bottom: 2px solid rgb(100, 150, 200); }
QLineEdit { color: rgb(221, 225, 233); background-color: rgb(47, 48, 52); border: 1px solid rgb(70, 72, 78); padding: 4px; }
QDoubleSpinBox { color: rgb(221, 225, 233); background-color: rgb(47, 48, 52); border: 1px solid rgb(70, 72, 78); padding: 4px; }
QSpinBox { color: rgb(221, 225, 233); background-color: rgb(47, 48, 52); border: 1px solid rgb(70, 72, 78); padding: 4px; }
QCheckBox { color: rgb(221, 225, 233); }
QLabel { color: rgb(221, 225, 233); }
QGroupBox { color: rgb(221, 225, 233); border: 1px solid rgb(100, 100, 100); border-radius: 4px; margin-top: 12px; padding-top: 8px; }
@ -77,7 +75,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<x>10</x>
<y>20</y>
<width>590</width>
<height>200</height>
<height>161</height>
</rect>
</property>
<property name="font">
@ -106,7 +104,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>螺杆直径 (mm):</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinRodDiameter">
<widget class="QLineEdit" name="spinRodDiameter">
<property name="geometry">
<rect>
<x>280</x>
@ -120,21 +118,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>30</height>
</rect>
@ -145,14 +137,14 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
</font>
</property>
<property name="text">
<string>水平扫描模式:</string>
<string>激光线平行螺杆</string>
</property>
</widget>
<widget class="QCheckBox" name="chkHorizonScan">
<property name="geometry">
<rect>
<x>280</x>
<y>110</y>
<y>100</y>
<width>250</width>
<height>35</height>
</rect>
@ -163,7 +155,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
</font>
</property>
<property name="text">
<string>激光线平行槽道</string>
<string>激光线平行螺杆</string>
</property>
<property name="checked">
<bool>true</bool>
@ -181,7 +173,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<x>10</x>
<y>20</y>
<width>590</width>
<height>520</height>
<height>351</height>
</rect>
</property>
<property name="font">
@ -210,7 +202,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>拐角阈值:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinCornerTh">
<widget class="QLineEdit" name="spinCornerTh">
<property name="geometry">
<rect>
<x>280</x>
@ -224,18 +216,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>60.000000000000000</double>
<property name="text">
<string>60</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>30</height>
</rect>
@ -249,11 +238,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>窗口比例因子:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinScale">
<widget class="QLineEdit" name="spinScale">
<property name="geometry">
<rect>
<x>280</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>35</height>
</rect>
@ -263,18 +252,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
<property name="text">
<string>50</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>30</x>
<y>170</y>
<y>150</y>
<width>220</width>
<height>30</height>
</rect>
@ -288,11 +274,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>Y方向最小结束间隔:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinMinEndingGap">
<widget class="QLineEdit" name="spinMinEndingGap">
<property name="geometry">
<rect>
<x>280</x>
<y>170</y>
<y>150</y>
<width>200</width>
<height>35</height>
</rect>
@ -302,18 +288,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>20.000000000000000</double>
<property name="text">
<string>20</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>30</x>
<y>230</y>
<y>200</y>
<width>220</width>
<height>30</height>
</rect>
@ -327,11 +310,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>Z方向最小结束间隔:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinMinEndingGapZ">
<widget class="QLineEdit" name="spinMinEndingGapZ">
<property name="geometry">
<rect>
<x>280</x>
<y>230</y>
<y>200</y>
<width>200</width>
<height>35</height>
</rect>
@ -341,18 +324,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>20.000000000000000</double>
<property name="text">
<string>20</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>30</x>
<y>290</y>
<y>250</y>
<width>200</width>
<height>30</height>
</rect>
@ -366,11 +346,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>跳跃拐角阈值1:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinJumpCornerTh1">
<widget class="QLineEdit" name="spinJumpCornerTh1">
<property name="geometry">
<rect>
<x>280</x>
<y>290</y>
<y>250</y>
<width>200</width>
<height>35</height>
</rect>
@ -380,18 +360,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>30</x>
<y>350</y>
<y>300</y>
<width>200</width>
<height>30</height>
</rect>
@ -405,11 +382,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>跳跃拐角阈值2:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinJumpCornerTh2">
<widget class="QLineEdit" name="spinJumpCornerTh2">
<property name="geometry">
<rect>
<x>280</x>
<y>350</y>
<y>300</y>
<width>200</width>
<height>35</height>
</rect>
@ -419,11 +396,8 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>60.000000000000000</double>
<property name="text">
<string>60</string>
</property>
</widget>
</widget>
@ -438,7 +412,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<x>10</x>
<y>20</y>
<width>590</width>
<height>200</height>
<height>161</height>
</rect>
</property>
<property name="font">
@ -467,7 +441,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>连续性阈值:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinContinuityTh">
<widget class="QLineEdit" name="spinContinuityTh">
<property name="geometry">
<rect>
<x>280</x>
@ -481,18 +455,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>20.000000000000000</double>
<property name="text">
<string>20</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>30</height>
</rect>
@ -506,11 +477,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>离群点阈值:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinOutlierTh">
<widget class="QLineEdit" name="spinOutlierTh">
<property name="geometry">
<rect>
<x>280</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>35</height>
</rect>
@ -520,11 +491,8 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>50.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
<property name="text">
<string>5</string>
</property>
</widget>
</widget>
@ -539,7 +507,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<x>10</x>
<y>20</y>
<width>590</width>
<height>520</height>
<height>351</height>
</rect>
</property>
<property name="font">
@ -568,7 +536,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>最大跳线数:</string>
</property>
</widget>
<widget class="QSpinBox" name="spinMaxLineSkipNum">
<widget class="QLineEdit" name="spinMaxLineSkipNum">
<property name="geometry">
<rect>
<x>280</x>
@ -582,21 +550,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>10</number>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>30</height>
</rect>
@ -610,11 +572,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>Y偏差最大值:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinYDeviationMax">
<widget class="QLineEdit" name="spinYDeviationMax">
<property name="geometry">
<rect>
<x>280</x>
<y>110</y>
<y>100</y>
<width>200</width>
<height>35</height>
</rect>
@ -624,18 +586,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>30</x>
<y>170</y>
<y>150</y>
<width>200</width>
<height>30</height>
</rect>
@ -649,11 +608,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>最大跳跃距离:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinMaxSkipDistance">
<widget class="QLineEdit" name="spinMaxSkipDistance">
<property name="geometry">
<rect>
<x>280</x>
<y>170</y>
<y>150</y>
<width>200</width>
<height>35</height>
</rect>
@ -663,18 +622,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>30</x>
<y>230</y>
<y>200</y>
<width>200</width>
<height>30</height>
</rect>
@ -688,11 +644,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>Z偏差最大值:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinZDeviationMax">
<widget class="QLineEdit" name="spinZDeviationMax">
<property name="geometry">
<rect>
<x>280</x>
<y>230</y>
<y>200</y>
<width>200</width>
<height>35</height>
</rect>
@ -702,18 +658,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
<property name="text">
<string>10</string>
</property>
</widget>
<widget class="QLabel" name="label_15">
<property name="geometry">
<rect>
<x>30</x>
<y>290</y>
<y>250</y>
<width>200</width>
<height>30</height>
</rect>
@ -727,11 +680,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>L型树最小长度:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinMinLTypeTreeLen">
<widget class="QLineEdit" name="spinMinLTypeTreeLen">
<property name="geometry">
<rect>
<x>280</x>
<y>290</y>
<y>250</y>
<width>200</width>
<height>35</height>
</rect>
@ -741,18 +694,15 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
<property name="text">
<string>100</string>
</property>
</widget>
<widget class="QLabel" name="label_16">
<property name="geometry">
<rect>
<x>30</x>
<y>350</y>
<y>300</y>
<width>200</width>
<height>30</height>
</rect>
@ -766,11 +716,11 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<string>V型树最小长度:</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinMinVTypeTreeLen">
<widget class="QLineEdit" name="spinMinVTypeTreeLen">
<property name="geometry">
<rect>
<x>280</x>
<y>350</y>
<y>300</y>
<width>200</width>
<height>35</height>
</rect>
@ -780,11 +730,8 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<pointsize>16</pointsize>
</font>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
<property name="text">
<string>100</string>
</property>
</widget>
</widget>
@ -794,7 +741,7 @@ QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;
<property name="geometry">
<rect>
<x>40</x>
<y>720</y>
<y>530</y>
<width>120</width>
<height>45</height>
</rect>
@ -827,8 +774,8 @@ QPushButton:pressed {
<widget class="QPushButton" name="btnApply">
<property name="geometry">
<rect>
<x>300</x>
<y>720</y>
<x>320</x>
<y>530</y>
<width>100</width>
<height>45</height>
</rect>
@ -861,8 +808,8 @@ QPushButton:pressed {
<widget class="QPushButton" name="btnOK">
<property name="geometry">
<rect>
<x>420</x>
<y>720</y>
<x>440</x>
<y>530</y>
<width>100</width>
<height>45</height>
</rect>
@ -895,8 +842,8 @@ QPushButton:pressed {
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>540</x>
<y>720</y>
<x>560</x>
<y>530</y>
<width>100</width>
<height>45</height>
</rect>

View File

@ -68,7 +68,10 @@ MainWindow::MainWindow(QWidget *parent)
QLabel* buildLabel = new QLabel(versionWithBuildTime);
buildLabel->setStyleSheet("color: rgb(239, 241, 245); font-size: 20px; margin-right: 16px;");
buildLabel->setCursor(Qt::PointingHandCursor);
buildLabel->installEventFilter(this);
statusBar()->addPermanentWidget(buildLabel);
m_versionLabel = buildLabel;
// 隐藏标题栏
setWindowFlags(Qt::FramelessWindowHint);
@ -106,6 +109,19 @@ MainWindow::MainWindow(QWidget *parent)
Init();
}
bool MainWindow::eventFilter(QObject* obj, QEvent* event)
{
if (obj == m_versionLabel && event->type() == QEvent::MouseButtonPress) {
const QString versionStr = m_versionLabel->text();
const QString algoVersion = m_presenter ? m_presenter->GetAlgoVersion() : QString();
AboutDialog dlg(SCREWPOSITION_APP_NAME, versionStr, algoVersion, this);
dlg.exec();
return true;
}
return QMainWindow::eventFilter(obj, event);
}
MainWindow::~MainWindow()
{
// 释放业务逻辑处理类

View File

@ -2,6 +2,7 @@
#define MAINWINDOW_H
#include <QMainWindow>
#include <QEvent>
#include <QImage>
#include <QLabel>
#include <QPixmap>
@ -12,6 +13,7 @@
#include <QGraphicsView>
#include <QMenu>
#include <QAction>
#include "AboutDialog.h"
#include "CommonDialogCamera.h"
#include "dialogalgoarg.h"
#include "CommonDialogCameraLevel.h"
@ -34,6 +36,7 @@ public:
void updateStatusLog(const QString& message);
void clearDetectionLog();
void Init();
bool eventFilter(QObject* obj, QEvent* event) override;
// 实现IYScrewPositionStatus接口
virtual void OnStatusUpdate(const std::string& statusMessage) override;
@ -104,6 +107,7 @@ private:
// 右键菜单相关
QMenu* m_contextMenu = nullptr;
QAction* m_saveDataAction = nullptr;
QLabel* m_versionLabel = nullptr;
void displayImage(const QImage& image);

View File

@ -1,3 +1,7 @@
# 1.1.0
## build_0 2026-04-28
1. 更新内存泄露问题
# 1.0.3
## build_0 2026-03-24
1. 更新算法1.3.0