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

QMapIterator::Item is private

    XMLWordPrintable

Details

    • 227c1a56ecb8b99cbd64bd6b8335b3cc3c8a21f1

    Description

      I tried to use QMapIterator::Item but compiler show me error.

       

      Code:

       

       

      QMap<QString, int> map;
      QMapIterator<QString, int> it = map;
      auto item1 = it.next(); // it works!
      QMapIterator<QString, int>::Item item2 = it.next(); // compilation error
      

       

      Error message:

       

      ../main.cpp: In function ‘int main(int, char**)’:
      ../main.cpp:35:33: error: ‘typedef QMapIterator<QString, int>::const_iterator QMapIterator<QString, int>::Item’ is private within this context
       QMapIterator<QString, int>::Item item2 = it.next();
       ^~~~
      In file included from /usr/include/qt5/QtCore/qlist.h:44,
       from /usr/include/qt5/QtCore/QList:1,
       from ../json.h:3,
       from ../main.cpp:1:
      /usr/include/qt5/QtCore/qmap.h:1290:1: note: declared private here
       Q_DECLARE_ASSOCIATIVE_ITERATOR(Map)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            taurus Ivan Romanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes