MCPcopy Create free account
hub / github.com/KDE/kdevelop / setFilterText

Method setFilterText

plugins/quickopen/actionsquickopenprovider.cpp:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void ActionsQuickOpenProvider::setFilterText(const QString& text)
68{
69 if (text.size() < 2) {
70 return;
71 }
72 m_results.clear();
73 const QList<KActionCollection*> collections = KActionCollection::allCollections();
74 QRegularExpression mnemonicRx(QStringLiteral("^(.*)&(.+)$"));
75 for (KActionCollection* c : collections) {
76 const QList<QAction*> actions = c->actions();
77 for (QAction* action : actions) {
78 if (!action->isEnabled()) {
79 continue;
80 }
81
82 QString display = action->text();
83 QRegularExpressionMatch match = mnemonicRx.match(display);
84 if (match.hasMatch()) {
85 display = match.capturedView(1) + match.capturedView(2);
86 }
87
88 if (display.contains(text, Qt::CaseInsensitive)) {
89 m_results += QuickOpenDataPointer(new ActionsQuickOpenItem(display, action));
90 }
91 }
92 }
93}
94
95uint ActionsQuickOpenProvider::unfilteredItemCount() const
96{

Callers

nothing calls this directly

Calls 8

hasMatchMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
actionsMethod · 0.45
isEnabledMethod · 0.45
textMethod · 0.45
matchMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected