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

Function cursorItemText

plugins/quickopen/quickopenplugin.cpp:216–248  ·  view source on GitHub ↗

Returns only the name, no template-parameters or scope

Source from the content-addressed store, hash-verified

214
215//Returns only the name, no template-parameters or scope
216QString cursorItemText()
217{
218 KDevelop::DUChainReadLocker lock(DUChain::lock());
219
220 Declaration* decl = cursorDeclaration();
221 if (!decl) {
222 return QString();
223 }
224
225 IDocument* doc = ICore::self()->documentController()->activeDocument();
226 if (!doc) {
227 return QString();
228 }
229
230 TopDUContext* context = DUChainUtils::standardContextForUrl(doc->url());
231
232 if (!context) {
233 qCDebug(PLUGIN_QUICKOPEN) << "Got no standard context";
234 return QString();
235 }
236
237 AbstractType::Ptr t = decl->abstractType();
238 auto* idType = dynamic_cast<IdentifiedType*>(t.data());
239 if (idType && idType->declaration(context)) {
240 decl = idType->declaration(context);
241 }
242
243 if (!decl->qualifiedIdentifier().isEmpty()) {
244 return decl->qualifiedIdentifier().last().identifier().str();
245 }
246
247 return QString();
248}
249
250QuickOpenLineEdit* QuickOpenPlugin::createQuickOpenLineWidget()
251{

Callers

nothing calls this directly

Calls 13

activeDocumentMethod · 0.80
documentControllerMethod · 0.80
strMethod · 0.80
cursorDeclarationFunction · 0.70
QStringClass · 0.50
urlMethod · 0.45
abstractTypeMethod · 0.45
dataMethod · 0.45
declarationMethod · 0.45
isEmptyMethod · 0.45
qualifiedIdentifierMethod · 0.45
identifierMethod · 0.45

Tested by

no test coverage detected