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

Method expandingWidget

plugins/quickopen/projectfilequickopen.cpp:135–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135QWidget* ProjectFileData::expandingWidget() const
136{
137 const QUrl url = m_file.path.toUrl();
138 DUChainReadLocker lock;
139
140 ///Find a du-chain for the document
141 const QList<TopDUContext*> contexts = DUChain::self()->chainsForDocument(url);
142
143 ///Pick a non-proxy context
144 TopDUContext* chosen = nullptr;
145 for (TopDUContext* ctx : contexts) {
146 if (!(ctx->parsingEnvironmentFile() && ctx->parsingEnvironmentFile()->isProxyContext())) {
147 chosen = ctx;
148 }
149 }
150
151 if (chosen) {
152 // TODO: show project name, by introducing a generic wrapper widget that supports QuickOpenEmbeddedWidgetInterface
153 return chosen->createNavigationWidget();
154 } else {
155 auto* ret = new QTextBrowser();
156 ret->resize(400, 100);
157 ret->setText(
158 QLatin1String("<small><small>")
159 + i18nc("%1: project name", "Project %1", project())
160 + QLatin1String("<br>") + i18n("Not parsed yet")
161 + QLatin1String("</small></small>"));
162 return ret;
163 }
164
165 return nullptr;
166}
167
168QIcon ProjectFileData::icon() const
169{

Callers 2

dataMethod · 0.45
eventFilterMethod · 0.45

Calls 6

chainsForDocumentMethod · 0.80
isProxyContextMethod · 0.80
toUrlMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected