@@ -968,23 +968,27 @@ QgsFilledMarkerSymbolLayerWidget::QgsFilledMarkerSymbolLayerWidget( QgsVectorLay
968
968
if ( vectorLayer () )
969
969
mSizeDDBtn ->setSymbol ( mAssistantPreviewSymbol );
970
970
971
- QSize size = lstNames->iconSize ();
972
- double markerSize = DEFAULT_POINT_SIZE * 2 ;
973
- const auto shapes { QgsSimpleMarkerSymbolLayerBase::availableShapes () };
971
+ int size = lstNames->iconSize ().width ();
972
+ size = std::max ( 30 , static_cast < int >( std::round ( Qgis::UI_SCALE_FACTOR * fontMetrics ().width ( QStringLiteral ( " XXX" ) ) ) ) );
973
+ lstNames->setGridSize ( QSize ( size * 1.2 , size * 1.2 ) );
974
+ lstNames->setIconSize ( QSize ( size, size ) );
975
+
976
+ double markerSize = size * 0.8 ;
977
+ const auto shapes = QgsSimpleMarkerSymbolLayerBase::availableShapes ();
974
978
for ( QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
975
979
{
976
- if ( !QgsSimpleMarkerSymbolLayerBase::shapeIsFilled ( shape ) )
977
- continue ;
978
-
979
980
QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer ( shape, markerSize );
981
+ lyr->setSizeUnit ( QgsUnitTypes::RenderPixels );
980
982
lyr->setColor ( QColor ( 200 , 200 , 200 ) );
981
983
lyr->setStrokeColor ( QColor ( 0 , 0 , 0 ) );
982
- QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon ( lyr, QgsUnitTypes::RenderMillimeters, size );
984
+ QIcon icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon ( lyr, QgsUnitTypes::RenderPixels, QSize ( size, size ) );
983
985
QListWidgetItem *item = new QListWidgetItem ( icon, QString (), lstNames );
984
986
item->setData ( Qt::UserRole, static_cast < int >( shape ) );
985
987
item->setToolTip ( QgsSimpleMarkerSymbolLayerBase::encodeShape ( shape ) );
986
988
delete lyr;
987
989
}
990
+ // show at least 3 rows
991
+ lstNames->setMinimumHeight ( lstNames->gridSize ().height () * 3.1 );
988
992
989
993
connect ( lstNames, &QListWidget::currentRowChanged, this , &QgsFilledMarkerSymbolLayerWidget::setShape );
990
994
connect ( spinSize, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this , &QgsFilledMarkerSymbolLayerWidget::setSize );
0 commit comments