ifdef QFontMetrics::horizontalAdvance to make it work with older Qt

This commit is contained in:
Jonas Kvinge
2019-07-08 23:27:45 +02:00
parent 4150e3efde
commit 5f7efee00e
10 changed files with 52 additions and 2 deletions

View File

@@ -117,7 +117,13 @@ void QueuedItemDelegate::DrawBox(QPainter *painter, const QRect &line_rect, cons
smaller.setPointSize(smaller.pointSize() - 1);
smaller.setBold(true);
if (width == -1) width = QFontMetrics(font).horizontalAdvance(text + " ");
if (width == -1) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
width = QFontMetrics(font).horizontalAdvance(text + " ");
#else
width = QFontMetrics(font).width(text + " ");
#endif
}
QRect rect(line_rect);
rect.setLeft(rect.right() - width - kQueueBoxBorder);