Skip to content

Commit

Permalink
More user friendly display of 'all other values' category
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 8, 2019
1 parent f66773a commit 210ec4c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Expand Up @@ -164,6 +164,10 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
else // tooltip else // tooltip
return res.join( '\n' ); return res.join( '\n' );
} }
else if ( !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() )
{
return tr( "all other values" );
}
else else
{ {
return category.value().toString(); return category.value().toString();
Expand All @@ -175,6 +179,17 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
break; 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: case Qt::DecorationRole:
{ {
if ( index.column() == 0 && category.symbol() ) if ( index.column() == 0 && category.symbol() )
Expand All @@ -187,7 +202,8 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
case Qt::ForegroundRole: case Qt::ForegroundRole:
{ {
QBrush brush( qApp->palette().color( QPalette::Text ), Qt::SolidPattern ); 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(); QColor fadedTextColor = brush.color();
fadedTextColor.setAlpha( 128 ); fadedTextColor.setAlpha( 128 );
Expand Down

0 comments on commit 210ec4c

Please sign in to comment.