MCPcopy Create free account
hub / github.com/KDAB/GammaRay / data

Method data

plugins/qmlsupport/qmlcontextmodel.cpp:78–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78QVariant QmlContextModel::data(const QModelIndex &index, int role) const
79{
80 if (m_contexts.isEmpty() || !index.isValid())
81 return QVariant();
82
83 if (role == Qt::DisplayRole) {
84 auto context = m_contexts.at(index.row());
85 switch (index.column()) {
86 case 0:
87 return Util::shortDisplayString(context);
88 case 1:
89 if (context->baseUrl().scheme() == QLatin1String("file")) // ### use SourceLocation for this!
90 return context->baseUrl().path();
91 return context->baseUrl().toString();
92 }
93 } else if (role == ObjectModel::ObjectRole) {
94 return QVariant::fromValue(m_contexts.at(index.row()));
95 }
96
97 return QVariant();
98}
99
100QVariant QmlContextModel::headerData(int section, Qt::Orientation orientation, int role) const
101{

Callers 7

qmlListPropertyToStringFunction · 0.45
countMethod · 0.45
propertyDataMethod · 0.45
contextSelectedMethod · 0.45
contextMenuMethod · 0.45
contextContextMenuMethod · 0.45
propertiesContextMenuMethod · 0.45

Calls 6

rowMethod · 0.80
columnMethod · 0.80
pathMethod · 0.80
QVariantClass · 0.50
isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected