diff --git a/src/CommunitiesListItem.cpp b/src/CommunitiesListItem.cpp index 3a121dc0bc78a0203af0a0d14563185ecf5790c6..a2f2777df5ce49573b2fcab0525e729d1158c297 100644 --- a/src/CommunitiesListItem.cpp +++ b/src/CommunitiesListItem.cpp @@ -182,7 +182,8 @@ CommunitiesListItem::updateTooltip() if (groupId_ == "world") setToolTip(tr("All rooms")); else if (is_tag()) { - QString tag = groupId_.right(static_cast<int>(groupId_.size() - strlen("tag:"))); + QStringRef tag = + groupId_.rightRef(static_cast<int>(groupId_.size() - strlen("tag:"))); if (tag == "m.favourite") setToolTip(tr("Favourite rooms")); else if (tag == "m.lowpriority") diff --git a/src/Logging.cpp b/src/Logging.cpp index 436de811f7149cfdee7ab49c6718bc814d778bad..642e89572a339b776cf55e10dfbef95ea89444e9 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp @@ -32,16 +32,17 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri if ( // Surpress binding wrning for now, as we can't set restore mode to keep compat with // qt 5.10 - msg.contains( - "QML Binding: Not restoring previous value because restoreMode has not been set.") || + msg.contains(QStringLiteral( + "QML Binding: Not restoring previous value because restoreMode has not been set.")) || // The default style has the point size set. If you use pixel size anywhere, you get // that warning, which is useless, since sometimes you need the pixel size to match the // text to the size of the outer element for example. This is done in the avatar and // without that you get one warning for every Avatar displayed, which is stupid! - msg.endsWith("Both point size and pixel size set. Using pixel size.") || + msg.endsWith(QStringLiteral("Both point size and pixel size set. Using pixel size.")) || // The new syntax breaks rebinding on Qt < 5.15. Until we can drop that, we still need it. - msg.endsWith("QML Connections: Implicitly defined onFoo properties in Connections are " - "deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }")) + msg.endsWith(QStringLiteral( + "QML Connections: Implicitly defined onFoo properties in Connections are " + "deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }"))) return; switch (type) { diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h index a10c2126701c41eeae59d6945a570f77b674e794..c7a7588b6ef490dc9558e77e0d78373950b3e0a6 100644 --- a/src/timeline/EventStore.h +++ b/src/timeline/EventStore.h @@ -10,7 +10,6 @@ #include <QCache> #include <QObject> #include <QVariant> -#include <qhashfunctions.h> #include <mtx/events/collections.hpp> #include <mtx/responses/messages.hpp> @@ -25,6 +24,11 @@ class EventStore : public QObject public: EventStore(std::string room_id, QObject *parent); + // taken from QtPrivate::QHashCombine + static uint hashCombine(uint hash, uint seed) + { + return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2)); + }; struct Index { std::string room; @@ -32,10 +36,9 @@ public: friend uint qHash(const Index &i, uint seed = 0) noexcept { - QtPrivate::QHashCombine hash; seed = - hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); - seed = hash(seed, i.idx); + hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); + seed = hashCombine(qHash(i.idx, seed), seed); return seed; } @@ -50,10 +53,9 @@ public: friend uint qHash(const IdIndex &i, uint seed = 0) noexcept { - QtPrivate::QHashCombine hash; seed = - hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); - seed = hash(seed, QByteArray::fromRawData(i.id.data(), (int)i.id.size())); + hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); + seed = hashCombine(qHashBits(i.id.data(), (int)i.id.size(), seed), seed); return seed; } diff --git a/src/ui/Avatar.cpp b/src/ui/Avatar.cpp index 53e72618187bc0688577ded8e480098bab0b3c54..154a0e2c305ba3327e9ae97ec696aadb583f3a30 100644 --- a/src/ui/Avatar.cpp +++ b/src/ui/Avatar.cpp @@ -122,7 +122,7 @@ Avatar::setDevicePixelRatio(double ratio) void Avatar::paintEvent(QPaintEvent *) { - bool rounded = QSettings().value("user/avatar_circles", true).toBool(); + bool rounded = QSettings().value(QStringLiteral("user/avatar_circles"), true).toBool(); QPainter painter(this);