Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 35444c4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gui/attributetable/qgsfeaturelistviewdelegate.cpp
Expand Up @@ -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
Expand All @@ -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() );

Expand Down

0 comments on commit 35444c4

Please sign in to comment.