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

Method contextMenuExtension

plugins/clangtidy/tests/data/plugin.cpp:250–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250KDevelop::ContextMenuExtension Plugin::contextMenuExtension(KDevelop::Context* context)
251{
252 KDevelop::IDocument* doc = core()->documentController()->activeDocument();
253 KDevelop::ContextMenuExtension extension = KDevelop::IPlugin::contextMenuExtension(context);
254
255 if (context->type() == KDevelop::Context::EditorContext) {
256
257 auto mime = doc->mimeType().name();
258 if (mime == QLatin1String("text/x-c++src") || mime == QLatin1String("text/x-csrc")) {
259 QAction* action
260 = new QAction(QIcon::fromTheme("document-new"), i18n("Check current unit with clang-tidy"), this);
261 connect(action, SIGNAL(triggered(bool)), this, SLOT(runClangTidyFile()));
262 extension.addAction(KDevelop::ContextMenuExtension::AnalyzeGroup, action);
263 }
264 }
265 return extension;
266}
267
268KDevelop::ConfigPage* Plugin::perProjectConfigPage(int number, const ProjectConfigOptions& options, QWidget* parent)
269{

Callers

nothing calls this directly

Calls 6

activeDocumentMethod · 0.80
documentControllerMethod · 0.80
typeMethod · 0.45
nameMethod · 0.45
mimeTypeMethod · 0.45
addActionMethod · 0.45

Tested by

no test coverage detected