Set line color for dialog tool " point along line".

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-02 13:55:42 +02:00
parent 9381cc78a6
commit d41308e1f4
12 changed files with 30 additions and 29 deletions

View File

@ -43,7 +43,7 @@
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0), :DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0),
typeLine(QString()), formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0), typeLine(QString()), formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0),
line(nullptr) line(nullptr), lineColor(VAbstractTool::ColorBlack)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);
@ -249,10 +249,23 @@ void DialogAlongLine::setFormula(const QString &value)
void DialogAlongLine::setTypeLine(const QString &value) void DialogAlongLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }
//---------------------------------------------------------------------------------------------------------------------
QString DialogAlongLine::getLineColor() const
{
return lineColor;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setLineColor(const QString &value)
{
lineColor = value;
ChangeCurrentData(ui->comboBoxLineColor, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setPointName set name of point * @brief setPointName set name of point

View File

@ -53,6 +53,9 @@ public:
QString getTypeLine() const; QString getTypeLine() const;
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getLineColor() const;
void setLineColor(const QString &value);
QString getFormula() const; QString getFormula() const;
void setFormula(const QString &value); void setFormula(const QString &value);
@ -103,6 +106,8 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
VisToolAlongLine *line; VisToolAlongLine *line;
QString lineColor;
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -218,7 +218,7 @@ void DialogBisector::setPointName(const QString &value)
void DialogBisector::setTypeLine(const QString &value) void DialogBisector::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -103,7 +103,7 @@ QString DialogCurveIntersectAxis::getTypeLine() const
void DialogCurveIntersectAxis::setTypeLine(const QString &value) void DialogCurveIntersectAxis::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -173,7 +173,7 @@ void DialogEndLine::setPointName(const QString &value)
void DialogEndLine::setTypeLine(const QString &value) void DialogEndLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -97,7 +97,7 @@ void DialogHeight::setPointName(const QString &value)
void DialogHeight::setTypeLine(const QString &value) void DialogHeight::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -96,7 +96,7 @@ void DialogLine::setSecondPoint(const quint32 &value)
void DialogLine::setTypeLine(const QString &value) void DialogLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -112,7 +112,7 @@ QString DialogLineIntersectAxis::getTypeLine() const
void DialogLineIntersectAxis::setTypeLine(const QString &value) void DialogLineIntersectAxis::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -255,7 +255,7 @@ void DialogNormal::setFormula(const QString &value)
void DialogNormal::setTypeLine(const QString &value) void DialogNormal::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -283,7 +283,7 @@ void DialogShoulderPoint::setFormula(const QString &value)
void DialogShoulderPoint::setTypeLine(const QString &value) void DialogShoulderPoint::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine)); line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
} }

View File

@ -374,29 +374,13 @@ QString DialogTool::GetLineColor(const QComboBox *box) const
return value; return value;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetupTypeLine setupe type of line
* @param box combobox
* @param value string from pattern file
*/
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value)
{
SCASSERT(box != nullptr)
const qint32 index = box->findData(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ChangeCurrentData select item in combobox by id * @brief ChangeCurrentData select item in combobox by id
* @param box combobox * @param box combobox
* @param value id of item * @param value id of item
*/ */
void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const
{ {
SCASSERT(box != nullptr) SCASSERT(box != nullptr)
const qint32 index = box->findData(value); const qint32 index = box->findData(value);

View File

@ -224,8 +224,7 @@ protected:
QString GetLineColor(const QComboBox *box)const; QString GetLineColor(const QComboBox *box)const;
template <class key, class val> template <class key, class val>
void ShowVariable(const QMap<key, val> var); void ShowVariable(const QMap<key, val> var);
void SetupTypeLine(QComboBox *box, const QString &value); void ChangeCurrentData(QComboBox *box, const QVariant &value) const;
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget); void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget); void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer); void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);