mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #2356 from elpaso/hidpi-improvements8
Fix line height and icon size on hipi
This commit is contained in:
commit
35444c4631
@ -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() );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user