MeshPart: fix -Wclazy-connect-by-name

This commit is contained in:
wmayer
2023-04-01 18:12:59 +02:00
committed by wwmayer
parent 64a6c3c376
commit dc12c839f2
6 changed files with 86 additions and 38 deletions

View File

@@ -172,6 +172,8 @@ CrossSections::CrossSections(const Base::BoundBox3d& bb, QWidget* parent, Qt::Wi
{
ui = new Ui_CrossSections();
ui->setupUi(this);
setupConnections();
ui->position->setRange(-DBL_MAX, DBL_MAX);
ui->position->setUnit(Base::Unit::Length);
ui->distance->setRange(0, DBL_MAX);
@@ -203,6 +205,27 @@ CrossSections::~CrossSections()
delete vp;
}
void CrossSections::setupConnections()
{
connect(ui->xyPlane, &QRadioButton::clicked,
this, &CrossSections::xyPlaneClicked);
connect(ui->xzPlane, &QRadioButton::clicked,
this, &CrossSections::xzPlaneClicked);
connect(ui->yzPlane, &QRadioButton::clicked,
this, &CrossSections::yzPlaneClicked);
connect(ui->position, qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this, &CrossSections::positionValueChanged);
connect(ui->distance, qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this, &CrossSections::distanceValueChanged);
connect(ui->countSections, qOverload<int>(&QSpinBox::valueChanged),
this, &CrossSections::countSectionsValueChanged);
connect(ui->checkBothSides, &QCheckBox::toggled,
this, &CrossSections::checkBothSidesToggled);
connect(ui->sectionsBox, &QGroupBox::toggled,
this, &CrossSections::sectionsBoxToggled);
}
CrossSections::Plane CrossSections::plane() const
{
if (ui->xyPlane->isChecked())
@@ -345,7 +368,7 @@ void CrossSections::apply()
#endif
}
void CrossSections::on_xyPlane_clicked()
void CrossSections::xyPlaneClicked()
{
Base::Vector3d c = bbox.GetCenter();
ui->position->setValue(c.z);
@@ -361,7 +384,7 @@ void CrossSections::on_xyPlane_clicked()
}
}
void CrossSections::on_xzPlane_clicked()
void CrossSections::xzPlaneClicked()
{
Base::Vector3d c = bbox.GetCenter();
ui->position->setValue(c.y);
@@ -377,7 +400,7 @@ void CrossSections::on_xzPlane_clicked()
}
}
void CrossSections::on_yzPlane_clicked()
void CrossSections::yzPlaneClicked()
{
Base::Vector3d c = bbox.GetCenter();
ui->position->setValue(c.x);
@@ -393,7 +416,7 @@ void CrossSections::on_yzPlane_clicked()
}
}
void CrossSections::on_position_valueChanged(double v)
void CrossSections::positionValueChanged(double v)
{
if (!ui->sectionsBox->isChecked()) {
calcPlane(plane(), v);
@@ -403,10 +426,10 @@ void CrossSections::on_position_valueChanged(double v)
}
}
void CrossSections::on_sectionsBox_toggled(bool b)
void CrossSections::sectionsBoxToggled(bool ok)
{
if (b) {
on_countSections_valueChanged(ui->countSections->value());
if (ok) {
countSectionsValueChanged(ui->countSections->value());
}
else {
CrossSections::Plane type = plane();
@@ -429,7 +452,7 @@ void CrossSections::on_sectionsBox_toggled(bool b)
}
}
void CrossSections::on_checkBothSides_toggled(bool b)
void CrossSections::checkBothSidesToggled(bool b)
{
double d = ui->distance->value().getValue();
d = b ? 2.0 * d : 0.5 * d;
@@ -437,7 +460,7 @@ void CrossSections::on_checkBothSides_toggled(bool b)
calcPlanes(plane());
}
void CrossSections::on_countSections_valueChanged(int v)
void CrossSections::countSectionsValueChanged(int v)
{
CrossSections::Plane type = plane();
double dist = 0;
@@ -458,7 +481,7 @@ void CrossSections::on_countSections_valueChanged(int v)
calcPlanes(type);
}
void CrossSections::on_distance_valueChanged(double)
void CrossSections::distanceValueChanged(double)
{
calcPlanes(plane());
}

View File

@@ -55,15 +55,16 @@ protected:
void changeEvent(QEvent *e) override;
void keyPressEvent(QKeyEvent*) override;
private Q_SLOTS:
void on_xyPlane_clicked();
void on_xzPlane_clicked();
void on_yzPlane_clicked();
void on_position_valueChanged(double);
void on_distance_valueChanged(double);
void on_countSections_valueChanged(int);
void on_checkBothSides_toggled(bool);
void on_sectionsBox_toggled(bool);
private:
void setupConnections();
void xyPlaneClicked();
void xzPlaneClicked();
void yzPlaneClicked();
void positionValueChanged(double);
void distanceValueChanged(double);
void countSectionsValueChanged(int);
void checkBothSidesToggled(bool);
void sectionsBoxToggled(bool);
private:
std::vector<double> getPlanes() const;

View File

@@ -38,6 +38,8 @@ CurveOnMeshWidget::CurveOnMeshWidget(Gui::View3DInventor* view, QWidget* parent)
, myView(view)
{
ui->setupUi(this);
connect(ui->startButton, &QPushButton::clicked,
this, &CurveOnMeshWidget::onStartButtonClicked);
this->setup();
}
@@ -74,7 +76,7 @@ void CurveOnMeshWidget::changeEvent(QEvent *e)
}
}
void CurveOnMeshWidget::on_startButton_clicked()
void CurveOnMeshWidget::onStartButtonClicked()
{
int cont = ui->continuity->itemData(ui->continuity->currentIndex()).toInt();
myCurveHandler->enableApproximation(ui->groupBox_2->isChecked());

View File

@@ -53,8 +53,8 @@ protected:
void changeEvent(QEvent *e) override;
void setup();
private Q_SLOTS:
void on_startButton_clicked();
private:
void onStartButtonClicked();
private:
Ui_TaskCurveOnMesh* ui;

View File

@@ -56,7 +56,7 @@ Tessellation::Tessellation(QWidget* parent)
{
ui->setupUi(this);
gmsh = new Mesh2ShapeGmsh(this);
connect(gmsh, &Mesh2ShapeGmsh::processed, this, &Tessellation::gmshProcessed);
setupConnections();
ui->stackedWidget->addTab(gmsh, tr("Gmsh"));
@@ -77,7 +77,7 @@ Tessellation::Tessellation(QWidget* parent)
ui->spinMaximumEdgeLength->setRange(0, INT_MAX);
ui->comboFineness->setCurrentIndex(2);
on_comboFineness_currentIndexChanged(2);
onComboFinenessCurrentIndexChanged(2);
#if !defined (HAVE_MEFISTO)
ui->stackedWidget->setTabEnabled(Mefisto, false);
@@ -100,12 +100,25 @@ Tessellation::~Tessellation()
{
}
void Tessellation::setupConnections()
{
connect(gmsh, &Mesh2ShapeGmsh::processed, this, &Tessellation::gmshProcessed);
connect(ui->estimateMaximumEdgeLength, &QPushButton::clicked,
this, &Tessellation::onEstimateMaximumEdgeLengthClicked);
connect(ui->comboFineness, qOverload<int>(&QComboBox::currentIndexChanged),
this, &Tessellation::onComboFinenessCurrentIndexChanged);
connect(ui->checkSecondOrder, &QCheckBox::toggled,
this, &Tessellation::onCheckSecondOrderToggled);
connect(ui->checkQuadDominated, &QCheckBox::toggled,
this, &Tessellation::onCheckQuadDominatedToggled);
}
void Tessellation::meshingMethod(int id)
{
ui->stackedWidget->setCurrentIndex(id);
}
void Tessellation::on_comboFineness_currentIndexChanged(int index)
void Tessellation::onComboFinenessCurrentIndexChanged(int index)
{
if (index == 5) {
ui->doubleGrading->setEnabled(true);
@@ -119,27 +132,27 @@ void Tessellation::on_comboFineness_currentIndexChanged(int index)
}
switch (index) {
case 0: // Very coarse
case VeryCoarse:
ui->doubleGrading->setValue(0.7);
ui->spinEdgeElements->setValue(0.3);
ui->spinCurvatureElements->setValue(1.0);
break;
case 1: // Coarse
case Coarse:
ui->doubleGrading->setValue(0.5);
ui->spinEdgeElements->setValue(0.5);
ui->spinCurvatureElements->setValue(1.5);
break;
case 2: // Moderate
case Moderate:
ui->doubleGrading->setValue(0.3);
ui->spinEdgeElements->setValue(1.0);
ui->spinCurvatureElements->setValue(2.0);
break;
case 3: // Fine
case Fine:
ui->doubleGrading->setValue(0.2);
ui->spinEdgeElements->setValue(2.0);
ui->spinCurvatureElements->setValue(3.0);
break;
case 4: // Very fine
case VeryFine:
ui->doubleGrading->setValue(0.1);
ui->spinEdgeElements->setValue(3.0);
ui->spinCurvatureElements->setValue(5.0);
@@ -149,13 +162,13 @@ void Tessellation::on_comboFineness_currentIndexChanged(int index)
}
}
void Tessellation::on_checkSecondOrder_toggled(bool on)
void Tessellation::onCheckSecondOrderToggled(bool on)
{
if (on)
ui->checkQuadDominated->setChecked(false);
}
void Tessellation::on_checkQuadDominated_toggled(bool on)
void Tessellation::onCheckQuadDominatedToggled(bool on)
{
if (on)
ui->checkSecondOrder->setChecked(false);
@@ -178,7 +191,7 @@ void Tessellation::changeEvent(QEvent *e)
QWidget::changeEvent(e);
}
void Tessellation::on_estimateMaximumEdgeLength_clicked()
void Tessellation::onEstimateMaximumEdgeLengthClicked()
{
App::Document* activeDoc = App::GetApplication().getActiveDocument();
if (!activeDoc) {

View File

@@ -75,6 +75,14 @@ class Tessellation : public QWidget
Gmsh
};
enum {
VeryCoarse = 0,
Coarse = 1,
Moderate = 2,
Fine = 3,
VeryFine = 4
};
public:
explicit Tessellation(QWidget* parent = nullptr);
~Tessellation() override;
@@ -91,12 +99,13 @@ protected:
QString getNetgenParameters() const;
std::vector<App::Color> getUniqueColors(const std::vector<App::Color>& colors) const;
private Q_SLOTS:
private:
void setupConnections();
void meshingMethod(int id);
void on_estimateMaximumEdgeLength_clicked();
void on_comboFineness_currentIndexChanged(int);
void on_checkSecondOrder_toggled(bool);
void on_checkQuadDominated_toggled(bool);
void onEstimateMaximumEdgeLengthClicked();
void onComboFinenessCurrentIndexChanged(int);
void onCheckSecondOrderToggled(bool);
void onCheckQuadDominatedToggled(bool);
void gmshProcessed();
private: