| 98 | } |
| 99 | |
| 100 | ModelIndex 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 | |
| 122 | ModelRole SortingProxyModel::sortRole() const { |
| 123 | return mSortRole; |
nothing calls this directly
no test coverage detected