Improve Formula Wizard. Added additional radio button to separate increments

and preview calculations. ref #731.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-02 15:25:53 +03:00
parent d77acc524c
commit fd2f977e44
3 changed files with 41 additions and 3 deletions

View File

@ -319,8 +319,13 @@ void DialogEditWrongFormula::AngleLines()
*/ */
void DialogEditWrongFormula::Increments() void DialogEditWrongFormula::Increments()
{ {
ui->checkBoxHideEmpty->setEnabled(false); ShowIncrementsInPreviewCalculation(false);
ShowVariable(data->DataIncrements()); }
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::PreviewCalculations()
{
ShowIncrementsInPreviewCalculation(true);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -439,6 +444,9 @@ void DialogEditWrongFormula::InitVariables()
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEditWrongFormula::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEditWrongFormula::Increments);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, ClearFilterFormulaInputs); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonPC, &QRadioButton::clicked, this, &DialogEditWrongFormula::PreviewCalculations);
connect(ui->radioButtonPC, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthLines);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, ClearFilterFormulaInputs); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
@ -583,6 +591,27 @@ void DialogEditWrongFormula::ShowFunctions()
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::ShowIncrementsInPreviewCalculation(bool show)
{
ui->checkBoxHideEmpty->setEnabled(false);
QMap<QString, QSharedPointer<VIncrement> > increments;
const QMap<QString, QSharedPointer<VIncrement> > list = data->DataIncrements();
QMap<QString, QSharedPointer<VIncrement> >::const_iterator i = list.constBegin();
while (i != list.constEnd())
{
if(i.value()->IsPreviewCalculation() == show)
{
increments.insert(i.key(), i.value());
}
++i;
}
ShowVariable(increments);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::FilterVariablesEdited(const QString &filter) void DialogEditWrongFormula::FilterVariablesEdited(const QString &filter)
{ {

View File

@ -87,6 +87,7 @@ public slots:
void CurvesCLength(); void CurvesCLength();
void AngleLines(); void AngleLines();
void Increments(); void Increments();
void PreviewCalculations();
void Functions(); void Functions();
protected: protected:
virtual void CheckState() Q_DECL_FINAL; virtual void CheckState() Q_DECL_FINAL;
@ -116,6 +117,7 @@ private:
void ShowVariable(const QMap<key, val> &var); void ShowVariable(const QMap<key, val> &var);
void ShowMeasurements(const QMap<QString, QSharedPointer<VMeasurement> > &var); void ShowMeasurements(const QMap<QString, QSharedPointer<VMeasurement> > &var);
void ShowFunctions(); void ShowFunctions();
void ShowIncrementsInPreviewCalculation(bool show);
void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description); void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description);
}; };

View File

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>448</width> <width>448</width>
<height>425</height> <height>526</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -255,6 +255,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QRadioButton" name="radioButtonPC">
<property name="text">
<string>Preview calculations</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthLine"> <widget class="QRadioButton" name="radioButtonLengthLine">
<property name="enabled"> <property name="enabled">