Skip to content

Commit

Permalink
[welcome page] add a minmium width to the recent project list
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 13, 2015
1 parent 06a41ef commit 537d195
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/qgswelcomepageitemsmodel.cpp
Expand Up @@ -92,13 +92,23 @@ QSize QgsWelcomePageItemDelegate::sizeHint( const QStyleOptionViewItem & option,
QTextDocument doc;
QPixmap icon = qvariant_cast<QPixmap>( index.data( Qt::DecorationRole ) );

int width;
if ( option.rect.width() < 450 )
{
width = 450;
}
else
{
width = option.rect.width();
}

int titleSize = QApplication::fontMetrics().height() * 1.1;
int textSize = titleSize * 0.85;

doc.setHtml( QString( "<div style='font-size:%1px;'><span style='font-size:%2px;font-weight:bold;'>%3</span><br>%4<br>%5</div>" ).arg( textSize ).arg( titleSize ).arg( index.data( QgsWelcomePageItemsModel::TitleRole ).toString() ).arg( index.data( QgsWelcomePageItemsModel::PathRole ).toString() ).arg( index.data( QgsWelcomePageItemsModel::CrsRole ).toString() ) );
doc.setTextWidth( option.rect.width() - ( !icon.isNull() ? icon.width() + 35 : 35 ) );
doc.setTextWidth( width - ( !icon.isNull() ? icon.width() + 35 : 35 ) );

return QSize( option.rect.width(), qMax( doc.size().height() + 10, ( double )icon.height() ) + 20 );
return QSize( width, qMax( doc.size().height() + 10, ( double )icon.height() ) + 20 );
}

QgsWelcomePageItemsModel::QgsWelcomePageItemsModel( QObject* parent )
Expand Down

0 comments on commit 537d195

Please sign in to comment.