@@ -900,22 +900,27 @@ QgsFilledMarkerSymbolLayerWidget::QgsFilledMarkerSymbolLayerWidget( QgsVectorLay
900
900
if ( vectorLayer () )
901
901
mSizeDDBtn ->setSymbol ( mAssistantPreviewSymbol );
902
902
903
- QSize size = lstNames->iconSize ();
904
- double markerSize = DEFAULT_POINT_SIZE * 2 ;
905
- Q_FOREACH ( QgsSimpleMarkerSymbolLayerBase::Shape shape, QgsSimpleMarkerSymbolLayerBase::availableShapes () )
906
- {
907
- if ( !QgsSimpleMarkerSymbolLayerBase::shapeIsFilled ( shape ) )
908
- continue ;
903
+ int size = lstNames->iconSize ().width ();
904
+ size = std::max ( 30 , static_cast < int >( std::round ( Qgis::UI_SCALE_FACTOR * fontMetrics ().width ( QStringLiteral ( " XXX" ) ) ) ) );
905
+ lstNames->setGridSize ( QSize ( size * 1.2 , size * 1.2 ) );
906
+ lstNames->setIconSize ( QSize ( size, size ) );
909
907
908
+ double markerSize = size * 0.8 ;
909
+ const auto shapes = QgsSimpleMarkerSymbolLayerBase::availableShapes ();
910
+ for ( QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
911
+ {
910
912
QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer ( shape, markerSize );
913
+ lyr->setSizeUnit ( QgsUnitTypes::RenderPixels );
911
914
lyr->setColor ( QColor ( 200 , 200 , 200 ) );
912
915
lyr->setStrokeColor ( QColor ( 0 , 0 , 0 ) );
913
- QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon ( lyr, QgsUnitTypes::RenderMillimeters, size );
916
+ QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon ( lyr, QgsUnitTypes::RenderPixels, QSize ( size, size ) );
914
917
QListWidgetItem *item = new QListWidgetItem ( icon, QString (), lstNames );
915
918
item->setData ( Qt::UserRole, static_cast < int >( shape ) );
916
919
item->setToolTip ( QgsSimpleMarkerSymbolLayerBase::encodeShape ( shape ) );
917
920
delete lyr;
918
921
}
922
+ // show at least 3 rows
923
+ lstNames->setMinimumHeight ( lstNames->gridSize ().height () * 3.1 );
919
924
920
925
connect ( lstNames, &QListWidget::currentRowChanged, this , &QgsFilledMarkerSymbolLayerWidget::setShape );
921
926
connect ( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this , &QgsFilledMarkerSymbolLayerWidget::setSize );
0 commit comments