Skip to content

Commit 210ec4c

Browse files
committedJan 8, 2019
More user friendly display of 'all other values' category
1 parent f66773a commit 210ec4c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
164164
else // tooltip
165165
return res.join( '\n' );
166166
}
167+
else if ( !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() )
168+
{
169+
return tr( "all other values" );
170+
}
167171
else
168172
{
169173
return category.value().toString();
@@ -175,6 +179,17 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
175179
break;
176180
}
177181

182+
case Qt::FontRole:
183+
{
184+
if ( index.column() == 1 && category.value().type() != QVariant::List && ( !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() ) )
185+
{
186+
QFont italicFont;
187+
italicFont.setItalic( true );
188+
return italicFont;
189+
}
190+
return QVariant();
191+
}
192+
178193
case Qt::DecorationRole:
179194
{
180195
if ( index.column() == 0 && category.symbol() )
@@ -187,7 +202,8 @@ QVariant QgsCategorizedSymbolRendererModel::data( const QModelIndex &index, int
187202
case Qt::ForegroundRole:
188203
{
189204
QBrush brush( qApp->palette().color( QPalette::Text ), Qt::SolidPattern );
190-
if ( index.column() == 1 && category.value().type() == QVariant::List )
205+
if ( index.column() == 1 && ( category.value().type() == QVariant::List
206+
|| !category.value().isValid() || category.value().isNull() || category.value().toString().isEmpty() ) )
191207
{
192208
QColor fadedTextColor = brush.color();
193209
fadedTextColor.setAlpha( 128 );

0 commit comments

Comments
 (0)
Please sign in to comment.