Resolved Issue #424. Improve Formula Wizard dialog.

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-08-16 23:13:34 +03:00
parent 0ece6cee6c
commit 09a9ec2855
5 changed files with 61 additions and 0 deletions

View File

@ -946,3 +946,9 @@ void VTranslateVars::Retranslate()
InitFunctions(); InitFunctions();
InitPostfixOperators(); InitPostfixOperators();
} }
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QmuTranslation> VTranslateVars::GetFunctions() const
{
return functions;
}

View File

@ -61,6 +61,7 @@ public:
QString FormulaToUser(const QString &formula, bool osSeparator) const; QString FormulaToUser(const QString &formula, bool osSeparator) const;
virtual void Retranslate() Q_DECL_OVERRIDE; virtual void Retranslate() Q_DECL_OVERRIDE;
QMap<QString, qmu::QmuTranslation> GetFunctions() const;
private: private:
Q_DISABLE_COPY(VTranslateVars) Q_DISABLE_COPY(VTranslateVars)

View File

@ -217,6 +217,11 @@ void DialogEditWrongFormula::ValChanged(int row)
degreeSymbol, tr("Curve angle")); degreeSymbol, tr("Curve angle"));
return; return;
} }
if (ui->radioButtonFunctions->isChecked())
{
ui->labelDescription->setText(item->toolTip());
return;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -309,6 +314,16 @@ void DialogEditWrongFormula::Increments()
ShowVariable(data->DataIncrements()); ShowVariable(data->DataIncrements());
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Functions show in list functions
*/
void DialogEditWrongFormula::Functions()
{
ui->checkBoxHideEmpty->setEnabled(false);
ShowFunctions();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CheckState() void DialogEditWrongFormula::CheckState()
{ {
@ -384,6 +399,7 @@ void DialogEditWrongFormula::InitVariables()
connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements);
connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs); connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs);
connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves); connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves);
connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -477,3 +493,32 @@ void DialogEditWrongFormula::ShowMeasurements(const QMap<QString, QSharedPointer
ui->tableWidget->selectRow(0); ui->tableWidget->selectRow(0);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowFunctions show functions in list
*/
void DialogEditWrongFormula::ShowFunctions()
{
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(0);
ui->tableWidget->setColumnHidden(ColumnFullName, true);
ui->labelDescription->setText("");
QMap<QString, qmu::QmuTranslation> var = qApp->TrVars()->GetFunctions();
QMapIterator<QString, qmu::QmuTranslation> iMap(var);
while (iMap.hasNext())
{
iMap.next();
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *item = new QTableWidgetItem(iMap.key());
item->setFont(QFont("Times", 12, QFont::Bold));
ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item);
item->setToolTip(iMap.value().getMdisambiguation());
}
ui->tableWidget->blockSignals(false);
ui->tableWidget->selectRow(0);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}

View File

@ -90,6 +90,7 @@ public slots:
void LengthCurves(); void LengthCurves();
void AngleLines(); void AngleLines();
void Increments(); void Increments();
void Functions();
protected: protected:
virtual void CheckState() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
@ -113,6 +114,7 @@ private:
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 ShowMeasurements(const QMap<QString, QSharedPointer<VMeasurement> > &var); void ShowMeasurements(const QMap<QString, QSharedPointer<VMeasurement> > &var);
void ShowFunctions();
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

@ -329,6 +329,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QRadioButton" name="radioButtonFunctions">
<property name="text">
<string>Functions</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>