diff --git a/src/CommunitiesListItem.cpp b/src/CommunitiesListItem.cpp index 3a121dc0..a2f2777d 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(groupId_.size() - strlen("tag:"))); + QStringRef tag = + groupId_.rightRef(static_cast(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 436de811..642e8957 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() { ... }")) + msg.endsWith(QStringLiteral( + "QML Connections: Implicitly defined onFoo properties in Connections are " + "deprecated. Use this syntax instead: function onFoo() { ... }"))) return; switch (type) { diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h index a10c2126..c7a7588b 100644 --- a/src/timeline/EventStore.h +++ b/src/timeline/EventStore.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -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 53e72618..154a0e2c 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);