Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-07-20 08:29:59 +03:00
parent 672278209d
commit 22d21a867a
2 changed files with 35 additions and 29 deletions

View File

@ -406,19 +406,9 @@ void DialogSetupMultisize::ZDimensionBodyMeasurementChanged()
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::CheckState()
{
ui->labelError->clear();
bool xDimensionValid = true;
bool yDimensionValid = true;
bool wDimensionValid = true;
bool zDimensionValid = true;
int dimensions = 0;
auto CheckDimension = [this](QGroupBox *group, QGroupBox *nameGroup, QLineEdit *lineEdit, bool &dimensionValid,
int &dimensions, const MeasurementDimension_p &dimension)
void DialogSetupMultisize::CheckDimension(QGroupBox *group, QGroupBox *nameGroup, QLineEdit *lineEdit,
bool &dimensionValid, int &dimensions,
const MeasurementDimension_p &dimension)
{
SCASSERT(group != nullptr)
SCASSERT(nameGroup != nullptr)
@ -444,7 +434,19 @@ void DialogSetupMultisize::CheckState()
}
}
}
};
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::CheckState()
{
ui->labelError->clear();
bool xDimensionValid = true;
bool yDimensionValid = true;
bool wDimensionValid = true;
bool zDimensionValid = true;
int dimensions = 0;
CheckDimension(ui->groupBoxXDimension, ui->groupBoxCustomXDimensionName, ui->lineEditCustomXDimensionName,
xDimensionValid, dimensions, m_xDimension);

View File

@ -38,6 +38,8 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class QDoubleSpinBox;
class QGroupBox;
class QLineEdit;
namespace Ui
{
@ -76,6 +78,8 @@ private:
QSharedPointer<VWMeasurementDimension> m_wDimension;
QSharedPointer<VZMeasurementDimension> m_zDimension;
void CheckDimension(QGroupBox *group, QGroupBox *nameGroup, QLineEdit *lineEdit, bool &dimensionValid,
int &dimensions, const MeasurementDimension_p &dimension);
void CheckState();
void InitDimensionMinMax(QDoubleSpinBox *doubleSpinBoxMinValue, QDoubleSpinBox *doubleSpinBoxMaxValue,