Skip to content
Permalink
Browse files

Don't hard-code black and gray for layer tree items' text color

  • Loading branch information
nirvn committed Feb 11, 2019
1 parent f8f701c commit 4be150c58bfd063570cd559e59a1c59d0c82f155
@@ -304,7 +304,7 @@ Gets map of map layer style overrides (key: layer ID, value: style name) where a

void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
%Docstring
Set map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one
Sets map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one

.. versionadded:: 2.10
%End
@@ -277,13 +277,15 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
}
else if ( role == Qt::ForegroundRole )
{
QBrush brush( Qt::black, Qt::SolidPattern );
QBrush brush( qApp->palette().color( QPalette::Text ), Qt::SolidPattern );
if ( QgsLayerTree::isLayer( node ) )
{
const QgsMapLayer *layer = QgsLayerTree::toLayer( node )->layer();
if ( ( !node->isVisible() && ( !layer || layer->isSpatial() ) ) || ( layer && !layer->isInScaleRange( mLegendMapViewScale ) ) )
{
brush.setColor( Qt::gray );
QColor fadedTextColor = brush.color();
fadedTextColor.setAlpha( 66 );
brush.setColor( fadedTextColor );
}
}
return brush;
@@ -269,7 +269,7 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel
QMap<QString, QString> layerStyleOverrides() const;

/**
* Set map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one
* Sets map of map layer style overrides (key: layer ID, value: style name) where a different style should be used instead of the current one
* \since QGIS 2.10
*/
void setLayerStyleOverrides( const QMap<QString, QString> &overrides );

0 comments on commit 4be150c

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