| 25 | size_t columnCount( const ModelIndex& ) const override { return 2; } |
| 26 | |
| 27 | Variant data( const ModelIndex& index, ModelRole role ) const override { |
| 28 | if ( index.row() >= (Int64)mInfo.size() ) |
| 29 | return {}; |
| 30 | if ( role == ModelRole::Display ) { |
| 31 | switch ( index.column() ) { |
| 32 | case 0: |
| 33 | return Variant( mInfo[index.row()].name.c_str() ); |
| 34 | case 1: { |
| 35 | if ( mDisplayLine ) { |
| 36 | std::string detail( !mInfo[index.row()].detail.empty() |
| 37 | ? mInfo[index.row()].detail + " (" + |
| 38 | mInfo[index.row()].range.toString() + ")" |
| 39 | : mInfo[index.row()].range.toString() ); |
| 40 | return Variant( detail ); |
| 41 | } else { |
| 42 | return Variant( mInfo[index.row()].url.getFSPath() ); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } else if ( role == ModelRole::Icon && index.column() == 0 ) { |
| 47 | return mUISceneNode->findIcon( |
| 48 | LSPSymbolKindHelper::toIconString( mInfo[index.row()].kind ) ); |
| 49 | } else if ( role == ModelRole::Custom && index.column() == 1 ) { |
| 50 | return Variant( mInfo[index.row()].range.toString() ); |
| 51 | } |
| 52 | return {}; |
| 53 | } |
| 54 | |
| 55 | const LSPSymbolInformationList& getInfo() const { return mInfo; } |
| 56 | |