Skip to content
Permalink
Browse files
Fix line height and icon size on hipi
  The icon will scale up but not down, the 2.10
  behaviour is retained on 96dpi screens and
  the icon is scaled up if needed
  • Loading branch information
elpaso committed Oct 8, 2015
1 parent d088e0b commit 844578d02dd9adafec8e78a1f88fee41eda501e2
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/gui/attributetable/qgsfeaturelistviewdelegate.cpp
@@ -52,9 +52,8 @@ void QgsFeatureListViewDelegate::setEditSelectionModel( QItemSelectionModel* edi
QSize QgsFeatureListViewDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
Q_UNUSED( index )
QSize size = QItemDelegate::sizeHint( option, index );
size.setHeight( option.fontMetrics.height() );
return size;
int height = sIconSize;
return QSize( option.rect.width(), qMax( height, option.fontMetrics.height() ) );
}

void QgsFeatureListViewDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
@@ -81,6 +80,13 @@ void QgsFeatureListViewDelegate::paint( QPainter *painter, const QStyleOptionVie
icon = QgsApplication::getThemePixmap( "/mIconDeselected.svg" );
}

// Scale up the icon if needed
if ( option.rect.height() > sIconSize )
{
icon = icon.scaledToHeight( option.rect.height(), Qt::SmoothTransformation );
}


// Text layout options
QRect textLayoutBounds( iconLayoutBounds.x() + iconLayoutBounds.width(), option.rect.y(), option.rect.width() - ( iconLayoutBounds.x() + iconLayoutBounds.width() ), option.rect.height() );

0 comments on commit 844578d

Please sign in to comment.