| 29 | } |
| 30 | |
| 31 | virtual Variant data( const ModelIndex& index, ModelRole role = ModelRole::Display ) const { |
| 32 | eeASSERT( index.row() < (Int64)mData.size() ); |
| 33 | if ( mWidget == nullptr || index.row() >= (Int64)mData.size() ) |
| 34 | return {}; |
| 35 | PropertyId propId = mData[index.row()]; |
| 36 | auto propIt = mProps.find( propId ); |
| 37 | const PropertyDefinition* def = propIt != mProps.end() ? propIt->second : nullptr; |
| 38 | if ( !def ) |
| 39 | return {}; |
| 40 | if ( role == ModelRole::Display ) { |
| 41 | switch ( index.column() ) { |
| 42 | case 1: |
| 43 | return Variant( mWidget->getPropertyString( def ) ); |
| 44 | case 0: |
| 45 | default: |
| 46 | return Variant( def->getName().c_str() ); |
| 47 | } |
| 48 | } |
| 49 | return {}; |
| 50 | } |
| 51 | |
| 52 | CSSPropertiesModel() {} |
| 53 | |