Better spacing on the delegate

Makes the location delegate pleasant to the eye.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-08 10:11:13 -03:00 committed by Dirk Hohndel
parent eff22c28db
commit 967bd68e64

View file

@ -506,7 +506,7 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QString diveSiteCoords(gpsCoords); QString diveSiteCoords(gpsCoords);
free( (void*) gpsCoords); free( (void*) gpsCoords);
fontBigger.setPointSize(fontBigger.pointSize() + 2); fontBigger.setPointSize(fontBigger.pointSize() + 1);
fontBigger.setBold(true); fontBigger.setBold(true);
painter->save(); painter->save();
@ -533,7 +533,7 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QSize LocationFilterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize LocationFilterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QFont fontBigger = qApp->font(); QFont fontBigger = qApp->font();
fontBigger.setPointSize(fontBigger.pointSize() + 2); fontBigger.setPointSize(fontBigger.pointSize());
fontBigger.setBold(true); fontBigger.setBold(true);
QFontMetrics fmBigger(fontBigger); QFontMetrics fmBigger(fontBigger);
@ -542,6 +542,9 @@ QSize LocationFilterDelegate::sizeHint(const QStyleOptionViewItem &option, const
QFontMetrics fmSmaller(fontSmaller); QFontMetrics fmSmaller(fontSmaller);
QSize retSize = QStyledItemDelegate::sizeHint(option, index); QSize retSize = QStyledItemDelegate::sizeHint(option, index);
retSize.setHeight(fmBigger.boundingRect("Yellow House").height() + 5 /*spacing*/ + fmSmaller.boundingRect("Yellow House").height()); retSize.setHeight(
fmBigger.boundingRect("Yellow House").height() + 5 /*spacing*/ +
fmSmaller.boundingRect("Yellow House").height());
return retSize; return retSize;
} }