Skip to content
Permalink
Browse files

Use a hacky generic icon for 3d symbols in style manager for now

Because implementing proper thumbnails is a considerable task in itself...
  • Loading branch information
nyalldawson committed Jul 29, 2020
1 parent a3e1d0c commit d30a44d7ac3b2f79a602f9ecd153707f37a75021
Showing with 21 additions and 2 deletions.
  1. +20 −1 src/core/symbology/qgsstylemodel.cpp
  2. +1 −1 tests/src/python/test_qgsstylemodel.py
@@ -316,9 +316,28 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const
return icon;
}

case QgsStyle::Symbol3DEntity:
{
// hack for now -- we just use a generic "3d icon" svg file.
// TODO - render proper thumbnails

// use cached icon if possible
QIcon icon = mIconCache[ entityType ].value( name );
if ( !icon.isNull() )
return icon;

if ( mAdditionalSizes.isEmpty() )
icon.addFile( QgsApplication::defaultThemePath() + QDir::separator() + QStringLiteral( "3d.svg" ), QSize( 24, 24 ) );
for ( const QSize &s : mAdditionalSizes )
{
icon.addFile( QgsApplication::defaultThemePath() + QDir::separator() + QStringLiteral( "3d.svg" ), s );
}
mIconCache[ entityType ].insert( name, icon );
return icon;
}

case QgsStyle::TagEntity:
case QgsStyle::SmartgroupEntity:
case QgsStyle::Symbol3DEntity:
return QVariant();
}
break;
@@ -630,7 +630,7 @@ def test_mixed_style(self):
# decorations
self.assertIsNone(model.data(model.index(-1, 0), Qt.DecorationRole))
self.assertIsNone(model.data(model.index(0, 1), Qt.DecorationRole))
self.assertIsNone(model.data(model.index(17, 0), Qt.DecorationRole))
self.assertIsNone(model.data(model.index(20, 0), Qt.DecorationRole))
self.assertFalse(model.data(model.index(0, 0), Qt.DecorationRole).isNull())
self.assertFalse(model.data(model.index(5, 0), Qt.DecorationRole).isNull())
self.assertFalse(model.data(model.index(8, 0), Qt.DecorationRole).isNull())

0 comments on commit d30a44d

Please sign in to comment.
You can’t perform that action at this time.