Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81023

Compile error when we use QT_DISABLE_DEPRECATED_BEFORE (qt5.15)

    XMLWordPrintable

Details

    • All
    • 4bc9e3b8470ed2026604dc06dc027c80e6f7c445 (qt/qtbase/5.15)

    Description

      Hi,

      I build qt5.15 from 5.15 branch (yesterday).

      But I can't build code when I use -DQT_DEPRECATED_WARNINGS_SINCE=0x060000

      When we use:

      void KateBtDatabase::loadFromFile(const QString &url)
      {
          QFile file(url);
          if (file.open(QIODevice::ReadOnly)) {
          QMutexLocker locker(&mutex);
          QDataStream ds(&file);
         ds >> db;
          }
      
      }

      with db == QHash<QString, QStringList> db;

       

      include/QtCore/qdatastream.h: In instantiation of 'QDataStream& QtPrivate::readAssociativeContainer(QDataStream&, Container&) [with Container = QHash<QString, QStringList>]':
      include/QtCore/qdatastream.h:456:47: required from 'QDataStream& operator>>(QDataStream&, QHash<K, V>&) [with Key = QString; T = QStringList]'
      kate/addons/backtracebrowser/btdatabase.cpp:32:15: required from here
      include/QtCore/qdatastream.h:306:11: error: 'class QHash<QString, QStringList>' has no member named 'insertMulti'
       306 | c.insertMulti(k, t);
      

       

      When I look at code I can see:

      template <typename Container>
      QDataStream &readAssociativeContainer(QDataStream &s, Container &c)
      {
       StreamStateSaver stateSaver(&s);
      
      c.clear();
       quint32 n;
       s >> n;
       for (quint32 i = 0; i < n; ++i) {
       typename Container::key_type k;
       typename Container::mapped_type t;
       s >> k >> t;
       if (s.status() != QDataStream::Ok) {
       c.clear();
       break;
       }
      QT_WARNING_PUSH
      QT_WARNING_DISABLE_DEPRECATED
       c.insertMulti(k, t);
      QT_WARNING_POP
       }
      
      return s;
      }

       

      and indeed insertMulti doesn't exist in QHash we we use "QT_DEPRECATED_WARNINGS_SINCE=0x060000"

      Regards

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dfaure_kdab David Faure
            montel Montel Laurent
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes