MCPcopy Create free account
hub / github.com/KDE/labplot / groupChanged

Method groupChanged

src/frontend/widgets/FunctionsWidget.cpp:79–101  ·  view source on GitHub ↗

! * shows all functions of the selected group and selects the first one in the QStringList */

Source from the content-addressed store, hash-verified

77 * shows all functions of the selected group and selects the first one in the QStringList
78 */
79void FunctionsWidget::groupChanged(int index) {
80 const auto d = ui.cbGroup->itemData(index);
81 if (d.isNull())
82 return; // separator selected
83
84 bool ok;
85 const auto groupIndex = static_cast<Parsing::FunctionGroups>(d.toInt(&ok));
86 if (!ok)
87 return;
88
89 static const QStringList& functions = m_expressionParser->functions();
90 static const QStringList& names = m_expressionParser->functionsDescriptions();
91 static const QVector<Parsing::FunctionGroups>& indices = m_expressionParser->functionsGroupIndices();
92
93 QDEBUG(Q_FUNC_INFO << ", index = " << Parsing::FunctionGroupsToString(groupIndex));
94
95 ui.lwFunctions->clear();
96 for (int i = 0; i < names.size(); ++i) {
97 if (indices.at(i) == groupIndex)
98 ui.lwFunctions->addItem(names.at(i) + QStringLiteral(" (") + functions.at(i) + QStringLiteral(")"));
99 }
100 ui.lwFunctions->setCurrentRow(0);
101}
102
103void FunctionsWidget::filterChanged(const QString& filter) {
104 if (!filter.isEmpty()) {

Callers 1

FunctionsWidgetMethod · 0.95

Calls 4

FunctionGroupsToStringFunction · 0.85
isNullMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected