Fix bug 225

https://qelectrotech.org/bugtracker/view.php?id=225
This commit is contained in:
joshua
2021-02-06 19:41:22 +01:00
parent 2513961cd6
commit b335a4af4f
3 changed files with 18 additions and 4 deletions

View File

@@ -105,6 +105,14 @@ QHash<QString, QString> QETInformation::folioReportInfoKeyToVar()
return H_; return H_;
} }
QString QETInformation::folioReportInfoToVar(const QString &info)
{
if (QETInformation::folioReportInfoKeys().contains(info))
return infoToVar(info);
else
return (QString ("%{void}"));
}
QStringList QETInformation::conductorInfoKeys() QStringList QETInformation::conductorInfoKeys()
{ {
QStringList list = { COND_FORMULA, QStringList list = { COND_FORMULA,

View File

@@ -99,6 +99,7 @@ namespace QETInformation
QStringList folioReportInfoKeys(); QStringList folioReportInfoKeys();
QHash <QString, QString> folioReportInfoKeyToVar(); QHash <QString, QString> folioReportInfoKeyToVar();
QString folioReportInfoToVar(const QString &info);
QStringList conductorInfoKeys(); QStringList conductorInfoKeys();
QStringList diagramInfoKeys(); QStringList diagramInfoKeys();

View File

@@ -53,10 +53,14 @@ QString CompositeTextEditDialog::plainText() const
void CompositeTextEditDialog::setUpComboBox() void CompositeTextEditDialog::setUpComboBox()
{ {
QStringList qstrl; QStringList qstrl;
bool is_report = false;
if(m_text && (m_text->parentElement()->linkType() & Element::AllReport)) //Special treatment for text owned by a folio report if (m_text && m_text->parentElement()->linkType() & Element::AllReport) {
is_report = true;
}
if(is_report) //Special treatment for text owned by a folio report
{ {
qstrl << "label" << "function" << "tension_protocol" << "conductor_color" << "conductor_section"; qstrl = QETInformation::folioReportInfoKeys();
} }
else else
{ {
@@ -68,7 +72,8 @@ void CompositeTextEditDialog::setUpComboBox()
//the value of the combo box are always alphabetically sorted //the value of the combo box are always alphabetically sorted
QMap <QString, QString> info_map; QMap <QString, QString> info_map;
for(const QString& str : qstrl) { for(const QString& str : qstrl) {
info_map.insert(QETInformation::translatedInfoKey(str), QETInformation::elementInfoToVar(str)); info_map.insert(QETInformation::translatedInfoKey(str),
is_report ? QETInformation::folioReportInfoToVar(str) : QETInformation::elementInfoToVar(str));
} }
for(const QString& key : info_map.keys()) { for(const QString& key : info_map.keys()) {
ui->m_info_cb->addItem(key, info_map.value(key)); ui->m_info_cb->addItem(key, info_map.value(key));