Skip to content
Permalink
Browse files

Merge pull request #2356 from elpaso/hidpi-improvements8

Fix line height and icon size on hipi
  • Loading branch information
elpaso committed Oct 8, 2015
2 parents de20495 + 844578d commit 35444c4631d958b66e0df7d0e2c5ddf369bf4ed5
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 35444c4

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