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

Method data

plugins/quickopen/quickopenmodel.cpp:290–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290QVariant QuickOpenModel::data(const QModelIndex& index, int role) const
291{
292 QuickOpenDataPointer d = getItem(index.row());
293
294 if (!d) {
295 return QVariant();
296 }
297
298 switch (role) {
299 case KTextEditor::CodeCompletionModel::ItemSelected: {
300 QString desc = d->htmlDescription();
301 if (desc.isEmpty()) {
302 return QVariant();
303 } else {
304 return desc;
305 }
306 }
307
308 case KTextEditor::CodeCompletionModel::IsExpandable:
309 return d->isExpandable();
310 case KTextEditor::CodeCompletionModel::ExpandingWidget: {
311 QWidget* w = d->expandingWidget();
312 if (w && m_expandingWidgetHeightIncrease) {
313 w->resize(w->width(), w->height() + m_expandingWidgetHeightIncrease);
314 }
315 return QVariant::fromValue(w);
316 }
317 case ExpandingTree::ProjectPathRole:
318 // TODO: put this into the QuickOpenDataBase API
319 // we cannot do this in 5.0, cannot change ABI
320 if (auto projectFile = dynamic_cast<const ProjectFileData*>(d.constData())) {
321 return QVariant::fromValue(projectFile->projectPath());
322 } else if (auto duchainItem = dynamic_cast<const DUChainItemData*>(d.constData())) {
323 return QVariant::fromValue(duchainItem->projectPath());
324 }
325 }
326
327 if (index.column() == 1) { //This column contains the actual content
328 switch (role) {
329 case Qt::DecorationRole:
330 return d->icon();
331
332 case Qt::DisplayRole:
333 return d->text();
334 case KTextEditor::CodeCompletionModel::HighlightingMethod:
335 return KTextEditor::CodeCompletionModel::CustomHighlighting;
336 case KTextEditor::CodeCompletionModel::CustomHighlight:
337 return d->highlighting();
338 }
339 } else if (index.column() == 0) { //This column only contains the expanded/not expanded icon
340 switch (role) {
341 case Qt::DecorationRole:
342 {
343 if (isExpandable(index)) {
344 //Show the expanded/unexpanded handles
345 if (isExpanded(index)) {
346 return QIcon::fromTheme(QStringLiteral("arrow-down"));
347 } else {

Callers 8

cursorItemTextFunction · 0.45
contextMenuExtensionMethod · 0.45
jumpToNearestFunctionMethod · 0.45
focusInEventMethod · 0.45
getItemMethod · 0.45
createHighlightingMethod · 0.45
documentationForIndexMethod · 0.45

Calls 13

isExpandedFunction · 0.85
QVariantClass · 0.50
dataFunction · 0.50
rowMethod · 0.45
htmlDescriptionMethod · 0.45
isEmptyMethod · 0.45
isExpandableMethod · 0.45
expandingWidgetMethod · 0.45
projectPathMethod · 0.45
columnMethod · 0.45
iconMethod · 0.45
textMethod · 0.45

Tested by 1