MCPcopy Create free account
hub / github.com/SpartanJ/eepp / mapToProxy

Method mapToProxy

src/eepp/ui/models/sortingproxymodel.cpp:100–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100ModelIndex SortingProxyModel::mapToProxy( const ModelIndex& sourceIndex ) const {
101 if ( !sourceIndex.isValid() )
102 return {};
103
104 eeASSERT( sourceIndex.model() == mSource.get() );
105
106 auto sourceParent = sourceIndex.parent();
107 auto it = const_cast<SortingProxyModel*>( this )->buildMapping( sourceParent );
108
109 auto& mapping = *( it->second );
110
111 if ( sourceIndex.row() >= static_cast<int>( mapping.proxyRows.size() ) ||
112 sourceIndex.column() >= (Int64)columnCount() )
113 return {};
114
115 int proxyRow = mapping.proxyRows[sourceIndex.row()];
116 int proxyColumn = sourceIndex.column();
117 if ( proxyRow < 0 || proxyColumn < 0 )
118 return {};
119 return createIndex( proxyRow, proxyColumn, &mapping );
120}
121
122ModelRole SortingProxyModel::sortRole() const {
123 return mSortRole;

Callers

nothing calls this directly

Calls 8

columnCountFunction · 0.85
buildMappingMethod · 0.80
rowMethod · 0.80
columnMethod · 0.80
isValidMethod · 0.45
getMethod · 0.45
parentMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected