Skip to content
Permalink
Browse files

Show simple marker symbol name in tooltip

  • Loading branch information
nyalldawson committed Apr 4, 2016
1 parent dae423d commit ad16fb47909b4e94b16ecdea8a49fbe65f1cc46d
@@ -49,19 +49,18 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLay
names << "circle" << "rectangle" << "cross" << "triangle";
QSize iconSize = mShapeListWidget->iconSize();

QStringList::const_iterator nameIt = names.constBegin();
for ( ; nameIt != names.constEnd(); ++nameIt )
Q_FOREACH ( const QString& name, names )
{
QgsEllipseSymbolLayerV2* lyr = new QgsEllipseSymbolLayerV2();
lyr->setSymbolName( *nameIt );
lyr->setSymbolName( name );
lyr->setOutlineColor( QColor( 0, 0, 0 ) );
lyr->setFillColor( QColor( 200, 200, 200 ) );
lyr->setSymbolWidth( 4 );
lyr->setSymbolHeight( 2 );
QIcon icon = QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( lyr, QgsSymbolV2::MM, iconSize );
QListWidgetItem* item = new QListWidgetItem( icon, "", mShapeListWidget );
item->setToolTip( *nameIt );
item->setData( Qt::UserRole, *nameIt );
item->setToolTip( name );
item->setData( Qt::UserRole, name );
delete lyr;
}

@@ -443,12 +443,13 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star"
<< "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle";
double markerSize = DEFAULT_POINT_SIZE * 2;
for ( int i = 0; i < names.count(); ++i )
Q_FOREACH ( const QString& name, names )
{
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ), QColor( 0, 0, 0 ), markerSize );
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( name, QColor( 200, 200, 200 ), QColor( 0, 0, 0 ), markerSize );
QIcon icon = QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( lyr, QgsSymbolV2::MM, size );
QListWidgetItem* item = new QListWidgetItem( icon, QString(), lstNames );
item->setData( Qt::UserRole, names[i] );
item->setData( Qt::UserRole, name );
item->setToolTip( name );
delete lyr;
}

0 comments on commit ad16fb4

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