altering the watchlist in both the singular and QStringList overloads of
addPath and removePath.
+* QString::mid, QString::midRef and QByteArray::mid, if the position passed
+ is equal to the length (that is, right after the last character/byte),
+ now return an empty QString, QStringRef or QByteArray respectively.
+ in Qt 4 they returned a null QString or a null QStringRef.
+
QtGui
-----
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
QByteArray QByteArray::mid(int pos, int len) const
{
- if (d == &shared_null.ba || d == &shared_empty.ba || pos >= d->size)
+ if (d == &shared_null.ba || d == &shared_empty.ba || pos > d->size)
return QByteArray();
if (len < 0)
len = d->size - pos;
QString QString::mid(int position, int n) const
{
- if (d == &shared_null.str || position >= d->size)
+ if (d == &shared_null.str || position > d->size)
return QString();
if (n < 0)
n = d->size - position;
Returns a substring reference to \a n characters of this string,
starting at the specified \a position.
- If the \a position exceeds the length of the string, an empty
+ If the \a position exceeds the length of the string, a null
reference is returned.
If there are less than \a n characters available in the string,
QStringRef QString::midRef(int position, int n) const
{
- if (d == &shared_null.str || position >= d->size)
+ if (d == &shared_null.str || position > d->size)
return QStringRef();
if (n < 0)
n = d->size - position;
QCOMPARE(a.mid(3,3),(QString)"DEF");
QCOMPARE(a.mid(0,0),(QString)"");
+ QVERIFY(!a.mid(15,0).isNull());
+ QVERIFY(a.mid(15,0).isEmpty());
+ QVERIFY(!a.mid(15,1).isNull());
+ QVERIFY(a.mid(15,1).isEmpty());
QVERIFY(a.mid(9999).isNull());
QVERIFY(a.mid(9999,1).isNull());
QCOMPARE(a.midRef(3,3).toString(),(QString)"DEF");
QCOMPARE(a.midRef(0,0).toString(),(QString)"");
+ QVERIFY(!a.midRef(15,0).toString().isNull());
+ QVERIFY(a.midRef(15,0).toString().isEmpty());
+ QVERIFY(!a.midRef(15,1).toString().isNull());
+ QVERIFY(a.midRef(15,1).toString().isEmpty());
QVERIFY(a.midRef(9999).toString().isEmpty());
QVERIFY(a.midRef(9999,1).toString().isEmpty());
QVERIFY(hello.mid(0, hello.size()+1) == hello);
QVERIFY(hello.mid(hello.size()-0) == "");
-
- QVERIFY(hello.mid(hello.size()-0).isNull()); // weird but valid 3.x semantics
+ QVERIFY(hello.mid(hello.size()-0).isEmpty());
+ QVERIFY(!hello.mid(hello.size()-0).isNull());
QVERIFY(hello.mid(hello.size()-1) == "o");
QVERIFY(hello.mid(hello.size()-2) == "lo");
QVERIFY(hello.mid(hello.size()-200) == "hello");
QVERIFY(hello.mid(0, hello.size()+1) == hello);
QVERIFY(hello.mid(hello.size()-0) == "");
-
- QVERIFY(hello.mid(hello.size()-0).isNull());
+ QVERIFY(hello.mid(hello.size()-0).isEmpty());
+ QVERIFY(!hello.mid(hello.size()-0).isNull());
QVERIFY(hello.mid(hello.size()-1) == "o");
QVERIFY(hello.mid(hello.size()-2) == "lo");
QVERIFY(hello.mid(hello.size()-200) == "hello");