[CardInfo] use QString QHash instead of QVariantHash for properties (#7063)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / Debian 13 (push) Has been cancelled
Build Desktop / Debian 12 (push) Has been cancelled
Build Desktop / Fedora 44 (push) Has been cancelled
Build Desktop / Fedora 43 (push) Has been cancelled
Build Desktop / Servatrice_Debian 12 (push) Has been cancelled
Build Desktop / Ubuntu 26.04 (push) Has been cancelled
Build Desktop / Ubuntu 24.04 (push) Has been cancelled
Build Desktop / Arch (push) Has been cancelled
Build Desktop / macOS 14 (push) Has been cancelled
Build Desktop / macOS 15 (push) Has been cancelled
Build Desktop / macOS 13 Intel (push) Has been cancelled
Build Desktop / macOS 15 Debug (push) Has been cancelled
Build Desktop / Windows 10 (push) Has been cancelled

* [CardInfo] use QString QHash instead of QVariantHash for properties

* bump CACHE_VERSION

* cleanups
This commit is contained in:
RickyRister 2026-08-02 20:02:37 -07:00 committed by GitHub
parent b44dcf5951
commit 1ed9823b56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 70 additions and 73 deletions

View file

@ -13,12 +13,11 @@
#include <QElapsedTimer>
#include <QFile>
#include <QSaveFile>
#include <QVariantHash>
namespace
{
constexpr quint32 CACHE_MAGIC = 0x43445243; // "CDRC"
constexpr quint32 CACHE_VERSION = 1;
constexpr quint32 CACHE_VERSION = 2;
// ---- Primitives -----------------------------------------------------------
@ -34,11 +33,11 @@ QString readString(QDataStream &in)
return s;
}
// Stores a QVariantHash as a single pre-serialized blob. The reader keeps the
// blob as-is and materializes the QVariantHash lazily on first query, which is
// Stores a QHash<QString, QString> as a single pre-serialized blob. The reader keeps the
// blob as-is and materializes the QHash<QString, QString> lazily on first query, which is
// what removes the allocation storm from database load (see card_info.cpp /
// printing_info.cpp).
void writeHashBlob(QDataStream &out, const QVariantHash &h)
void writeHashBlob(QDataStream &out, const QHash<QString, QString> &h)
{
QByteArray blob;
QDataStream blobOut(&blob, QIODevice::WriteOnly);