Fix compile with we use QT_DISABLE_DEPRECATED_BEFORE=0x060000 in apps
in qt5.15 you deprecated iterator &operator--() in qhash
but QDataStream needs it. (see writeAssociativeContainer)
So when we compile without deprecated method we can see:
qdatastream.h:333:9: error: no match for ‘operator--’ (operand type is ‘QHash<QString, QImage>::const_iterator’)
333 | --it;
| ^~~~
The current code is only
QHash<QString, QImage> m_images;
QDataStream stream(&file);
stream << m_images;
Change-Id: I12e61c0c60615455ac1eeff02969f155edb12e56
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
parent
d872719bf5
commit
ccef2c33b2
|
|
@ -321,7 +321,7 @@ template <typename Container>
|
|||
QDataStream &writeAssociativeContainer(QDataStream &s, const Container &c)
|
||||
{
|
||||
s << quint32(c.size());
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
|
||||
// Deserialization should occur in the reverse order.
|
||||
// Otherwise, value() will return the least recently inserted
|
||||
// value instead of the most recently inserted one.
|
||||
|
|
|
|||
Loading…
Reference in New Issue