Use QString::arg()

This commit is contained in:
Jonas Kvinge 2023-10-13 22:55:20 +02:00
parent f03ff452b8
commit adef05bbdf
4 changed files with 4 additions and 4 deletions

View File

@ -297,7 +297,7 @@ bool GeniusLyricsProvider::StartSearch(const int id, const LyricsSearchRequest &
requests_search_.insert(id, search);
QUrlQuery url_query;
url_query.addQueryItem("q", QUrl::toPercentEncoding(QString(request.artist + " " + request.title)));
url_query.addQueryItem("q", QUrl::toPercentEncoding(QString("%1 %2").arg(request.artist, request.title)));
QUrl url(kUrlSearch);
url.setQuery(url_query);

View File

@ -55,7 +55,7 @@ SongList ASXParser::Load(QIODevice *device, const QString &playlist_path, const
QString url = re_match.captured(2);
url.replace(QRegularExpression("&(?!amp;|quot;|apos;|lt;|gt;)"), "&");
QByteArray replacement = QString(re_match.captured(1) + url + "\"").toLocal8Bit();
QByteArray replacement = QString("%1%2\"").arg(re_match.captured(1), url).toLocal8Bit();
data.replace(re_match.captured(0).toLocal8Bit(), replacement);
index += replacement.length();
}

View File

@ -158,7 +158,7 @@ QVariant Queue::data(const QModelIndex &proxy_index, int role) const {
const QString title = source_index.sibling(source_index.row(), Playlist::Column_Title).data().toString();
if (artist.isEmpty()) return title;
return QString(artist + " - " + title);
return QString("%1 - %2").arg(artist, title);
}
default:

View File

@ -54,7 +54,7 @@ QString DesktopEnvironment() {
QString session = GetEnv("DESKTOP_SESSION");
qint64 slash = session.lastIndexOf('/');
if (slash != -1) {
QSettings desktop_file(QString(session + ".desktop"), QSettings::IniFormat);
QSettings desktop_file(QString("%1.desktop").arg(session), QSettings::IniFormat);
desktop_file.beginGroup("Desktop Entry");
QString name = desktop_file.value("DesktopNames").toString();
desktop_file.endGroup();