From ccef2c33b284f2fd0bc08d518398af58214b020f Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 3 Dec 2019 13:42:08 +0100 Subject: Fix compile with we use QT_DISABLE_DEPRECATED_BEFORE=0x060000 in apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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::const_iterator’) 333 | --it; | ^~~~ The current code is only QHash m_images; QDataStream stream(&file); stream << m_images; Change-Id: I12e61c0c60615455ac1eeff02969f155edb12e56 Reviewed-by: Mårten Nordheim --- src/corelib/serialization/qdatastream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h index 332828b21e..d9d4a4fcd3 100644 --- a/src/corelib/serialization/qdatastream.h +++ b/src/corelib/serialization/qdatastream.h @@ -321,7 +321,7 @@ template 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. -- cgit v1.2.3