diff --git a/src/playback-history-qt/playback-history.cc b/src/playback-history-qt/playback-history.cc index 7b9e57454..275b237e8 100644 --- a/src/playback-history-qt/playback-history.cc +++ b/src/playback-history-qt/playback-history.cc @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -44,14 +45,6 @@ static const char * printable(const String & str) return str ? str : ""; } -static QString toQString(const String & str) -{ - // The explicit cast to const char * is necessary to compile with Qt 6, - // because otherwise two implicit conversions would be necessary: from - // String to const char * and from const char * to QByteArrayView. - return QString::fromUtf8(static_cast(str)); -} - class PlaybackHistory : public GeneralPlugin { private: @@ -525,17 +518,19 @@ QVariant HistoryModel::data(const QModelIndex & index, int role) const switch (role) { case Qt::DisplayRole: - return toQString(m_entries[pos].text()); + return QString(m_entries[pos].text()); case Qt::ToolTipRole: { const auto & entry = m_entries[pos]; // The playlist title and entry number are rarely interesting and // therefore shown only in the tooltip. - return QString::fromUtf8(_("%1: %2
Playlist: %3" - "
Entry Number: %4")) - .arg(QString::fromUtf8(entry.translatedTextDesignation()), - toQString(entry.text()), toQString(entry.playlistTitle()), - QString::number(entry.entryNumber())); + return QString( + str_printf(_("%s: %s
Playlist: %s
" + "Entry Number: %d"), + entry.translatedTextDesignation(), + static_cast(entry.text()), + static_cast(entry.playlistTitle()), + entry.entryNumber())); } case Qt::FontRole: if (pos == m_playingPosition)