Fix parameter of QJsonObject::const_iterator operator-(const_iterator)

It used to be "iterator", causing a qdoc warning:

src/corelib/serialization/qjsonobject.cpp:1405: (qdoc) warning: clang found diagnostics parsing \fn int QJsonObject::const_iterator::operator-(const_iterator other) const
    error: out-of-line definition of 'operator-' does not match any declaration in 'QJsonObject::const_iterator'

Add a small test.

Change-Id: Id65effffa720ed1e0fb0ee6937dcc4298f3ef363
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Friedemann Kleint 2020-01-02 13:08:21 +01:00
parent 1d7d88f312
commit 3a9251e869
2 changed files with 3 additions and 1 deletions

View File

@ -221,7 +221,7 @@ public:
inline const_iterator operator-(int j) const { return operator+(-j); }
inline const_iterator &operator+=(int j) { i += j; return *this; }
inline const_iterator &operator-=(int j) { i -= j; return *this; }
int operator-(iterator j) const { return i - j.i; }
int operator-(const_iterator j) const { return i - j.i; }
inline bool operator==(const iterator &other) const { return i == other.i; }
inline bool operator!=(const iterator &other) const { return i != other.i; }

View File

@ -527,6 +527,8 @@ void tst_QtJson::testObjectSmallKeys()
QVERIFY(data1.contains(QStringLiteral("123")));
QCOMPARE(data1.value(QStringLiteral("123")).type(), QJsonValue::Double);
QCOMPARE(data1.value(QStringLiteral("123")).toDouble(), (double)323);
QCOMPARE(data1.constEnd() - data1.constBegin(), 3);
QCOMPARE(data1.end() - data1.begin(), 3);
}
void tst_QtJson::testArraySimple()