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

QJson iterators broken -- missing operator->

    XMLWordPrintable

Details

    Description

      The QJsonArray and QJsonObject iterators cannot be dereferenced with the -> operator, e.g. users must do:

      #include <QDebug>
      #include <QJsonArray>
      
      int main(int argc, char *argv[]) {
      
          QJsonArray array;
          array.append(QJsonValue(1));
          array.append(QJsonValue(QString::fromLatin1("2")));
          array.append(QJsonValue(3));
          for (QJsonArray::const_iterator vit = array.constBegin(),
               vitEnd = array.constEnd(); vit != vitEnd; ++vit) {
              if ((*vit).isString())
      //        if (vit->isString()) // Broken iterator here
                  qDebug() << "I'm a string!";
          }
      
          return 0;
      }
      

      instead of the more common vit->isString().

      Attachments

        For Gerrit Dashboard: QTBUG-29573
        # Subject Branch Project Status CR V

        Activity

          People

            laknoll Lars Knoll
            dlonie David Lonie
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes