Format: Use QMap instead of QHash
As the items of QHash are arbitrarily ordered, so the same formats may generate different formatKey
This commit is contained in:
@@ -903,7 +903,7 @@ QByteArray Format::formatKey() const
|
||||
QByteArray key;
|
||||
QDataStream stream(&key, QIODevice::WriteOnly);
|
||||
|
||||
QHashIterator<int, QVariant> i(d->property);
|
||||
QMapIterator<int, QVariant> i(d->property);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
stream<<i.key()<<i.value();
|
||||
@@ -1108,4 +1108,12 @@ QColor Format::colorProperty(int propertyId) const
|
||||
return qvariant_cast<QColor>(prop);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, const Format &f)
|
||||
{
|
||||
dbg.nospace() << "QXlsx::Format(" << f.d->property << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE_XLSX
|
||||
|
||||
@@ -237,6 +237,7 @@ private:
|
||||
friend class RichStringPrivate;
|
||||
friend class SharedStrings;
|
||||
friend class ::FormatTest;
|
||||
friend Q_XLSX_EXPORT QDebug operator<<(QDebug, const Format &f);
|
||||
|
||||
bool fontIndexValid() const;
|
||||
int fontIndex() const;
|
||||
@@ -274,6 +275,10 @@ private:
|
||||
QExplicitlySharedDataPointer<FormatPrivate> d;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_XLSX_EXPORT QDebug operator<<(QDebug dbg, const Format &f);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE_XLSX
|
||||
|
||||
#endif // QXLSX_FORMAT_H
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define XLSXFORMAT_P_H
|
||||
#include "xlsxformat.h"
|
||||
#include <QSharedData>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
|
||||
namespace QXlsx {
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
|
||||
int theme;
|
||||
|
||||
QHash<int, QVariant> property;
|
||||
QMap<int, QVariant> property;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user