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

@@ -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);