! * shows all constants of the selected group and selects the first one in the QStringList */
| 65 | * shows all constants of the selected group and selects the first one in the QStringList |
| 66 | */ |
| 67 | void ConstantsWidget::groupChanged(int index) { |
| 68 | static const QStringList& constants = m_expressionParser->constants(); |
| 69 | static const QStringList& names = m_expressionParser->constantsNames(); |
| 70 | static const QVector<Parsing::ConstantGroups>& indices = m_expressionParser->constantsGroupIndices(); |
| 71 | |
| 72 | const auto group = static_cast<Parsing::ConstantGroups>(ui.cbGroup->itemData(index).toInt()); |
| 73 | |
| 74 | ui.lwConstants->clear(); |
| 75 | for (int i = 0; i < names.size(); ++i) { |
| 76 | if (indices.at(i) == group) |
| 77 | ui.lwConstants->addItem(names.at(i) + QStringLiteral(" (") + constants.at(i) + QStringLiteral(")")); |
| 78 | } |
| 79 | ui.lwConstants->setCurrentRow(0); |
| 80 | } |
| 81 | |
| 82 | void ConstantsWidget::filterChanged(const QString& filter) { |
| 83 | if (!filter.isEmpty()) { |
no test coverage detected