From fdc1eac7345041660aa4f82dded72d6f3016fffe Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 17 Oct 2016 14:53:46 +0300 Subject: [PATCH] Refactoring DialogTool::GetComboBoxCurrentData. Returned wrong default value. --HG-- branch : develop --- src/libs/vtools/dialogs/tools/dialogalongline.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogarc.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogbisector.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogendline.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogheight.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogline.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialognormal.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogspline.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogsplinepath.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 4 ++-- src/libs/vtools/dialogs/tools/dialogtool.h | 2 +- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index ee14c0525..93909f136 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -332,7 +332,7 @@ void DialogAlongLine::SetTypeLine(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogAlongLine::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -359,7 +359,7 @@ void DialogAlongLine::SetPointName(const QString &value) */ QString DialogAlongLine::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index a7f40d7b3..435cbccbc 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -164,7 +164,7 @@ void DialogArc::SetF2(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogArc::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index 02cb2de0e..d283430ad 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -192,7 +192,7 @@ void DialogArcWithLength::SetLength(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogArcWithLength::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index 070edd7d5..76e617c6d 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -313,7 +313,7 @@ void DialogBisector::SetThirdPointId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogBisector::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -355,7 +355,7 @@ void DialogBisector::closeEvent(QCloseEvent *event) */ QString DialogBisector::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp index 8a4fe49c2..0558c91e4 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp @@ -110,7 +110,7 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline) //--------------------------------------------------------------------------------------------------------------------- QString DialogCubicBezier::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp index 194415fb6..cf8a1f340 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp @@ -117,7 +117,7 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogCubicBezierPath::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp index a83349d8a..d4ae3165e 100644 --- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp @@ -108,7 +108,7 @@ void DialogCurveIntersectAxis::SetPointName(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogCurveIntersectAxis::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- @@ -178,7 +178,7 @@ void DialogCurveIntersectAxis::setCurveId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogCurveIntersectAxis::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index ae9f1622e..73a098eed 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -281,7 +281,7 @@ void DialogEndLine::SetBasePointId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogEndLine::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -375,7 +375,7 @@ DialogEndLine::~DialogEndLine() */ QString DialogEndLine::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogheight.cpp b/src/libs/vtools/dialogs/tools/dialogheight.cpp index e4b3c0880..cd710a1dd 100644 --- a/src/libs/vtools/dialogs/tools/dialogheight.cpp +++ b/src/libs/vtools/dialogs/tools/dialogheight.cpp @@ -164,7 +164,7 @@ void DialogHeight::SetP2LineId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogHeight::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -295,7 +295,7 @@ void DialogHeight::ShowVisualization() */ QString DialogHeight::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogline.cpp b/src/libs/vtools/dialogs/tools/dialogline.cpp index 7258a303f..69801ed13 100644 --- a/src/libs/vtools/dialogs/tools/dialogline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogline.cpp @@ -110,7 +110,7 @@ void DialogLine::SetTypeLine(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogLine::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -247,5 +247,5 @@ quint32 DialogLine::GetSecondPoint() const */ QString DialogLine::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index acd682196..698403ef7 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -121,7 +121,7 @@ void DialogLineIntersectAxis::SetPointName(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogLineIntersectAxis::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- @@ -207,7 +207,7 @@ void DialogLineIntersectAxis::SetSecondPointId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogLineIntersectAxis::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index 322f8abfc..992f25314 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -242,7 +242,7 @@ void DialogNormal::SetSecondPointId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogNormal::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -331,7 +331,7 @@ void DialogNormal::SetPointName(const QString &value) */ QString DialogNormal::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index d659aeac2..b25739dd8 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -267,7 +267,7 @@ void DialogShoulderPoint::SetP3(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogShoulderPoint::GetLineColor() const { - return GetComboBoxCurrentData(ui->comboBoxLineColor); + return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- @@ -354,7 +354,7 @@ void DialogShoulderPoint::SetPointName(const QString &value) */ QString DialogShoulderPoint::GetTypeLine() const { - return GetComboBoxCurrentData(ui->comboBoxLineType); + return GetComboBoxCurrentData(ui->comboBoxLineType, TypeLineLine); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index 3c3689ee5..f1075487b 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -614,7 +614,7 @@ void DialogSpline::SetSpline(const VSpline &spline) //--------------------------------------------------------------------------------------------------------------------- QString DialogSpline::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index b9be5f697..5d1aad667 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -172,7 +172,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value) //--------------------------------------------------------------------------------------------------------------------- QString DialogSplinePath::GetColor() const { - return GetComboBoxCurrentData(ui->comboBoxColor); + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 48a492a0c..3b844a682 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -302,7 +302,7 @@ void DialogTool::FillComboBoxHCrossCurvesPoint(QComboBox *box) const } //--------------------------------------------------------------------------------------------------------------------- -QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const +QString DialogTool::GetComboBoxCurrentData(const QComboBox *box, const QString &def) const { SCASSERT(box != nullptr) QString value; @@ -313,7 +313,7 @@ QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const #endif if (value.isEmpty()) { - value = TypeLineLine; + value = def; } return value; } diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index 53e4bbb1a..cc5d29af8 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -224,7 +224,7 @@ protected: void FillComboBoxHCrossCurvesPoint(QComboBox *box) const; virtual void CheckState(); - QString GetComboBoxCurrentData(const QComboBox *box)const; + QString GetComboBoxCurrentData(const QComboBox *box, const QString &def)const; void ChangeCurrentData(QComboBox *box, const QVariant &value) const; void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer, const QString &postfix = QString()); void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer,