Add enough space for the failback text in ImageItem

This commit is contained in:
Konstantinos Sideris 2018-01-30 15:30:25 -07:00
parent 07a4e38ed8
commit 117a739bc4

View file

@ -198,7 +198,7 @@ ImageItem::paintEvent(QPaintEvent *event)
font.setPixelSize(conf::fontSize); font.setPixelSize(conf::fontSize);
QFontMetrics metrics(font); QFontMetrics metrics(font);
const int fontHeight = metrics.ascent(); const int fontHeight = metrics.height() + metrics.lineSpacing();
if (image_.isNull()) { if (image_.isNull()) {
QString elidedText = metrics.elidedText(text_, Qt::ElideRight, max_width_ - 10); QString elidedText = metrics.elidedText(text_, Qt::ElideRight, max_width_ - 10);
@ -207,7 +207,7 @@ ImageItem::paintEvent(QPaintEvent *event)
painter.setFont(font); painter.setFont(font);
painter.setPen(QPen(QColor(66, 133, 244))); painter.setPen(QPen(QColor(66, 133, 244)));
painter.drawText(QPoint(0, fontHeight), elidedText); painter.drawText(QPoint(0, fontHeight / 2), elidedText);
return; return;
} }