Skip to content

Commit

Permalink
Fix usability issue in pluginmanager
Browse files Browse the repository at this point in the history
The height of rows is too small to see its
contents on hidpi screens

Also raised maximumSize of mPluginsTabFrame
  • Loading branch information
elpaso authored and m-kuhn committed May 27, 2015
1 parent 08dd620 commit 90b796c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/app/pluginmanager/qgspluginitemdelegate.cpp
Expand Up @@ -31,7 +31,9 @@ QSize QgsPluginItemDelegate::sizeHint( const QStyleOptionViewItem & option, cons
{
Q_UNUSED( option );
Q_UNUSED( index );
return QSize( 20, 20 );
// Calculate row height, adds some 20% padding
int pixelsHigh = int(QApplication::fontMetrics().height() * 1.2);
return QSize( pixelsHigh, pixelsHigh );
}


Expand All @@ -40,6 +42,7 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
painter->save();
painter->setRenderHint( QPainter::SmoothPixmapTransform );
QStyle *style = QApplication::style();
int pixelsHigh = QApplication::fontMetrics().height();

// Draw the background
style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL );
Expand All @@ -66,7 +69,7 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
if ( !iconPixmap.isNull() )
{
int iconSize = option.rect.height();
painter->drawPixmap( option.rect.left() + 24, option.rect.top(), iconSize, iconSize, iconPixmap );
painter->drawPixmap( option.rect.left() + pixelsHigh , option.rect.top(), iconSize, iconSize, iconPixmap );
}

// Draw the text
Expand All @@ -92,8 +95,7 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
font.setBold( true );
painter->setFont( font );
}

painter->drawText( option.rect.left() + 48, option.rect.bottom() - 3, index.data( Qt::DisplayRole ).toString() );
painter->drawText( option.rect.left() + int( pixelsHigh * 2.3 ), option.rect.bottom() - int( pixelsHigh / 6), index.data( Qt::DisplayRole ).toString() );

painter->restore();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgspluginmanagerbase.ui
Expand Up @@ -46,7 +46,7 @@
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>400</width>
<height>16777215</height>
</size>
</property>
Expand Down

0 comments on commit 90b796c

Please sign in to comment.