ifdef QFontMetrics::horizontalAdvance to make it work with older Qt
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -100,7 +100,11 @@ void PlaylistProxyStyle::drawControl(ControlElement element, const QStyleOption
|
||||
const QFontMetrics &font_metrics = header_option->fontMetrics;
|
||||
|
||||
// Spaces added to make transition less abrupt
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
if (rect.width() < font_metrics.horizontalAdvance(text + " ")) {
|
||||
#else
|
||||
if (rect.width() < font_metrics.width(text + " ")) {
|
||||
#endif
|
||||
const Playlist::Column column = static_cast<Playlist::Column>(header_option->section);
|
||||
QStyleOptionHeader new_option(*header_option);
|
||||
new_option.text = Playlist::abbreviated_column_name(column);
|
||||
|
||||
Reference in New Issue
Block a user