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

Method data

plugins/modelinspector/modelcontentproxymodel.cpp:54–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54QVariant ModelContentProxyModel::data(const QModelIndex &proxyIndex, int role) const
55{
56 // we override this below, so convey enabled state via a custom role
57 // since disabled is less common then enabled, only transfer disabled states
58 if (role == DisabledRole) {
59 if (QIdentityProxyModel::flags(proxyIndex) & Qt::ItemIsEnabled)
60 return QVariant();
61 return true;
62 }
63
64 if (role == SelectedRole) {
65 if (m_selectionModel && m_selectionModel->isSelected(mapToSource(proxyIndex)))
66 return true;
67 return QVariant();
68 }
69
70 // we set the EmptyNameRole to signal this index is unnamed to the delegate
71 if (role == IsDisplayStringEmptyRole) {
72 return QIdentityProxyModel::data(proxyIndex, Qt::DisplayRole).toString().isNull();
73 }
74
75 return QIdentityProxyModel::data(proxyIndex, role);
76}
77
78Qt::ItemFlags ModelContentProxyModel::flags(const QModelIndex &index) const
79{

Callers 1

setSelectionModelMethod · 0.45

Calls 2

QVariantClass · 0.50
isNullMethod · 0.45

Tested by

no test coverage detected