Skip to content
Permalink
Browse files

More user friendly display of 'all other values' category

  • Loading branch information
nyalldawson committed Jan 7, 2019
1 parent f66773a commit 210ec4c12c9763da2e931347f23359bf13f7e8dc
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
@@ -164,6 +164,10 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
else // tooltip
return res.join( '\n' );
}
else if ( !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() )
{
return tr( "all other values" );
}
else
{
return category.value().toString();
@@ -175,6 +179,17 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
break;
}

case Qt::FontRole:
{
if ( index.column() == 1 && category.value().type() != QVariant::List && ( !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() ) )
{
QFont italicFont;
italicFont.setItalic( true );
return italicFont;
}
return QVariant();
}

case Qt::DecorationRole:
{
if ( index.column() == 0 && category.symbol() )
@@ -187,7 +202,8 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
case Qt::ForegroundRole:
{
QBrush brush( qApp->palette().color( QPalette::Text ), Qt::SolidPattern );
if ( index.column() == 1 && category.value().type() == QVariant::List )
if ( index.column() == 1 && ( category.value().type() == QVariant::List
|| !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() ) )
{
QColor fadedTextColor = brush.color();
fadedTextColor.setAlpha( 128 );

0 comments on commit 210ec4c

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