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

Method data

kdevplatform/project/projectmodel.cpp:966–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

964}
965
966QVariant ProjectModel::data( const QModelIndex& index, int role ) const
967{
968 static const QSet<int> allowedRoles = {
969 Qt::DisplayRole,
970 Qt::ToolTipRole,
971 Qt::DecorationRole,
972 ProjectItemRole,
973 ProjectRole,
974 UrlRole
975 };
976 if( allowedRoles.contains(role) && index.isValid() ) {
977 ProjectBaseItem* item = itemFromIndex( index );
978 if( item ) {
979 switch(role) {
980 case Qt::DecorationRole:
981 return QIcon::fromTheme(item->iconName());
982 case Qt::ToolTipRole:
983 return item->path().pathOrUrl();
984 case Qt::DisplayRole:
985 return item->text();
986 case ProjectItemRole:
987 return QVariant::fromValue<ProjectBaseItem*>(item);
988 case UrlRole:
989 return item->path().toUrl();
990 case ProjectRole:
991 return QVariant::fromValue<QObject*>(item->project());
992 }
993 }
994 }
995 return QVariant();
996}
997
998ProjectModel::ProjectModel( QObject *parent )
999 : QAbstractItemModel(parent)

Callers 14

validateMethod · 0.45
findItemChildFunction · 0.45
debugItemModelFunction · 0.45
testCreateTargetItemsMethod · 0.45
testItemSanityMethod · 0.45
testTakeRowMethod · 0.45
testRenameMethod · 0.45
testWithProjectMethod · 0.45
testProjectProxyModelMethod · 0.45

Calls 9

pathOrUrlMethod · 0.80
QVariantClass · 0.50
containsMethod · 0.45
isValidMethod · 0.45
iconNameMethod · 0.45
pathMethod · 0.45
textMethod · 0.45
toUrlMethod · 0.45
projectMethod · 0.45

Tested by 10

debugItemModelFunction · 0.36
testCreateTargetItemsMethod · 0.36
testItemSanityMethod · 0.36
testTakeRowMethod · 0.36
testRenameMethod · 0.36
testWithProjectMethod · 0.36
testProjectProxyModelMethod · 0.36
testProjectFileSetMethod · 0.36