Skip to content

Commit

Permalink
[ui] Disable fill color for stroke-only ellipse symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Mar 18, 2021
1 parent 4791fc4 commit 6d64fab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Expand Up @@ -51,7 +51,7 @@ Creates the symbol layer
void setSymbolName( const QString &name );
QString symbolName() const;

bool shapeIsFilled( const QString &symbolName ) const;
static bool shapeIsFilled( const QString &symbolName );
%Docstring
Returns ``True`` if a shape has a fill.

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgsellipsesymbollayer.cpp
Expand Up @@ -669,7 +669,7 @@ void QgsEllipseSymbolLayer::preparePath( const QString &symbolName, QgsSymbolRen
}
}

bool QgsEllipseSymbolLayer::shapeIsFilled( const QString &symbolName ) const
bool QgsEllipseSymbolLayer::shapeIsFilled( const QString &symbolName )
{
return symbolName == QLatin1String( "cross" ) || symbolName == QLatin1String( "arrow" ) || symbolName == QLatin1String( "half_arc" ) ? false : true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgsellipsesymbollayer.h
Expand Up @@ -58,7 +58,7 @@ class CORE_EXPORT QgsEllipseSymbolLayer: public QgsMarkerSymbolLayer
* \returns TRUE if shape uses a fill, or FALSE if shape uses lines only
* \since QGIS 3.20
*/
bool shapeIsFilled( const QString &symbolName ) const;
static bool shapeIsFilled( const QString &symbolName );

void setSize( double size ) override;

Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology/qgsellipsesymbollayerwidget.cpp
Expand Up @@ -121,6 +121,7 @@ void QgsEllipseSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
{
mShapeListWidget->setCurrentItem( symbolItemList.at( 0 ) );
}
btnChangeColorFill->setEnabled( QgsEllipseSymbolLayer::shapeIsFilled( mLayer->symbolName() ) );

//set combo entries to current values
blockComboSignals( true );
Expand Down Expand Up @@ -170,6 +171,7 @@ void QgsEllipseSymbolLayerWidget::mShapeListWidget_itemSelectionChanged()
if ( item )
{
mLayer->setSymbolName( item->data( Qt::UserRole ).toString() );
btnChangeColorFill->setEnabled( QgsEllipseSymbolLayer::shapeIsFilled( mLayer->symbolName() ) );
emit changed();
}
}
Expand Down

0 comments on commit 6d64fab

Please sign in to comment.