Reduce allocations using QStringLiteral

This commit is contained in:
Nicolas Werner 2021-12-29 04:28:08 +01:00
parent a3c4ebc460
commit d8ead9573b
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
46 changed files with 539 additions and 539 deletions

View file

@ -17,7 +17,7 @@ CombinedImagePackModel::CombinedImagePackModel(const std::string &roomId,
for (const auto &pack : packs) {
QString packname =
pack.pack.pack ? QString::fromStdString(pack.pack.pack->display_name) : "";
pack.pack.pack ? QString::fromStdString(pack.pack.pack->display_name) : QString();
for (const auto &img : pack.pack.images) {
ImageDesc i{};
@ -56,7 +56,7 @@ CombinedImagePackModel::data(const QModelIndex &index, int role) const
if (hasIndex(index.row(), index.column(), index.parent())) {
switch (role) {
case CompletionModel::CompletionRole:
return QString("<img data-mx-emoticon height=32 src=\"%1\" alt=\"%2\" title=\"%2\">")
return QStringLiteral("<img data-mx-emoticon height=32 src=\"%1\" alt=\"%2\" title=\"%2\">")
.arg(QString::fromStdString(images[index.row()].image.url).toHtmlEscaped(),
QString::fromStdString(images[index.row()].image.body));
case Roles::Url: