summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp2
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp10
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp10
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp6
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp6
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp4
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp4
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp2
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp8
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp8
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp2
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp2
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp6
-rw-r--r--tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp2
-rw-r--r--tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp8
-rw-r--r--tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp2
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp6
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp14
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp10
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp46
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp16
-rw-r--r--tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp2
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp14
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp8
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp2
-rw-r--r--tests/auto/gui/qvulkan/tst_qvulkan.cpp2
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp14
-rw-r--r--tests/auto/network/access/http2/http2srv.h2
-rw-r--r--tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp48
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp2
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp2
-rw-r--r--tests/auto/other/modeltest/modeltest.cpp170
-rw-r--r--tests/auto/other/modeltest/modeltest.h6
-rw-r--r--tests/auto/other/qaccessibility/accessiblewidgets.h2
-rw-r--r--tests/auto/tools/moc/cxx11-explicit-override-control.h40
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp6
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp10
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp34
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp12
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp12
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp47
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp2
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp4
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp2
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp2
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp6
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp2
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp2
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp10
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp10
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp30
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp4
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp4
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp10
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp6
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp16
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp2
-rw-r--r--tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.h2
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.cpp2
-rw-r--r--tests/manual/diaglib/logwidget.cpp2
-rw-r--r--tests/manual/foreignwindows/main.cpp6
-rw-r--r--tests/manual/highdpi/dragwidget.h18
-rw-r--r--tests/manual/qlayout/gridwidget.cpp4
-rw-r--r--tests/manual/qlayout/hbwidget.cpp4
-rw-r--r--tests/manual/qlayout/vbwidget.cpp4
-rw-r--r--tests/manual/qscreen/main.cpp8
-rw-r--r--tests/manual/qscreen/propertywatcher.cpp2
-rw-r--r--tests/manual/qscreen/propertywatcher.h2
-rw-r--r--tests/manual/touch/main.cpp12
-rw-r--r--tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp4
-rw-r--r--tests/manual/widgets/styles/main.cpp6
87 files changed, 497 insertions, 338 deletions
diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index 4e3668d72e..1596a9fafd 100644
--- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -572,7 +572,7 @@ class SlowTask : public QRunnable
{
public:
static QAtomicInt cancel;
- void run() Q_DECL_OVERRIDE {
+ void run() override {
int iter = 60;
while (--iter && !cancel.load())
QThread::currentThread()->msleep(25);
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index c3b53a2fc0..f8f9387abb 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -2406,16 +2406,16 @@ void tst_QTextCodec::shiftJis()
struct UserCodec : public QTextCodec
{
// implement pure virtuals
- QByteArray name() const Q_DECL_OVERRIDE
+ QByteArray name() const override
{ return "UserCodec"; }
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE
+ QList<QByteArray> aliases() const override
{ return QList<QByteArray>() << "usercodec" << "user-codec"; }
- int mibEnum() const Q_DECL_OVERRIDE
+ int mibEnum() const override
{ return 5000; }
- virtual QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE
+ virtual QString convertToUnicode(const char *, int, ConverterState *) const override
{ return QString(); }
- virtual QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE
+ virtual QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override
{ return QByteArray(); }
};
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index a0188f8ba9..a485788ec2 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -551,18 +551,18 @@ public:
: QIODevice(), buf(byteArray), offset(0), ownbuf(false) { }
virtual ~SequentialReadBuffer() { if (ownbuf) delete buf; }
- bool isSequential() const Q_DECL_OVERRIDE { return true; }
+ bool isSequential() const override { return true; }
const QByteArray &buffer() const { return *buf; }
protected:
- qint64 readData(char *data, qint64 maxSize) Q_DECL_OVERRIDE
+ qint64 readData(char *data, qint64 maxSize) override
{
maxSize = qMin(maxSize, qint64(buf->size() - offset));
memcpy(data, buf->constData() + offset, maxSize);
offset += maxSize;
return maxSize;
}
- qint64 writeData(const char * /* data */, qint64 /* maxSize */) Q_DECL_OVERRIDE
+ qint64 writeData(const char * /* data */, qint64 /* maxSize */) override
{
return -1;
}
@@ -598,13 +598,13 @@ public:
RandomAccessBuffer(const char *data) : QIODevice(), buf(data) { }
protected:
- qint64 readData(char *data, qint64 maxSize) Q_DECL_OVERRIDE
+ qint64 readData(char *data, qint64 maxSize) override
{
maxSize = qMin(maxSize, qint64(buf.size() - pos()));
memcpy(data, buf.constData() + pos(), maxSize);
return maxSize;
}
- qint64 writeData(const char *data, qint64 maxSize) Q_DECL_OVERRIDE
+ qint64 writeData(const char *data, qint64 maxSize) override
{
maxSize = qMin(maxSize, qint64(buf.size() - pos()));
memcpy(buf.data() + pos(), data, maxSize);
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index de6eb28503..6b4d292fe3 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -285,7 +285,7 @@ void tst_QProcess::startWithOldOpen()
class OverriddenOpen : public QProcess
{
public:
- virtual bool open(OpenMode mode) Q_DECL_OVERRIDE
+ virtual bool open(OpenMode mode) override
{ return QIODevice::open(mode); }
};
@@ -708,7 +708,7 @@ void tst_QProcess::restartProcessDeadlock()
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
- QObject::disconnect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), Q_NULLPTR, Q_NULLPTR);
+ QObject::disconnect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), nullptr, nullptr);
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
@@ -847,7 +847,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
QVERIFY(QTestEventLoop::instance().timeout());
QVERIFY(!proc.waitForReadyRead(250));
- QObject::disconnect(&proc, &QIODevice::readyRead, Q_NULLPTR, Q_NULLPTR);
+ QObject::disconnect(&proc, &QIODevice::readyRead, nullptr, nullptr);
proc.write("B");
QVERIFY(proc.waitForReadyRead(5000));
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 012ce5f2f5..db756ada39 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -207,7 +207,7 @@ void tst_QSettings::getSetCheck()
QCOMPARE(true, obj1.fallbacksEnabled());
}
-static QString settingsPath(const char *path = Q_NULLPTR)
+static QString settingsPath(const char *path = nullptr)
{
// Temporary path for files that are specified explicitly in the constructor.
#ifndef Q_OS_WINRT
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 0e423a56ca..df8746e518 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -609,14 +609,14 @@ void tst_QTextStream::readLinesFromBufferCRCR()
class ErrorDevice : public QIODevice
{
protected:
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE
+ qint64 readData(char *data, qint64 maxlen) override
{
Q_UNUSED(data)
Q_UNUSED(maxlen)
return -1;
}
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE
+ qint64 writeData(const char *data, qint64 len) override
{
Q_UNUSED(data)
Q_UNUSED(len)
@@ -634,7 +634,7 @@ void tst_QTextStream::readLineInto()
ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("1"));
- ts.readLineInto(Q_NULLPTR, 0); // read the second line, but don't store it
+ ts.readLineInto(nullptr, 0); // read the second line, but don't store it
ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("3"));
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index 564b8547b1..f8c5c92677 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -360,7 +360,7 @@ class AppendStringProxy : public QIdentityProxyModel
public:
QVariant data(const QModelIndex &index, int role) const
{
- const QVariant result = sourceModel()->data(index, role);
+ const QVariant result = QIdentityProxyModel::data(index, role);
if (role != Qt::DisplayRole)
return result;
return result.toString() + "_appended";
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 383bbbd3f8..74e9e4e47d 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -4072,11 +4072,11 @@ public:
}
bool canDropMimeData(const QMimeData *, Qt::DropAction,
- int row, int /* column */, const QModelIndex & /* parent */) const Q_DECL_OVERRIDE
+ int row, int /* column */, const QModelIndex & /* parent */) const override
{ return row == 1; }
bool dropMimeData(const QMimeData *, Qt::DropAction,
- int row, int /* column */, const QModelIndex & /* parent */) Q_DECL_OVERRIDE
+ int row, int /* column */, const QModelIndex & /* parent */) override
{ return row == 1; }
};
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 22f0d8ecaa..5e9dbdd226 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -56,7 +56,7 @@ class ThreadedEventReceiver : public QObject
Q_OBJECT
public:
QList<int> recordedEvents;
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
if (event->type() != QEvent::Type(QEvent::User + 1))
return QObject::event(event);
@@ -70,7 +70,7 @@ public:
class Thread : public QDaemonThread
{
- void run() Q_DECL_OVERRIDE
+ void run() override
{
QThreadData *data = QThreadData::current();
QVERIFY(!data->requiresCoreApplication); // daemon thread
diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
index 87196eaef1..4584b6ce31 100644
--- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
+++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
@@ -763,7 +763,7 @@ void tst_QMetaMethod::gadget()
{
// Call with null should not crash
- MyGadget *gadget = Q_NULLPTR;
+ MyGadget *gadget = nullptr;
QString string;
QVERIFY(!setValueMethod.invokeOnGadget(gadget, Q_ARG(QString, QLatin1String("hi"))));
QVERIFY(!getValueMethod.invokeOnGadget(gadget, Q_RETURN_ARG(QString, string)));
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 3a52c684d0..a3f3550307 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6015,7 +6015,7 @@ public:
struct SlotArgFunctor
{
- SlotArgFunctor(int *s) : status(s), context(Q_NULLPTR), sender(Q_NULLPTR) {}
+ SlotArgFunctor(int *s) : status(s), context(nullptr), sender(nullptr) {}
SlotArgFunctor(ContextObject *context, QObject *sender, int *s) : status(s), context(context), sender(sender) {}
void operator()() { *status = 2; if (context) context->compareSender(sender); }
@@ -6453,7 +6453,7 @@ Q_SIGNALS:
static int countedStructObjectsCount = 0;
struct CountedStruct
{
- CountedStruct() : sender(Q_NULLPTR) { ++countedStructObjectsCount; }
+ CountedStruct() : sender(nullptr) { ++countedStructObjectsCount; }
CountedStruct(GetSenderObject *sender) : sender(sender) { ++countedStructObjectsCount; }
CountedStruct(const CountedStruct &o) : sender(o.sender) { ++countedStructObjectsCount; }
CountedStruct &operator=(const CountedStruct &) { return *this; }
@@ -6769,7 +6769,7 @@ class CountedExceptionThrower : public QObject
Q_OBJECT
public:
- explicit CountedExceptionThrower(bool throwException, QObject *parent = Q_NULLPTR)
+ explicit CountedExceptionThrower(bool throwException, QObject *parent = nullptr)
: QObject(parent)
{
if (throwException)
@@ -6855,7 +6855,7 @@ void tst_QObject::exceptions()
try {
class ParentObject : public QObject {
public:
- explicit ParentObject(QObject *parent = Q_NULLPTR)
+ explicit ParentObject(QObject *parent = nullptr)
: QObject(parent)
{
new CountedExceptionThrower(false, this);
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index e17d8ee38b..343a9384bc 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -754,7 +754,7 @@ void tst_QTimer::recurseOnTimeoutAndStopTimer()
struct CountedStruct
{
- CountedStruct(int *count, QThread *t = Q_NULLPTR) : count(count), thread(t) { }
+ CountedStruct(int *count, QThread *t = nullptr) : count(count), thread(t) { }
~CountedStruct() { }
void operator()() const { ++(*count); if (thread) QCOMPARE(QThread::currentThread(), thread); }
@@ -763,7 +763,7 @@ struct CountedStruct
};
static QScopedPointer<QEventLoop> _e;
-static QThread *_t = Q_NULLPTR;
+static QThread *_t = nullptr;
class StaticEventLoop
{
@@ -827,7 +827,7 @@ void tst_QTimer::singleShotToFunctors()
_t->quit();
_t->wait();
_t->deleteLater();
- _t = Q_NULLPTR;
+ _t = nullptr;
{
QObject c3;
@@ -865,7 +865,7 @@ void tst_QTimer::singleShotToFunctors()
QCOMPARE(count, 5);
_e.reset();
- _t = Q_NULLPTR;
+ _t = nullptr;
}
void tst_QTimer::singleShot_chrono()
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 0d45159d09..5d19cb8428 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -4927,7 +4927,7 @@ void tst_QVariant::accessSequentialContainerKey()
{
QMap<QString, QObject*> mapping;
QString name = QString::fromLatin1("Seven");
- mapping.insert(name, Q_NULLPTR);
+ mapping.insert(name, nullptr);
QVariant variant = QVariant::fromValue(mapping);
diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
index 8f0d83ce32..c30efe4e3b 100644
--- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
@@ -6634,7 +6634,7 @@ void tst_QStateMachine::postEventFromBeginSelectTransitions()
{
class StateMachine : public QStateMachine {
protected:
- void beginSelectTransitions(QEvent* e) Q_DECL_OVERRIDE {
+ void beginSelectTransitions(QEvent* e) override {
if (e->type() == QEvent::Type(QEvent::User + 2))
postEvent(new QEvent(QEvent::Type(QEvent::User + 1)), QStateMachine::HighPriority);
}
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index 37b052bf1d..408a90afc4 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -1303,8 +1303,8 @@ QFuture<int> createExceptionResultFuture()
class DerivedException : public QException
{
public:
- void raise() const Q_DECL_OVERRIDE { throw *this; }
- DerivedException *clone() const Q_DECL_OVERRIDE { return new DerivedException(*this); }
+ void raise() const override { throw *this; }
+ DerivedException *clone() const override { return new DerivedException(*this); }
};
QFuture<void> createDerivedExceptionFuture()
@@ -1454,7 +1454,7 @@ void tst_QFuture::nonGlobalThreadPool()
return f;
}
- void run() Q_DECL_OVERRIDE
+ void run() override
{
const int ms = 100 + (qrand() % 100 - 100/2);
QThread::msleep(ms);
diff --git a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp
index 4ef3bab87f..126cb6b180 100644
--- a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp
+++ b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp
@@ -379,7 +379,7 @@ class WakeThreadBase : public TerminatingThread
public:
QAtomicInt *count;
- WakeThreadBase() : count(Q_NULLPTR) {}
+ WakeThreadBase() : count(nullptr) {}
};
class wake_Thread : public WakeThreadBase
diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
index c8373b6ae9..dcfb0aa042 100644
--- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
+++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
@@ -86,7 +86,7 @@ void tst_QLatin1String::nullString()
// default ctor
{
QLatin1String l1;
- QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR));
+ QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr));
QCOMPARE(l1.size(), 0);
QString s = l1;
@@ -95,9 +95,9 @@ void tst_QLatin1String::nullString()
// from nullptr
{
- const char *null = Q_NULLPTR;
+ const char *null = nullptr;
QLatin1String l1(null);
- QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR));
+ QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr));
QCOMPARE(l1.size(), 0);
QString s = l1;
@@ -111,7 +111,7 @@ void tst_QLatin1String::nullString()
QLatin1String l1(null);
QEXPECT_FAIL("", "null QByteArrays become non-null QLatin1Strings...", Continue);
- QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR));
+ QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr));
QCOMPARE(l1.size(), 0);
QString s = l1;
diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
index 145ba7ff72..deee7171b1 100644
--- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
+++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
@@ -68,7 +68,7 @@ void tst_QRingBuffer::constructing()
QCOMPARE(ringBuffer.size(), Q_INT64_C(0));
QVERIFY(ringBuffer.isEmpty());
QCOMPARE(ringBuffer.nextDataBlockSize(), Q_INT64_C(0));
- QVERIFY(ringBuffer.readPointer() == Q_NULLPTR);
+ QVERIFY(ringBuffer.readPointer() == nullptr);
QCOMPARE(ringBuffer.skip(5), Q_INT64_C(0));
QCOMPARE(ringBuffer.read(), QByteArray());
QCOMPARE(ringBuffer.getChar(), -1);
diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
index a4b06d1b3b..b943b04e23 100644
--- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
@@ -68,6 +68,7 @@ void tst_QScopedPointer::defaultConstructor()
/* Check that the members, one, is correctly initialized. */
QScopedPointer<int> p;
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
void tst_QScopedPointer::dataOnDefaultConstructed()
@@ -75,6 +76,7 @@ void tst_QScopedPointer::dataOnDefaultConstructed()
QScopedPointer<int> p;
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
class MyClass
@@ -113,6 +115,7 @@ void tst_QScopedPointer::reset()
QScopedPointer<int> p;
p.reset();
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
/* Call reset() on an active value. */
@@ -120,6 +123,7 @@ void tst_QScopedPointer::reset()
QScopedPointer<int> p(new int(3));
p.reset();
QCOMPARE(p.data(), static_cast<int *>(0));
+ QCOMPARE(p.get(), static_cast<int *>(0));
}
/* Call reset() with a value, on an active value. */
@@ -129,6 +133,7 @@ void tst_QScopedPointer::reset()
int *const value = new int(9);
p.reset(value);
QCOMPARE(*p.data(), 9);
+ QCOMPARE(*p.get(), 9);
}
/* Call reset() with a value, on default constructed value. */
@@ -138,6 +143,7 @@ void tst_QScopedPointer::reset()
int *const value = new int(9);
p.reset(value);
QCOMPARE(*p.data(), 9);
+ QCOMPARE(*p.get(), 9);
}
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 442d4d089c..c684af5418 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -272,6 +272,7 @@ void tst_QSharedPointer::basics()
QCOMPARE(!ptr, isNull);
QCOMPARE(ptr.data(), aData);
+ QCOMPARE(ptr.get(), aData);
QCOMPARE(ptr.operator->(), aData);
if (!isNull) {
Data &dataReference = *ptr;
@@ -316,6 +317,7 @@ void tst_QSharedPointer::basics()
QCOMPARE(copy.isNull(), isNull);
QCOMPARE(copy.data(), aData);
+ QCOMPARE(copy.get(), aData);
QVERIFY(copy == aData);
}
QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
@@ -349,6 +351,7 @@ void tst_QSharedPointer::basics()
QVERIFY(strong == weak);
QVERIFY(strong == ptr);
QCOMPARE(strong.data(), aData);
+ QCOMPARE(strong.get(), aData);
}
QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1);
@@ -362,11 +365,14 @@ void tst_QSharedPointer::operators()
QSharedPointer<char> p2(new char);
qptrdiff diff = p2.data() - p1.data();
QVERIFY(p1.data() != p2.data());
+ QVERIFY(p1.get() != p2.get());
QVERIFY(diff != 0);
// operator-
QCOMPARE(p2 - p1.data(), diff);
+ QCOMPARE(p2 - p1.get(), diff);
QCOMPARE(p2.data() - p1, diff);
+ QCOMPARE(p2.get() - p1, diff);
QCOMPARE(p2 - p1, diff);
QCOMPARE(p1 - p2, -diff);
QCOMPARE(p1 - p1, qptrdiff(0));
@@ -374,7 +380,9 @@ void tst_QSharedPointer::operators()
// operator<
QVERIFY(p1 < p2.data());
+ QVERIFY(p1 < p2.get());
QVERIFY(p1.data() < p2);
+ QVERIFY(p1.get() < p2);
QVERIFY(p1 < p2);
QVERIFY(!(p2 < p1));
QVERIFY(!(p2 < p2));
@@ -382,7 +390,9 @@ void tst_QSharedPointer::operators()
// qHash
QCOMPARE(qHash(p1), qHash(p1.data()));
+ QCOMPARE(qHash(p1), qHash(p1.get()));
QCOMPARE(qHash(p2), qHash(p2.data()));
+ QCOMPARE(qHash(p2), qHash(p2.get()));
}
void tst_QSharedPointer::nullptrOps()
@@ -396,11 +406,13 @@ void tst_QSharedPointer::nullptrOps()
QVERIFY(nullptr == p1);
QVERIFY(!p1);
QVERIFY(!p1.data());
+ QVERIFY(!p1.get());
QVERIFY(p2 == null);
QVERIFY(p2 == nullptr);
QVERIFY(nullptr == p2);
QVERIFY(!p2);
QVERIFY(!p2.data());
+ QVERIFY(!p2.get());
QVERIFY(p1 == p2);
QSharedPointer<char> p3 = p1;
@@ -409,6 +421,7 @@ void tst_QSharedPointer::nullptrOps()
QVERIFY(p3 == nullptr);
QVERIFY(nullptr == p3);
QVERIFY(!p3.data());
+ QVERIFY(!p3.get());
p3 = nullptr;
@@ -421,6 +434,7 @@ void tst_QSharedPointer::nullptrOps()
QSharedPointer<char> p4(new char);
QVERIFY(p4);
QVERIFY(p4.data());
+ QVERIFY(p4.get());
QVERIFY(p4 != nullptr);
QVERIFY(nullptr != p4);
QVERIFY(p4 != p1);
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 70ccc72630..f6840e60a8 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -249,7 +249,7 @@ class CharStarContainer
{
const char *str;
public:
- explicit Q_DECL_CONSTEXPR CharStarContainer(const char *s = Q_NULLPTR) : str(s) {}
+ explicit Q_DECL_CONSTEXPR CharStarContainer(const char *s = nullptr) : str(s) {}
Q_DECL_CONSTEXPR operator const char *() const { return str; }
};
@@ -1483,7 +1483,7 @@ void tst_QString::indexOf()
QRegularExpression re(QRegularExpression::escape(needle), options);
QCOMPARE( haystack.indexOf(re, startpos), resultpos );
- QCOMPARE(haystack.indexOf(re, startpos, Q_NULLPTR), resultpos);
+ QCOMPARE(haystack.indexOf(re, startpos, nullptr), resultpos);
QRegularExpressionMatch match;
QVERIFY(!match.hasMatch());
@@ -1608,7 +1608,7 @@ void tst_QString::indexOfInvalidRegex()
QTest::ignoreMessage(QtWarningMsg, "QString::indexOf: invalid QRegularExpression object");
QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\")), -1);
QTest::ignoreMessage(QtWarningMsg, "QString::indexOf: invalid QRegularExpression object");
- QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\"), -1, Q_NULLPTR), -1);
+ QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\"), -1, nullptr), -1);
QRegularExpressionMatch match;
QVERIFY(!match.hasMatch());
@@ -1706,7 +1706,7 @@ void tst_QString::lastIndexOf()
QRegularExpression re(QRegularExpression::escape(needle), options);
QCOMPARE(haystack.lastIndexOf(re, from), expected);
- QCOMPARE(haystack.lastIndexOf(re, from, Q_NULLPTR), expected);
+ QCOMPARE(haystack.lastIndexOf(re, from, nullptr), expected);
QRegularExpressionMatch match;
QVERIFY(!match.hasMatch());
QCOMPARE(haystack.lastIndexOf(re, from, &match), expected);
@@ -1743,7 +1743,7 @@ void tst_QString::lastIndexOfInvalidRegex()
QTest::ignoreMessage(QtWarningMsg, "QString::lastIndexOf: invalid QRegularExpression object");
QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), 0), -1);
QTest::ignoreMessage(QtWarningMsg, "QString::lastIndexOf: invalid QRegularExpression object");
- QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), -1, Q_NULLPTR), -1);
+ QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), -1, nullptr), -1);
QRegularExpressionMatch match;
QVERIFY(!match.hasMatch());
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index 374fec221e..56daea31fe 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -2803,7 +2803,7 @@ void tst_QVector::detachThreadSafety() const
static const uint threadsCount = 5;
struct : QThread {
- void run() Q_DECL_OVERRIDE
+ void run() override
{
QVector<T> copy(*detachThreadSafetyData<T>()->load());
QVERIFY(!copy.isDetached());
diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
index 79cd17b5b3..16a4200b5d 100644
--- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
@@ -576,6 +576,7 @@ private slots:
void invalidStringCharacters_data() const;
void invalidStringCharacters() const;
void hasError() const;
+ void readBack() const;
private:
static QByteArray readFile(const QString &filename);
@@ -1695,5 +1696,50 @@ void tst_QXmlStream::invalidStringCharacters_data() const
//
}
+static bool isValidSingleTextChar(const ushort c)
+{
+ // Conforms to https://www.w3.org/TR/REC-xml/#NT-Char - except for the high range, which is done
+ // with surrogates.
+ // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ static const QPair<ushort, ushort> validRanges[] = {
+ QPair<ushort, ushort>(0x9, 0xb),
+ QPair<ushort, ushort>(0xd, 0xe),
+ QPair<ushort, ushort>(0x20, 0xd800),
+ QPair<ushort, ushort>(0xe000, 0xfffe)
+ };
+
+ for (const QPair<ushort, ushort> &range : validRanges) {
+ if (c >= range.first && c < range.second)
+ return true;
+ }
+ return false;
+}
+
+void tst_QXmlStream::readBack() const
+{
+ for (ushort c = 0; c < std::numeric_limits<ushort>::max(); ++c) {
+ QBuffer buffer;
+
+ QVERIFY(buffer.open(QIODevice::WriteOnly));
+ QXmlStreamWriter writer(&buffer);
+ writer.writeStartDocument();
+ writer.writeTextElement("a", QString(QChar(c)));
+ writer.writeEndDocument();
+ buffer.close();
+
+ if (writer.hasError()) {
+ QVERIFY2(!isValidSingleTextChar(c), QByteArray::number(c));
+ } else {
+ QVERIFY2(isValidSingleTextChar(c), QByteArray::number(c));
+ QVERIFY(buffer.open(QIODevice::ReadOnly));
+ QXmlStreamReader reader(&buffer);
+ do {
+ reader.readNext();
+ } while (!reader.atEnd());
+ QVERIFY2(!reader.hasError(), QByteArray::number(c));
+ }
+ }
+}
+
#include "tst_qxmlstream.moc"
// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
index 58dee6f6ca..7200d1cc8a 100644
--- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
+++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
@@ -74,17 +74,17 @@ public:
initCount = resizeCount = paintCount = 0;
}
- void initializeGL() Q_DECL_OVERRIDE {
+ void initializeGL() override {
++initCount;
}
- void resizeGL(int w, int h) Q_DECL_OVERRIDE {
+ void resizeGL(int w, int h) override {
++resizeCount;
QCOMPARE(w, size().width());
QCOMPARE(h, size().height());
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
++paintCount;
QOpenGLContext *ctx = QOpenGLContext::currentContext();
@@ -144,7 +144,7 @@ void tst_QOpenGLWindow::basic()
class PainterWindow : public QOpenGLWindow
{
public:
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
QOpenGLContext *ctx = QOpenGLContext::currentContext();
QVERIFY(ctx);
QCOMPARE(ctx, context());
@@ -183,7 +183,7 @@ public:
PartialPainterWindow(QOpenGLWindow::UpdateBehavior u)
: QOpenGLWindow(u), x(0) { }
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
++paintCount;
QPainter p(this);
@@ -244,7 +244,7 @@ public:
Error
} m_state;
- void paintUnderGL() Q_DECL_OVERRIDE {
+ void paintUnderGL() override {
if (m_state == None || m_state == PaintOver)
m_state = PaintUnder;
else
@@ -255,7 +255,7 @@ public:
QCOMPARE(fbo, GLuint(0));
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
if (m_state == PaintUnder)
m_state = Paint;
else
@@ -268,7 +268,7 @@ public:
QCOMPARE(fbo, defaultFramebufferObject());
}
- void paintOverGL() Q_DECL_OVERRIDE {
+ void paintOverGL() override {
if (m_state == Paint)
m_state = PaintOver;
else
diff --git a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
index 41fcdf9f30..7fb79b28ae 100644
--- a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
+++ b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
@@ -54,7 +54,7 @@ class PainterWindow : public QRasterWindow
public:
void reset() { paintCount = 0; }
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE {
+ void paintEvent(QPaintEvent*) override {
++paintCount;
QPainter p(this);
p.fillRect(QRect(0, 0, 100, 100), Qt::blue);
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index ec143896ab..706c66ef14 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -48,7 +48,7 @@ public:
ulong timestamp;
QTouchDevice *deviceFromEvent;
- explicit tst_QTouchEventWidget(QWidget *parent = Q_NULLPTR) : QWidget(parent)
+ explicit tst_QTouchEventWidget(QWidget *parent = nullptr) : QWidget(parent)
{
reset();
}
@@ -63,7 +63,7 @@ public:
deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false;
}
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
switch (event->type()) {
case QEvent::TouchBegin:
@@ -117,7 +117,7 @@ public:
bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd;
tst_QTouchEventGraphicsItem **weakpointer;
- explicit tst_QTouchEventGraphicsItem(QGraphicsItem *parent = Q_NULLPTR)
+ explicit tst_QTouchEventGraphicsItem(QGraphicsItem *parent = nullptr)
: QGraphicsItem(parent), weakpointer(0)
{
reset();
@@ -140,13 +140,13 @@ public:
deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false;
}
- QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(0, 0, 10, 10); }
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
+ QRectF boundingRect() const override { return QRectF(0, 0, 10, 10); }
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
{
painter->fillRect(QRectF(QPointF(0, 0), boundingRect().size()), Qt::yellow);
}
- bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE
+ bool sceneEvent(QEvent *event) override
{
switch (event->type()) {
case QEvent::TouchBegin:
@@ -1628,7 +1628,7 @@ class WindowTouchEventFilter : public QObject
{
Q_OBJECT
public:
- bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *obj, QEvent *event) override;
struct TouchInfo {
QList<QTouchEvent::TouchPoint> points;
QEvent::Type lastSeenType;
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index fc9f50b15c..24f61e4584 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -352,7 +352,7 @@ private:
class ColoredWindow : public QRasterWindow {
public:
explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {}
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
+ void paintEvent(QPaintEvent *) override
{
QPainter p(this);
p.fillRect(QRect(QPoint(0, 0), size()), m_color);
@@ -698,7 +698,7 @@ class PlatformWindowFilter : public QObject
public:
PlatformWindowFilter(QObject *parent = 0)
: QObject(parent)
- , m_window(Q_NULLPTR)
+ , m_window(nullptr)
, m_alwaysExisted(true)
{}
@@ -710,7 +710,7 @@ public:
// If they are, the native platform surface should always exist when we
// receive a QPlatformSurfaceEvent
if (e->type() == QEvent::PlatformSurface && o == m_window) {
- m_alwaysExisted &= (m_window->handle() != Q_NULLPTR);
+ m_alwaysExisted &= (m_window->handle() != nullptr);
}
return false;
}
@@ -737,7 +737,7 @@ void tst_QWindow::platformSurface()
QTRY_COMPARE(window.received(QEvent::PlatformSurface), 1);
QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceCreated);
- QTRY_VERIFY(window.handle() != Q_NULLPTR);
+ QTRY_VERIFY(window.handle() != nullptr);
window.destroy();
QTRY_COMPARE(window.received(QEvent::PlatformSurface), 2);
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 6d9456fa69..f23eb70a36 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -1593,7 +1593,7 @@ void tst_QOpenGL::defaultQGLCurrentBuffer()
ctx->makeCurrent(surface.data());
// Bind default FBO on the current context, and record what's the current QGL FBO. It should
- // be Q_NULLPTR because the default platform OpenGL FBO is not backed by a
+ // be nullptr because the default platform OpenGL FBO is not backed by a
// QOpenGLFramebufferObject.
QOpenGLFramebufferObject::bindDefault();
QOpenGLFramebufferObject *defaultQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo;
diff --git a/tests/auto/gui/qvulkan/tst_qvulkan.cpp b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
index 8027935003..716d49a2f1 100644
--- a/tests/auto/gui/qvulkan/tst_qvulkan.cpp
+++ b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
@@ -166,7 +166,7 @@ static void waitForUnexposed(QWindow *w)
if (remaining <= 0)
break;
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
- QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QTest::qSleep(10);
}
}
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index f4e3356ad0..9ade3b554e 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -862,19 +862,19 @@ void tst_QStaticText::textDocumentColor()
class TestPaintEngine: public QPaintEngine
{
public:
- void drawTextItem(const QPointF &p, const QTextItem &) Q_DECL_OVERRIDE
+ void drawTextItem(const QPointF &p, const QTextItem &) override
{
differentVerticalPositions.insert(qRound(p.y()));
}
- void updateState(const QPaintEngineState &) Q_DECL_OVERRIDE {}
+ void updateState(const QPaintEngineState &) override {}
- void drawPolygon(const QPointF *, int , PolygonDrawMode ) Q_DECL_OVERRIDE {}
+ void drawPolygon(const QPointF *, int , PolygonDrawMode ) override {}
- bool begin(QPaintDevice *) Q_DECL_OVERRIDE { return true; }
- bool end() Q_DECL_OVERRIDE { return true; }
- void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) Q_DECL_OVERRIDE {}
- Type type() const Q_DECL_OVERRIDE
+ bool begin(QPaintDevice *) override { return true; }
+ bool end() override { return true; }
+ void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {}
+ Type type() const override
{
return User;
}
diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h
index 10d0e86736..f89e04cc0d 100644
--- a/tests/auto/network/access/http2/http2srv.h
+++ b/tests/auto/network/access/http2/http2srv.h
@@ -129,7 +129,7 @@ private slots:
void readReady();
private:
- void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
+ void incomingConnection(qintptr socketDescriptor) override;
quint32 clientSetting(Http2::Settings identifier, quint32 defaultValue);
bool readMethodLine();
diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
index ec965a61b2..edfef09a96 100644
--- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
+++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
@@ -104,7 +104,7 @@ void tst_QHttpNetworkReply::parseHeader()
class TestHeaderSocket : public QAbstractSocket
{
public:
- explicit TestHeaderSocket(const QByteArray &input) : QAbstractSocket(QAbstractSocket::TcpSocket, Q_NULLPTR)
+ explicit TestHeaderSocket(const QByteArray &input) : QAbstractSocket(QAbstractSocket::TcpSocket, nullptr)
{
inputBuffer.setData(input);
inputBuffer.open(QIODevice::ReadOnly | QIODevice::Unbuffered);
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index e995b69f60..40e909113e 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -30,6 +30,7 @@
#include <QtTest/QtTest>
#include <QtCore/QCryptographicHash>
#include <QtCore/QDataStream>
+#include <QtCore/QTextStream>
#include <QtCore/QUrl>
#include <QtCore/QEventLoop>
#include <QtCore/QFile>
@@ -527,7 +528,9 @@ static void setupSslServer(QSslSocket* serverSocket)
}
#endif
-// Does not work for POST/PUT!
+// NOTE: MiniHttpServer has a very limited support of PUT/POST requests! Make
+// sure you understand the server's code before PUTting/POSTing data (and
+// probably you'll have to update the logic).
class MiniHttpServer: public QTcpServer
{
Q_OBJECT
@@ -541,6 +544,7 @@ public:
bool ipv6;
bool multiple;
int totalConnections;
+ bool parseHeaders = false;
MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false)
: dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6),
@@ -566,6 +570,12 @@ public:
dataToTransmit = data;
}
+ void clearHeaderParserState()
+ {
+ expectPayload = false;
+ receivedData.clear();
+ }
+
protected:
void incomingConnection(qintptr socketDescriptor)
{
@@ -635,13 +645,29 @@ private slots:
}
public slots:
+
void readyReadSlot()
{
Q_ASSERT(!client.isNull());
+ if (expectPayload) {
+ // NOTE: this works only for the test using POST/PUT requests to this
+ // local HTTP server, fortunately we know that data is very small
+ // (7 bytes) and we can safely read/discard it here:
+ client->readAll();
+ return reply();
+ }
+
receivedData += client->readAll();
int doubleEndlPos = receivedData.indexOf("\r\n\r\n");
if (doubleEndlPos != -1) {
+ if (parseHeaders) {
+ parseRequest();
+ if (expectPayload && doubleEndlPos + 4 == receivedData.size()) {
+ // Wait for more incoming (POST/PUT) data.
+ return;
+ }
+ }
// multiple requests incoming. remove the bytes of the current one
if (multiple)
receivedData.remove(0, doubleEndlPos+4);
@@ -664,6 +690,18 @@ public slots:
{
ready.release();
}
+
+private:
+ void parseRequest()
+ {
+ Q_ASSERT(parseHeaders);
+ QTextStream parser(receivedData, QIODevice::ReadOnly);
+ const QString line(parser.readLine());
+ expectPayload = line.startsWith(QLatin1Literal("POST"))
+ || line.startsWith(QLatin1Literal("PUT"));
+ }
+
+ bool expectPayload = false;
};
class MyCookieJar: public QNetworkCookieJar
@@ -7228,6 +7266,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
manager.setCache(diskCache);
MiniHttpServer server(getReply);
+ server.parseHeaders = true;
QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
QNetworkReplyPtr reply(manager.get(request));
@@ -7239,6 +7278,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("GET"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), false);
+ server.clearHeaderParserState();
server.setDataToTransmit(getReply);
reply.reset(manager.get(request));
QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply));
@@ -7248,6 +7288,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("GET"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), true);
+ server.clearHeaderParserState();
server.setDataToTransmit(postReply);
request.setRawHeader("Content-Type", "text/plain");
reply.reset(manager.post(request, postData));
@@ -7260,6 +7301,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("POST"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), false);
+ server.clearHeaderParserState();
server.setDataToTransmit(getReply);
reply.reset(manager.get(request));
@@ -7270,6 +7312,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("GET"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), false);
+ server.clearHeaderParserState();
server.setDataToTransmit(getReply);
reply.reset(manager.get(request));
@@ -7280,6 +7323,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("GET"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), true);
+ server.clearHeaderParserState();
server.setDataToTransmit(putReply);
reply.reset(manager.put(request, postData));
@@ -7289,6 +7333,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), false);
+ server.clearHeaderParserState();
server.setDataToTransmit(getReply);
reply.reset(manager.get(request));
@@ -7299,6 +7344,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QCOMPARE(reply->readAll(), QByteArray("GET"));
QCOMPARE(reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(), false);
+ server.clearHeaderParserState();
server.setDataToTransmit(getReply);
reply.reset(manager.get(request));
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 7760138067..0d538865a3 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -476,7 +476,7 @@ void tst_QLocalSocket::connectWithOldOpen()
class OverriddenOpen : public LocalSocket
{
public:
- virtual bool open(OpenMode mode) Q_DECL_OVERRIDE
+ virtual bool open(OpenMode mode) override
{ return QIODevice::open(mode); }
};
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 7340817ade..493263f2b8 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -3126,7 +3126,7 @@ void tst_QTcpSocket::readNotificationsAfterBind()
if (setProxy)
return;
- QAbstractSocket socket(QAbstractSocket::TcpSocket, Q_NULLPTR);
+ QAbstractSocket socket(QAbstractSocket::TcpSocket, nullptr);
QVERIFY2(socket.bind(), "Bind error!");
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp
index 611f9e904b..1f4a96f7b6 100644
--- a/tests/auto/other/modeltest/modeltest.cpp
+++ b/tests/auto/other/modeltest/modeltest.cpp
@@ -28,61 +28,66 @@
#include "modeltest.h"
-#include <QtCore/QtCore>
#include <QtTest/QtTest>
+Q_LOGGING_CATEGORY(lcModelTest, "qt.modeltest")
+
/*!
Connect to all of the models signals. Whenever anything happens recheck everything.
*/
-ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(parent),
- model(_model),
- fetchingMore(false)
+ModelTest::ModelTest(QAbstractItemModel *model, QObject *parent)
+ : QObject(parent),
+ model(model),
+ fetchingMore(false)
{
if (!model)
qFatal("%s: model must not be null", Q_FUNC_INFO);
- connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()));
- connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()));
- connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()));
- connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
- connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()));
+ connect(model, &QAbstractItemModel::columnsAboutToBeInserted,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::columnsAboutToBeRemoved,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::columnsInserted,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::columnsRemoved,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::dataChanged,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::headerDataChanged,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::layoutAboutToBeChanged,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::layoutChanged,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::modelReset,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::rowsAboutToBeInserted,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::rowsAboutToBeRemoved,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::rowsInserted,
+ this, &ModelTest::runAllTests);
+ connect(model, &QAbstractItemModel::rowsRemoved,
+ this, &ModelTest::runAllTests);
// Special checks for changes
- connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(layoutAboutToBeChanged()));
- connect(model, SIGNAL(layoutChanged()),
- this, SLOT(layoutChanged()));
-
- connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(rowsInserted(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(rowsRemoved(QModelIndex,int,int)));
- connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)));
- connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
- this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
+ connect(model, &QAbstractItemModel::layoutAboutToBeChanged,
+ this, &ModelTest::layoutAboutToBeChanged);
+ connect(model, &QAbstractItemModel::layoutChanged,
+ this, &ModelTest::layoutChanged);
+
+ connect(model, &QAbstractItemModel::rowsAboutToBeInserted,
+ this, &ModelTest::rowsAboutToBeInserted);
+ connect(model, &QAbstractItemModel::rowsAboutToBeRemoved,
+ this, &ModelTest::rowsAboutToBeRemoved);
+ connect(model, &QAbstractItemModel::rowsInserted,
+ this, &ModelTest::rowsInserted);
+ connect(model, &QAbstractItemModel::rowsRemoved,
+ this, &ModelTest::rowsRemoved);
+ connect(model, &QAbstractItemModel::dataChanged,
+ this, &ModelTest::dataChanged);
+ connect(model, &QAbstractItemModel::headerDataChanged,
+ this, &ModelTest::headerDataChanged);
runAllTests();
}
@@ -142,7 +147,6 @@ void ModelTest::nonDestructiveBasicTest()
*/
void ModelTest::rowCount()
{
-// qDebug() << "rc";
// check top row
QModelIndex topIndex = model->index(0, 0, QModelIndex());
int rows = model->rowCount(topIndex);
@@ -186,7 +190,6 @@ void ModelTest::columnCount()
*/
void ModelTest::hasIndex()
{
-// qDebug() << "hi";
// Make sure that invalid values returns an invalid index
QVERIFY(!model->hasIndex(-2, -2));
QVERIFY(!model->hasIndex(-2, 0));
@@ -211,7 +214,6 @@ void ModelTest::hasIndex()
*/
void ModelTest::index()
{
-// qDebug() << "i";
// Make sure that invalid values returns an invalid index
QVERIFY(!model->index(-2, -2).isValid());
QVERIFY(!model->index(-2, 0).isValid());
@@ -241,7 +243,6 @@ void ModelTest::index()
*/
void ModelTest::parent()
{
-// qDebug() << "p";
// Make sure the model won't crash and will return an invalid QModelIndex
// when asked for the parent of an invalid index.
QVERIFY(!model->parent(QModelIndex()).isValid());
@@ -309,8 +310,8 @@ void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
fetchingMore = false;
}
- int rows = model->rowCount(parent);
- int columns = model->columnCount(parent);
+ const int rows = model->rowCount(parent);
+ const int columns = model->columnCount(parent);
if (rows > 0)
QVERIFY(model->hasChildren(parent));
@@ -321,9 +322,6 @@ void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
if (rows > 0)
QVERIFY(model->hasChildren(parent));
- //qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
- // << "columns:" << columns << "parent column:" << parent.column();
-
const QModelIndex topLeftChild = model->index(0, 0, parent);
QVERIFY(!model->hasIndex(rows + 1, 0, parent));
@@ -339,7 +337,7 @@ void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
QModelIndex index = model->index(r, c, parent);
// rowCount() and columnCount() said that it existed...
if (!index.isValid())
- qWarning() << "Got invalid index at row=" << r << "col=" << c << "parent=" << parent;
+ qCWarning(lcModelTest) << "Got invalid index at row=" << r << "col=" << c << "parent=" << parent;
QVERIFY(index.isValid());
// index() should always return the same index when called twice in a row
@@ -364,30 +362,22 @@ void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
QCOMPARE(index.model(), model);
QCOMPARE(index.row(), r);
QCOMPARE(index.column(), c);
- // While you can technically return a QVariant usually this is a sign
- // of a bug in data(). Disable if this really is ok in your model.
-// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
// If the next test fails here is some somewhat useful debug you play with.
-
if (model->parent(index) != parent) {
- qDebug() << r << c << currentDepth << model->data(index).toString()
- << model->data(parent).toString();
- qDebug() << index << parent << model->parent(index);
-// And a view that you can even use to show the model.
-// QTreeView view;
-// view.setModel(model);
-// view.show();
+ qCWarning(lcModelTest) << "Inconsistent parent() implementation detected:";
+ qCWarning(lcModelTest) << " index=" << index << "exp. parent=" << parent << "act. parent=" << model->parent(index);
+ qCWarning(lcModelTest) << " row=" << r << "col=" << c << "depth=" << currentDepth;
+ qCWarning(lcModelTest) << " data for child" << model->data(index).toString();
+ qCWarning(lcModelTest) << " data for parent" << model->data(parent).toString();
}
// Check that we can get back our real parent.
QCOMPARE(model->parent(index), parent);
// recursively go down the children
- if (model->hasChildren(index) && currentDepth < 10) {
- //qDebug() << r << c << "has children" << model->rowCount(index);
+ if (model->hasChildren(index) && currentDepth < 10)
checkChildren(index, ++currentDepth);
- }/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/
// make sure that after testing the children that the index doesn't change.
QModelIndex newerIndex = model->index(r, c, parent);
@@ -465,12 +455,14 @@ void ModelTest::data()
\sa rowsInserted()
*/
-void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int /* end */)
+void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
{
-// Q_UNUSED(end);
-// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
-// << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
-// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
+ qCDebug(lcModelTest) << "rowsAboutToBeInserted"
+ << "start=" << start << "end=" << end << "parent=" << parent
+ << "parent data=" << model->data(parent).toString()
+ << "current count of parent=" << model->rowCount(parent)
+ << "last before insertion=" << model->index(start - 1, 0, parent) << model->data(model->index(start - 1, 0, parent));
+
Changing c;
c.parent = parent;
c.oldSize = model->rowCount(parent);
@@ -486,16 +478,19 @@ void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int
*/
void ModelTest::rowsInserted(const QModelIndex &parent, int start, int end)
{
+ qCDebug(lcModelTest) << "rowsInserted"
+ << "start=" << start << "end=" << end << "parent=" << parent
+ << "parent data=" << model->data(parent).toString()
+ << "current count of parent=" << model->rowCount(parent);
+
+ for (int i = start; i <= end; ++i) {
+ qCDebug(lcModelTest) << " itemWasInserted:" << i
+ << model->index(i, 0, parent).data();
+ }
+
+
Changing c = insert.pop();
QCOMPARE(parent, c.parent);
-// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
-// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
-
-// for (int ii=start; ii <= end; ii++)
-// {
-// qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
-// }
-// qDebug();
QCOMPARE(model->rowCount(parent), c.oldSize + (end - start + 1));
QCOMPARE(model->data(model->index(start - 1, 0, c.parent)), c.last);
@@ -532,7 +527,12 @@ void ModelTest::layoutChanged()
*/
void ModelTest::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
- qDebug() << "ratbr" << parent << start << end;
+ qCDebug(lcModelTest) << "rowsAboutToBeRemoved"
+ << "start=" << start << "end=" << end << "parent=" << parent
+ << "parent data=" << model->data(parent).toString()
+ << "current count of parent=" << model->rowCount(parent)
+ << "last before removal=" << model->index(start - 1, 0, parent) << model->data(model->index(start - 1, 0, parent));
+
Changing c;
c.parent = parent;
c.oldSize = model->rowCount(parent);
@@ -548,7 +548,11 @@ void ModelTest::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e
*/
void ModelTest::rowsRemoved(const QModelIndex &parent, int start, int end)
{
- qDebug() << "rr" << parent << start << end;
+ qCDebug(lcModelTest) << "rowsRemoved"
+ << "start=" << start << "end=" << end << "parent=" << parent
+ << "parent data=" << model->data(parent).toString()
+ << "current count of parent=" << model->rowCount(parent);
+
Changing c = remove.pop();
QCOMPARE(parent, c.parent);
QCOMPARE(model->rowCount(parent), c.oldSize - (end - start + 1));
diff --git a/tests/auto/other/modeltest/modeltest.h b/tests/auto/other/modeltest/modeltest.h
index 4676bf4434..9d09c6da5b 100644
--- a/tests/auto/other/modeltest/modeltest.h
+++ b/tests/auto/other/modeltest/modeltest.h
@@ -38,9 +38,9 @@ class ModelTest : public QObject
Q_OBJECT
public:
- ModelTest(QAbstractItemModel *model, QObject *parent = 0);
+ ModelTest(QAbstractItemModel *model, QObject *parent = nullptr);
-private Q_SLOTS:
+private:
void nonDestructiveBasicTest();
void rowCount();
void columnCount();
@@ -49,7 +49,6 @@ private Q_SLOTS:
void parent();
void data();
-protected Q_SLOTS:
void runAllTests();
void layoutAboutToBeChanged();
void layoutChanged();
@@ -60,7 +59,6 @@ protected Q_SLOTS:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void headerDataChanged(Qt::Orientation orientation, int start, int end);
-private:
void checkChildren(const QModelIndex &parent, int currentDepth = 0);
QAbstractItemModel *model;
diff --git a/tests/auto/other/qaccessibility/accessiblewidgets.h b/tests/auto/other/qaccessibility/accessiblewidgets.h
index 0c337a72f4..d436f81d17 100644
--- a/tests/auto/other/qaccessibility/accessiblewidgets.h
+++ b/tests/auto/other/qaccessibility/accessiblewidgets.h
@@ -47,7 +47,7 @@ class QtTestAccessibleWidgetIface: public QAccessibleWidget
{
public:
QtTestAccessibleWidgetIface(QtTestAccessibleWidget *w): QAccessibleWidget(w) {}
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE
+ QString text(QAccessible::Text t) const override
{
if (t == QAccessible::Help)
return QString::fromLatin1("Help yourself");
diff --git a/tests/auto/tools/moc/cxx11-explicit-override-control.h b/tests/auto/tools/moc/cxx11-explicit-override-control.h
index f361a47248..2211112717 100644
--- a/tests/auto/tools/moc/cxx11-explicit-override-control.h
+++ b/tests/auto/tools/moc/cxx11-explicit-override-control.h
@@ -132,17 +132,17 @@ public:
: ExplicitOverrideControlBase(parent) {}
private Q_SLOTS:
- void pureSlot0() Q_DECL_OVERRIDE {}
- void pureSlot1() Q_DECL_OVERRIDE {}
- void pureSlot2() const Q_DECL_OVERRIDE {}
- void pureSlot3() Q_DECL_OVERRIDE const {}
+ void pureSlot0() override {}
+ void pureSlot1() override {}
+ void pureSlot2() const override {}
+ void pureSlot3() override const {}
#if 0 // moc doesn't support volatile slots
- void pureSlot4() volatile Q_DECL_OVERRIDE {}
- void pureSlot5() Q_DECL_OVERRIDE volatile {}
- void pureSlot6() const volatile Q_DECL_OVERRIDE {}
- void pureSlot7() volatile Q_DECL_OVERRIDE const {}
- void pureSlot8() const Q_DECL_OVERRIDE volatile {}
- void pureSlot9() Q_DECL_OVERRIDE volatile const {}
+ void pureSlot4() volatile override {}
+ void pureSlot5() override volatile {}
+ void pureSlot6() const volatile override {}
+ void pureSlot7() volatile override const {}
+ void pureSlot8() const override volatile {}
+ void pureSlot9() override volatile const {}
#endif
};
@@ -176,17 +176,17 @@ public:
: ExplicitOverrideControlBase(parent) {}
private Q_SLOTS:
- void pureSlot0() Q_DECL_FINAL Q_DECL_OVERRIDE {}
- void pureSlot1() Q_DECL_OVERRIDE Q_DECL_FINAL {}
- void pureSlot2() Q_DECL_OVERRIDE const Q_DECL_FINAL {}
- void pureSlot3() Q_DECL_FINAL const Q_DECL_OVERRIDE {}
+ void pureSlot0() Q_DECL_FINAL override {}
+ void pureSlot1() override Q_DECL_FINAL {}
+ void pureSlot2() override const Q_DECL_FINAL {}
+ void pureSlot3() Q_DECL_FINAL const override {}
#if 0 // moc doesn't support volatile slots
- void pureSlot4() volatile Q_DECL_FINAL Q_DECL_OVERRIDE {}
- void pureSlot5() Q_DECL_OVERRIDE Q_DECL_FINAL volatile {}
- void pureSlot6() Q_DECL_OVERRIDE const volatile Q_DECL_FINAL {}
- void pureSlot7() volatile Q_DECL_OVERRIDE Q_DECL_FINAL const {}
- void pureSlot8() const Q_DECL_FINAL Q_DECL_OVERRIDE volatile {}
- void pureSlot9() Q_DECL_FINAL volatile const Q_DECL_OVERRIDE {}
+ void pureSlot4() volatile Q_DECL_FINAL override {}
+ void pureSlot5() override Q_DECL_FINAL volatile {}
+ void pureSlot6() override const volatile Q_DECL_FINAL {}
+ void pureSlot7() volatile override Q_DECL_FINAL const {}
+ void pureSlot8() const Q_DECL_FINAL override volatile {}
+ void pureSlot9() Q_DECL_FINAL volatile const override {}
#endif
};
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 55e8054a70..542626adab 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -163,7 +163,7 @@ class CreatableGadget
public:
Q_INVOKABLE CreatableGadget()
{
- CreatableGadget::qt_static_metacall((QObject*)this, QMetaObject::ReadProperty, -1, Q_NULLPTR);
+ CreatableGadget::qt_static_metacall((QObject*)this, QMetaObject::ReadProperty, -1, nullptr);
}
};
@@ -223,7 +223,7 @@ namespace {
{
Q_OBJECT
public:
- explicit ObjectInUnnamedNS(QObject *parent = Q_NULLPTR) : QObject(parent) {}
+ explicit ObjectInUnnamedNS(QObject *parent = nullptr) : QObject(parent) {}
};
}
@@ -3768,7 +3768,7 @@ void tst_Moc::veryLongStringData()
void tst_Moc::gadgetHierarchy()
{
- QCOMPARE(NonGadgetParent::Derived::staticMetaObject.superClass(), static_cast<const QMetaObject*>(Q_NULLPTR));
+ QCOMPARE(NonGadgetParent::Derived::staticMetaObject.superClass(), static_cast<const QMetaObject*>(nullptr));
QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject);
}
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index 62286d703f..259de49c67 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -338,7 +338,7 @@ class SelfDestructParent : public QWidget
Q_OBJECT
public:
explicit SelfDestructParent(int delay = 100)
- : QWidget(Q_NULLPTR)
+ : QWidget(nullptr)
{
QTimer::singleShot(delay, this, SLOT(deleteLater()));
}
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 4441337f6e..50f87b2c70 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -134,10 +134,10 @@ class ExecCloseHelper : public QObject
public:
enum { CloseWindow = -1 };
- explicit ExecCloseHelper(QObject *parent = Q_NULLPTR)
- : QObject(parent), m_key(0), m_timerId(0), m_testCandidate(Q_NULLPTR) { }
+ explicit ExecCloseHelper(QObject *parent = nullptr)
+ : QObject(parent), m_key(0), m_timerId(0), m_testCandidate(nullptr) { }
- void start(int key, QWidget *testCandidate = Q_NULLPTR)
+ void start(int key, QWidget *testCandidate = nullptr)
{
m_key = key;
m_testCandidate = testCandidate;
@@ -147,7 +147,7 @@ public:
bool done() const { return !m_timerId; }
protected:
- void timerEvent(QTimerEvent *te) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *te) override;
private:
int m_key;
@@ -172,7 +172,7 @@ void ExecCloseHelper::timerEvent(QTimerEvent *te)
QKeyEvent *ke = new QKeyEvent(QEvent::KeyPress, m_key, Qt::NoModifier);
QCoreApplication::postEvent(m_testCandidate, ke);
}
- m_testCandidate = Q_NULLPTR;
+ m_testCandidate = nullptr;
killTimer(m_timerId);
m_timerId = m_key = 0;
}
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 44b7894c53..00d640e55e 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -255,10 +255,10 @@ class QTestTranslator : public QTranslator
public:
explicit QTestTranslator(QString str) : m_str(qMove(str)) {}
- QString translate(const char *, const char *sourceText, const char *, int) const Q_DECL_OVERRIDE
+ QString translate(const char *, const char *sourceText, const char *, int) const override
{ return m_str + sourceText + m_str; }
- bool isEmpty() const Q_DECL_OVERRIDE { return false; }
+ bool isEmpty() const override { return false; }
};
template <typename Translator>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 96827022a8..63fe2e6cb4 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -1110,11 +1110,11 @@ void tst_QGraphicsItem::visible()
scene.addItem(item);
QVERIFY(item->isVisible());
- QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item);
item->setVisible(false);
QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
item->setVisible(true);
- QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item);
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
event.setButton(Qt::LeftButton);
@@ -5503,16 +5503,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
QGraphicsScene scene;
scene.addItem(parent);
- QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
+ QCOMPARE(scene.items(QPointF(5, 5)).value(0, nullptr), (QGraphicsItem *)parent);
QVERIFY(scene.items(QPointF(15, 5)).isEmpty());
QVERIFY(scene.items(QPointF(5, 15)).isEmpty());
QVERIFY(scene.items(QPointF(60, 60)).isEmpty());
QVERIFY(scene.items(QPointF(140, 60)).isEmpty());
QVERIFY(scene.items(QPointF(60, 140)).isEmpty());
QVERIFY(scene.items(QPointF(140, 140)).isEmpty());
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2);
- QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
- QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child2);
+ QCOMPARE(scene.items(QPointF(75, 100)).value(0, nullptr), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(100, 75)).value(0, nullptr), (QGraphicsItem *)child1);
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
image.fill(0);
@@ -5547,9 +5547,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
grandchild->setPos( 50, 50 );
parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
- QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
- QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)parent);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild);
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
// Move child to fully overlap the parent. The grandchild should
@@ -5557,9 +5557,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
child->prepareGeometryChange();
child->setPos( 0, 0 );
- QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
- QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild);
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
}
@@ -5832,8 +5832,8 @@ void tst_QGraphicsItem::itemClippingDiscovery()
rightRectItem->setParentItem(clipItem);
// The rects item are both visible at these points.
- QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem);
- QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem);
+ QCOMPARE(scene.items(QPointF(10, 10)).value(0, nullptr), (QGraphicsItem *)leftRectItem);
+ QCOMPARE(scene.items(QPointF(90, 90)).value(0, nullptr), (QGraphicsItem *)rightRectItem);
// The ellipse clips the rects now.
clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
@@ -5873,7 +5873,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// First test that both items are searched if no optimization flags are set
- QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, nullptr);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5884,7 +5884,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// Repeat the test to make sure that no caching/indexing is in effect
- item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ item = scene.items(QPointF(25, 5)).value(0, nullptr);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5897,7 +5897,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
// Set the optimization flag and make sure that the child is not returned
// and that the child's boundingRect() method is never called.
parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
- item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ item = scene.items(QPointF(25, 5)).value(0, nullptr);
QVERIFY(!(item));
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 0f5277710c..97f3eb4a60 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -894,7 +894,7 @@ public:
: QProxyStyle(key),
horizontalSpacing(-1), verticalSpacing(-1) {}
- virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (pm == QStyle::PM_LayoutHorizontalSpacing && horizontalSpacing >= 0) {
return horizontalSpacing;
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 7615c5e821..6e4da153d2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -295,7 +295,7 @@ void tst_QGraphicsScene::construction()
static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y)
{
- return scene.items(QPointF(x, y)).value(0, Q_NULLPTR);
+ return scene.items(QPointF(x, y)).value(0, nullptr);
}
void tst_QGraphicsScene::sceneRect()
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 1be17b552e..85b42e54fe 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -2059,10 +2059,10 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty());
widget->setGeometry(0, 112, 360, 528);
- QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget);
widget2->setGeometry(0, 573, 360, 67);
- QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
- QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, nullptr), (QGraphicsItem *)widget2);
}
void tst_QGraphicsWidget::defaultSize()
@@ -3461,12 +3461,12 @@ void tst_QGraphicsWidget::QTBUG_45867_send_itemChildAddedChange_to_parent()
{
}
- QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(); }
+ QRectF boundingRect() const override { return QRectF(); }
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE {}
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override {}
protected:
- QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
+ QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override
{
if (change == QGraphicsItem::ItemChildAddedChange)
++m_itemChildAddedChangeNotificationsCount;
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index a63ca49cbb..0fbb909646 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -86,7 +86,7 @@ public:
GeometriesTestView() : QTableView(), updateGeometriesCalled(false) {}
bool updateGeometriesCalled;
protected slots:
- void updateGeometries() Q_DECL_OVERRIDE { updateGeometriesCalled = true; QTableView::updateGeometries(); }
+ void updateGeometries() override { updateGeometriesCalled = true; QTableView::updateGeometries(); }
};
class tst_QAbstractItemView : public QObject
@@ -1562,7 +1562,7 @@ public:
QItemDelegate(parent)
{}
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE {
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override {
Q_UNUSED(index);
static bool w = true;
editor->setEnabled(w);
@@ -2006,7 +2006,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
{
}
- void setSelectionModel(QItemSelectionModel *model) Q_DECL_OVERRIDE
+ void setSelectionModel(QItemSelectionModel *model) override
{
m_deselectedMustBeEmpty = !selectionModel() || !model || selectionModel()->model() != model->model();
QListView::setSelectionModel(model);
@@ -2016,7 +2016,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
bool selectionChangedOk() const { return m_selectionChangedOk; }
protected:
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE
+ bool viewportEvent(QEvent *event) override
{
if (event->type() == QEvent::Paint)
++m_paintEventsCount;
@@ -2024,7 +2024,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
}
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected) Q_DECL_OVERRIDE
+ const QItemSelection &deselected) override
{
if (m_deselectedMustBeEmpty && !deselected.isEmpty())
m_selectionChangedOk = false;
@@ -2147,7 +2147,7 @@ signals:
void setSelectionCalled(const QRect &rect);
protected:
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) Q_DECL_OVERRIDE
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) override
{
emit setSelectionCalled(rect);
QListView::setSelection(rect, flags);
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index b13e7b2f33..fea41f64a3 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -1799,7 +1799,7 @@ class TestHeaderViewStyle : public QProxyStyle
{
public:
TestHeaderViewStyle() : horizontalSectionSize(100) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_HeaderDefaultSectionSizeHorizontal)
return horizontalSectionSize;
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index b9785c35ac..11bd118e4b 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -288,7 +288,7 @@ public:
class ScrollPerItemListView : public QListView
{
public:
- explicit ScrollPerItemListView(QWidget *parent = Q_NULLPTR)
+ explicit ScrollPerItemListView(QWidget *parent = nullptr)
: QListView(parent)
{
// Force per item scroll mode since it comes from the style by default
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 45d33df356..e761ce2833 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -171,6 +171,7 @@ private slots:
void statusTip_data();
void statusTip();
+ void fetchMoreOnScroll();
// task-specific tests:
void task174627_moveLeftToRoot();
@@ -2513,7 +2514,7 @@ class TestTreeViewStyle : public QProxyStyle
{
public:
TestTreeViewStyle() : indentation(20) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_TreeViewIndentation)
return indentation;
@@ -4470,5 +4471,49 @@ void tst_QTreeView::statusTip()
QTest::mouseMove(mw.windowHandle(), centerPoint);
QTRY_COMPARE(mw.statusBar()->currentMessage(), QLatin1String("Header 0 -- Status"));
}
+
+class FetchMoreModel : public QStandardItemModel
+{
+public:
+ FetchMoreModel() : QStandardItemModel(), canFetchReady(false)
+ {
+ for (int i = 0; i < 20; ++i) {
+ QStandardItem *item = new QStandardItem("Row");
+ item->appendRow(new QStandardItem("Child"));
+ appendRow(item);
+ }
+ }
+ bool canFetchMore(const QModelIndex &parent) const override
+ {
+ if (!canFetchReady || !parent.isValid())
+ return false;
+ if (!parent.parent().isValid())
+ return rowCount(parent) < 20;
+ return false;
+ }
+ void fetchMore(const QModelIndex &parent) override
+ {
+ QStandardItem *item = itemFromIndex(parent);
+ for (int i = 0; i < 19; ++i)
+ item->appendRow(new QStandardItem(QString("New Child %1").arg(i)));
+ }
+ bool canFetchReady;
+};
+
+void tst_QTreeView::fetchMoreOnScroll()
+{
+ QTreeView tw;
+ FetchMoreModel im;
+ tw.setModel(&im);
+ tw.show();
+ tw.expandAll();
+ QTest::qWaitForWindowActive(&tw);
+ // Now we can allow the fetch to happen
+ im.canFetchReady = true;
+ tw.verticalScrollBar()->setValue(tw.verticalScrollBar()->maximum());
+ // The item should have now fetched the other children, thus bringing the count to 20
+ QCOMPARE(im.item(19)->rowCount(), 20);
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index fa7f9596da..3317c79daa 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -3449,7 +3449,7 @@ void tst_QTreeWidget::getMimeDataWithInvalidItem()
{
CustomTreeWidget w;
QTest::ignoreMessage(QtWarningMsg, "QTreeWidget::mimeData: Null-item passed");
- QMimeData *md = w.mimeData(QList<QTreeWidgetItem*>() << Q_NULLPTR);
+ QMimeData *md = w.mimeData(QList<QTreeWidgetItem*>() << nullptr);
QVERIFY(!md);
}
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index ac6362168e..2eb8c17359 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -350,7 +350,7 @@ void tst_QAction::enabledVisibleInteraction()
void tst_QAction::task200823_tooltip()
{
- const QScopedPointer<QAction> action(new QAction("foo", Q_NULLPTR));
+ const QScopedPointer<QAction> action(new QAction("foo", nullptr));
QString shortcut("ctrl+o");
action->setShortcut(shortcut);
@@ -364,7 +364,7 @@ void tst_QAction::task200823_tooltip()
void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
{
// test without a group
- const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", Q_NULLPTR));
+ const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", nullptr));
QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), SIGNAL(triggered(bool)));
QCOMPARE(spyWithoutGroup.count(), 0);
actionWithoutGroup->trigger();
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 6ff38abdb8..c70ac0309f 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -2214,7 +2214,7 @@ void tst_QApplication::staticFunctions()
QApplication::activeModalWidget();
QApplication::focusWidget();
QApplication::activeWindow();
- QApplication::setActiveWindow(Q_NULLPTR);
+ QApplication::setActiveWindow(nullptr);
QApplication::widgetAt(QPoint(0, 0));
QApplication::topLevelAt(QPoint(0, 0));
QApplication::setGlobalStrut(QSize(0, 0));
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index 0b35db1b5f..c39c770316 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -297,7 +297,7 @@ void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
layout.setObjectName("ef9e2b42298e0e6420105bb");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QVBoxLayout/ef9e2b42298e0e6420105bb");
- layout.addWidget(Q_NULLPTR);
+ layout.addWidget(nullptr);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/347b469225a24a0ef05150a to its child layout QVBoxLayout/ef9e2b42298e0e6420105bb");
@@ -313,7 +313,7 @@ void tst_QBoxLayout::taskQTBUG_40609_addingLayoutToItself(){
layout.setObjectName("cc751dd0f50f62b05a62da");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QVBoxLayout/cc751dd0f50f62b05a62da");
- layout.addLayout(Q_NULLPTR);
+ layout.addLayout(nullptr);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QVBoxLayout/cc751dd0f50f62b05a62da to itself");
diff --git a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
index c3ebb838bb..bcf48c21df 100644
--- a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
@@ -84,7 +84,7 @@ public:
{ return m_receivedGestures.value(gestureType); }
protected:
- bool event(QEvent * event) Q_DECL_OVERRIDE;
+ bool event(QEvent * event) override;
private:
typedef QHash<Qt::GestureType, bool> GestureTypeHash;
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index c1ab5f51be..50de83c8f7 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -342,7 +342,7 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.removeItem(spacer);
delete spacer;
- spacer = Q_NULLPTR;
+ spacer = nullptr;
rightChild.hide();
QApplication::sendPostedEvents(0, 0);
@@ -1630,7 +1630,7 @@ void tst_QGridLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
layout.setObjectName("d631e91a35f2b66a6dff35");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QGridLayout/d631e91a35f2b66a6dff35");
- layout.addWidget(Q_NULLPTR, 0, 0);
+ layout.addWidget(nullptr, 0, 0);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/9bb37ca762aeb7269b8 to its child layout QGridLayout/d631e91a35f2b66a6dff35");
@@ -1645,7 +1645,7 @@ void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){
layout.setObjectName("5d79e1b0aed83f100e3c2");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QGridLayout/5d79e1b0aed83f100e3c2");
- layout.addLayout(Q_NULLPTR, 0, 0);
+ layout.addLayout(nullptr, 0, 0);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QGridLayout/5d79e1b0aed83f100e3c2 to itself");
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 9d0c939d84..ff35b0cdb1 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -1105,7 +1105,7 @@ public:
int overrideCount;
- bool event(QEvent *e) Q_DECL_OVERRIDE
+ bool event(QEvent *e) override
{
if (e->type() == QEvent::ShortcutOverride)
overrideCount++;
diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
index d50f46cc16..eb3264be53 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
+++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
@@ -60,7 +60,7 @@ private:
struct PrettyPrint {
const char *m_s;
template <typename T>
- explicit PrettyPrint(const T &t) : m_s(Q_NULLPTR)
+ explicit PrettyPrint(const T &t) : m_s(nullptr)
{
using QT_PREPEND_NAMESPACE(QTest)::toString;
m_s = toString(t);
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index c163117ef3..86736bb082 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -129,7 +129,7 @@ static QWidget *findWhatsThat()
if (widget->inherits("QWhatsThat"))
return widget;
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QToolTip::whatsThis()
@@ -137,7 +137,7 @@ void tst_QToolTip::whatsThis()
qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
QWhatsThis::showText(QPoint(0, 0), "This is text");
- QWidget *whatsthis = Q_NULLPTR;
+ QWidget *whatsthis = nullptr;
QTRY_VERIFY( (whatsthis = findWhatsThat()) );
QVERIFY(whatsthis->isVisible());
const int whatsThisHeight = whatsthis->height();
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 36258d8196..81fb332a62 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5982,7 +5982,7 @@ public:
startTimer(1000);
}
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *) override
{
switch (state++) {
case 0:
@@ -6005,7 +6005,7 @@ public:
return false;
}
- bool nativeEvent(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
+ bool nativeEvent(const QByteArray &eventType, void *message, long *) override
{
if (isMapNotify(eventType, message))
gotExpectedMapNotify = true;
@@ -6013,7 +6013,7 @@ public:
}
// QAbstractNativeEventFilter interface
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override
{
if (isMapNotify(eventType, message))
gotExpectedGlobalEvent = true;
@@ -10438,7 +10438,7 @@ public slots:
QTimer::singleShot(100, this, SLOT(doMouseMoves()));
modal->exec();
delete modal;
- modal = Q_NULLPTR;
+ modal = nullptr;
}
void doMouseMoves()
@@ -10511,7 +10511,7 @@ class KeyboardWidget : public QWidget
{
public:
KeyboardWidget(QWidget* parent = 0) : QWidget(parent), m_eventCounter(0) {}
- virtual void mousePressEvent(QMouseEvent* ev) Q_DECL_OVERRIDE {
+ virtual void mousePressEvent(QMouseEvent* ev) override {
m_modifiers = ev->modifiers();
m_appModifiers = QApplication::keyboardModifiers();
++m_eventCounter;
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 9dc513c115..a158b6cbc9 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -218,12 +218,12 @@ class PaintTestWidget : public QWidget
public:
int paintEventCount;
- explicit PaintTestWidget(QWidget *parent = Q_NULLPTR)
+ explicit PaintTestWidget(QWidget *parent = nullptr)
: QWidget(parent)
, paintEventCount(0)
{}
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE
+ void paintEvent(QPaintEvent *event) override
{
++paintEventCount;
QWidget::paintEvent(event);
@@ -696,7 +696,7 @@ public:
int resizeCount;
protected:
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ void resizeEvent(QResizeEvent *) override
{
resizeCount++;
}
@@ -763,7 +763,7 @@ public:
, moveCount(0)
{ }
- void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE
+ void moveEvent(QMoveEvent *) override
{
moveCount++;
}
@@ -802,7 +802,7 @@ public:
}
protected:
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE
+ bool eventFilter(QObject *o, QEvent *e) override
{
if (e->type() == filterEventType())
++eventCount;
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index d5ef2fe94b..30177dfa86 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -736,7 +736,7 @@ public:
, called(false)
{}
- void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
called = true;
return QProxyStyle::drawPrimitive(pe, opt, p, w);
}
@@ -779,74 +779,74 @@ class TestStyleOptionInitProxy: public QProxyStyle
Q_OBJECT
public:
mutable bool invalidOptionsDetected;
- explicit TestStyleOptionInitProxy(QStyle *style = Q_NULLPTR)
+ explicit TestStyleOptionInitProxy(QStyle *style = nullptr)
: QProxyStyle(style),
invalidOptionsDetected(false)
{}
- void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
checkStyleEnum<QStyle::PrimitiveElement>(pe, opt);
return QProxyStyle::drawPrimitive(pe, opt, p, w);
}
- void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
checkStyleEnum<QStyle::ControlElement>(element, opt);
return QProxyStyle::drawControl(element, opt, p, w);
}
- QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::SubElement>(subElement, option);
return QProxyStyle::subElementRect(subElement, option, widget);
}
- void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const Q_DECL_OVERRIDE {
+ void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const override {
checkStyleEnum<QStyle::ComplexControl>(cc, opt);
return QProxyStyle::drawComplexControl(cc, opt, p, widget);
}
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override {
checkStyleEnum<QStyle::ComplexControl>(cc, opt);
return QProxyStyle::subControlRect(cc, opt, sc, widget);
}
- int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::PixelMetric>(metric, option);
return QProxyStyle::pixelMetric(metric, option, widget);
}
- QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const Q_DECL_OVERRIDE {
+ QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const override {
checkStyleEnum<QStyle::ContentsType>(ct, opt);
return QProxyStyle::sizeFromContents(ct, opt, contentsSize, w);
}
- int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE {
+ int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const override {
checkStyleEnum<QStyle::StyleHint>(stylehint, opt);
return QProxyStyle::styleHint(stylehint, opt, widget, returnData);
}
- QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const override {
checkStyleEnum<QStyle::StandardPixmap>(standardPixmap, opt);
return QProxyStyle::standardPixmap(standardPixmap, opt, widget);
}
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::StandardPixmap>(standardIcon, option);
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
- QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const Q_DECL_OVERRIDE {
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override {
checkStyle(QString::asprintf("QIcon::Mode(%i)", iconMode).toLatin1(), opt);
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, opt);
}
- int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const override {
checkStyle(QString::asprintf("QSizePolicy::ControlType(%i), QSizePolicy::ControlType(%i)", control1, control2).toLatin1(), option);
return QProxyStyle::layoutSpacing(control1, control2, orientation, option, widget);
}
private:
void checkStyle(const QByteArray &info, const QStyleOption *opt) const {
- if (opt && (opt->version == 0 || opt->styleObject == Q_NULLPTR) ) {
+ if (opt && (opt->version == 0 || opt->styleObject == nullptr) ) {
invalidOptionsDetected = true;
qWarning() << baseStyle()->metaObject()->className()
<< "Invalid QStyleOption found for"
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 2f4e1a32f3..3415d06bc6 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -3277,7 +3277,7 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated()
class QTBUG_56693_Model : public QStandardItemModel
{
public:
- QTBUG_56693_Model(QObject *parent = Q_NULLPTR)
+ QTBUG_56693_Model(QObject *parent = nullptr)
: QStandardItemModel(parent)
{ }
@@ -3305,7 +3305,7 @@ public:
}
- void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = Q_NULLPTR) const override
+ void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = nullptr) const override
{
if (element == CE_MenuItem)
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt))
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 6363d0c673..500ec2e1fa 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -47,7 +47,7 @@ public:
QList<QEvent::Type> events;
protected:
- bool event(QEvent *ev) Q_DECL_OVERRIDE {
+ bool event(QEvent *ev) override {
events.append(ev->type());
return QWidget::event(ev);
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index f71947e73b..a396063c1c 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3068,7 +3068,7 @@ void tst_QLineEdit::cutWithoutSelection()
QClipboard *clipboard = QGuiApplication::clipboard();
if (!PlatformClipboard::isAvailable()
|| !QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive)) { // Avoid unstable X11 clipboard
- clipboard = Q_NULLPTR;
+ clipboard = nullptr;
}
if (clipboard)
@@ -4497,7 +4497,7 @@ template <class T> T *findAssociatedWidget(const QAction *a)
if (T *result = qobject_cast<T *>(w))
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QLineEdit::sideWidgetsActionEvents()
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index da37a9a968..4408533c85 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -617,7 +617,7 @@ static QMenu *getTornOffMenu()
if (w->isVisible() && w->inherits("QTornOffMenu"))
return static_cast<QMenu *>(w);
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QMenu::tearOff()
@@ -819,7 +819,7 @@ public:
}
protected:
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE
+ void showEvent(QShowEvent *e) override
{
QVERIFY(m_subMenu->isVisible());
QVERIFY2(m_subMenu->x() > x(),
@@ -828,7 +828,7 @@ protected:
QMenu::showEvent(e);
}
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *e) override
{
if (e->timerId() == m_timerId) {
switch (m_timerTick++) {
@@ -1217,7 +1217,7 @@ public:
setMouseTracking(true);
}
- bool event(QEvent *e) Q_DECL_OVERRIDE
+ bool event(QEvent *e) override
{
switch (e->type()) {
case QEvent::MouseMove:
@@ -1525,7 +1525,7 @@ void tst_QMenu::menuSize_Scrolling()
~TestMenu() {}
private:
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE
+ void showEvent(QShowEvent *e) override
{
QVERIFY(actions().length() == m_numItems);
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 9a0ca0565e..789ea57dfc 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -1494,7 +1494,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
//set the new parent, a window
QScopedPointer<QWidget> windowedParent;
- windowedParent.reset(new QWidget(Q_NULLPTR, Qt::WindowFlags()));
+ windowedParent.reset(new QWidget(nullptr, Qt::WindowFlags()));
windowedParent->setGeometry(400, 10, 300, 300);
windowedParent->show();
@@ -1511,7 +1511,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
//to windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
movingParent.setParent(windowedParent.data(),0);
// this resets the parenting and the menu bar's window
- taskQTBUG53205MenuBar->setParent(Q_NULLPTR);
+ taskQTBUG53205MenuBar->setParent(nullptr);
taskQTBUG53205MenuBar->setParent(&containedWidget);
//from windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
//to : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
@@ -1543,7 +1543,7 @@ void tst_QMenuBar::platformMenu()
void tst_QMenuBar::slotForTaskQTBUG53205()
{
QWidget *parent = taskQTBUG53205MenuBar->parentWidget();
- taskQTBUG53205MenuBar->setParent(Q_NULLPTR);
+ taskQTBUG53205MenuBar->setParent(nullptr);
taskQTBUG53205MenuBar->setParent(parent);
}
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index e10c7591d5..7bb0de7e17 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -100,16 +100,16 @@ public:
m_w(expectedWidth), m_h(expectedHeight),
r(1.0f), g(0.0f), b(0.0f) { }
- void initializeGL() Q_DECL_OVERRIDE {
+ void initializeGL() override {
m_initCalled = true;
initializeOpenGLFunctions();
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
m_paintCalled = true;
glClearColor(r, g, b, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
- void resizeGL(int w, int h) Q_DECL_OVERRIDE {
+ void resizeGL(int w, int h) override {
m_resizeCalled = true;
m_resizeOk = w == m_w && h == m_h;
}
@@ -203,10 +203,10 @@ public:
PainterWidget(QWidget *parent)
: QOpenGLWidget(parent), m_clear(false) { }
- void initializeGL() Q_DECL_OVERRIDE {
+ void initializeGL() override {
initializeOpenGLFunctions();
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
QPainter p(this);
QCOMPARE(p.device()->width(), width());
QCOMPARE(p.device()->height(), height());
@@ -322,7 +322,7 @@ public:
void resetPaintCount() { m_count = 0; }
protected:
- void drawForeground(QPainter *, const QRectF &) Q_DECL_OVERRIDE;
+ void drawForeground(QPainter *, const QRectF &) override;
int m_count;
};
@@ -372,7 +372,7 @@ class PaintCountWidget : public QOpenGLWidget
public:
PaintCountWidget() : m_count(0) { }
void reset() { m_count = 0; }
- void paintGL() Q_DECL_OVERRIDE { ++m_count; }
+ void paintGL() override { ++m_count; }
int m_count;
};
@@ -393,7 +393,7 @@ void tst_QOpenGLWidget::requestUpdate()
class FboCheckWidget : public QOpenGLWidget
{
public:
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
GLuint reportedDefaultFbo = QOpenGLContext::currentContext()->defaultFramebufferObject();
GLuint expectedDefaultFbo = defaultFramebufferObject();
QCOMPARE(reportedDefaultFbo, expectedDefaultFbo);
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index 72e6ffdeb5..9050ad4486 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -299,7 +299,7 @@ class TestSplitterStyle : public QProxyStyle
{
public:
TestSplitterStyle() : handleWidth(5) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_SplitterWidth)
return handleWidth;
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 55ef44f4e0..4e1d93dbbb 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -2622,7 +2622,7 @@ namespace {
{
}
- void drawTextItem(const QPointF &, const QTextItem &textItem) Q_DECL_OVERRIDE
+ void drawTextItem(const QPointF &, const QTextItem &textItem) override
{
itemFonts.append(qMakePair(textItem.text(), textItem.font()));
}
diff --git a/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 30a7b82278..10928e3afc 100644
--- a/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -53,7 +53,7 @@ tst_QThreadPool::~tst_QThreadPool()
class NoOpRunnable : public QRunnable
{
public:
- void run() Q_DECL_OVERRIDE {
+ void run() override {
}
};
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 622df2fb3b..6145fabbf8 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -216,7 +216,7 @@ void tst_QGraphicsScene::itemAt()
QGraphicsItem *item = 0;
QBENCHMARK {
- item = scene.items(QPointF(0, 0)).value(0, Q_NULLPTR);
+ item = scene.items(QPointF(0, 0)).value(0, nullptr);
}
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
diff --git a/tests/manual/cocoa/menurama/mainwindow.h b/tests/manual/cocoa/menurama/mainwindow.h
index a7afa770be..3ca90dad8f 100644
--- a/tests/manual/cocoa/menurama/mainwindow.h
+++ b/tests/manual/cocoa/menurama/mainwindow.h
@@ -44,7 +44,7 @@ public:
~MainWindow();
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
public slots:
void enableStuffMenu(bool enable);
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.cpp b/tests/manual/cocoa/menurama/menuramaapplication.cpp
index acd44565eb..5fb2041ae4 100644
--- a/tests/manual/cocoa/menurama/menuramaapplication.cpp
+++ b/tests/manual/cocoa/menurama/menuramaapplication.cpp
@@ -71,5 +71,5 @@ QAction *MenuramaApplication::findAction(QLatin1String title, QMenu *parentMenu)
if (a->text() == title)
return a;
- return Q_NULLPTR;
+ return nullptr;
}
diff --git a/tests/manual/diaglib/logwidget.cpp b/tests/manual/diaglib/logwidget.cpp
index 8e4844fab2..35fabd6e2e 100644
--- a/tests/manual/diaglib/logwidget.cpp
+++ b/tests/manual/diaglib/logwidget.cpp
@@ -133,7 +133,7 @@ void LogWidget::install()
qInfo("%s", qPrintable(LogWidget::startupMessage()));
}
-void LogWidget::uninstall() { qInstallMessageHandler(Q_NULLPTR); }
+void LogWidget::uninstall() { qInstallMessageHandler(nullptr); }
#else // Qt 5
diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp
index cda7e7207e..74c6d8c376 100644
--- a/tests/manual/foreignwindows/main.cpp
+++ b/tests/manual/foreignwindows/main.cpp
@@ -110,7 +110,7 @@ EmbeddingWindow::EmbeddingWindow(QWindow *window) : m_window(window)
+ QLatin1String(" 0x") + QString::number(window->winId(), 16);
setWindowTitle(title);
setObjectName("MainWindow");
- QWidget *container = QWidget::createWindowContainer(window, Q_NULLPTR, Qt::Widget);
+ QWidget *container = QWidget::createWindowContainer(window, nullptr, Qt::Widget);
container->setObjectName("Container");
setCentralWidget(container);
@@ -149,8 +149,8 @@ EmbeddingWindow::EmbeddingWindow(QWindow *window) : m_window(window)
void EmbeddingWindow::releaseForeignWindow()
{
if (m_window) {
- m_window->setParent(Q_NULLPTR);
- m_window = Q_NULLPTR;
+ m_window->setParent(nullptr);
+ m_window = nullptr;
m_releaseAction->setEnabled(false);
}
}
diff --git a/tests/manual/highdpi/dragwidget.h b/tests/manual/highdpi/dragwidget.h
index 2cb821d509..8b67b20410 100644
--- a/tests/manual/highdpi/dragwidget.h
+++ b/tests/manual/highdpi/dragwidget.h
@@ -43,15 +43,15 @@ public:
DragWidget(QString text = QString(), QWidget *parent = 0);
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent * event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent * event) override;
+ void paintEvent(QPaintEvent *) override;
+ void timerEvent(QTimerEvent *event) override;
+ void showEvent(QShowEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
private:
QPoint dragPos;
QPoint dropPos;
diff --git a/tests/manual/qlayout/gridwidget.cpp b/tests/manual/qlayout/gridwidget.cpp
index ede13a22c3..f19b3eac6f 100644
--- a/tests/manual/qlayout/gridwidget.cpp
+++ b/tests/manual/qlayout/gridwidget.cpp
@@ -62,8 +62,8 @@ GridWidget::GridWidget(QWidget *parent) :
qDebug("There should be four warnings, but no crash or freeze:");
hb->addWidget(this, 6, 6); ///< This command should print a warning, but should not add "this"
- hb->addWidget(Q_NULLPTR, 6, 7); ///< This command should print a warning, but should not add "NULL"
+ hb->addWidget(nullptr, 6, 7); ///< This command should print a warning, but should not add "NULL"
hb->addLayout(hb, 7, 6); ///< This command should print a warning, but should not add "hb"
- hb->addLayout(Q_NULLPTR, 7, 7); ///< This command should print a warning, but should not add "NULL"
+ hb->addLayout(nullptr, 7, 7); ///< This command should print a warning, but should not add "NULL"
qDebug("Neither crashed nor frozen");
}
diff --git a/tests/manual/qlayout/hbwidget.cpp b/tests/manual/qlayout/hbwidget.cpp
index d1f6c94d5b..80219d01fd 100644
--- a/tests/manual/qlayout/hbwidget.cpp
+++ b/tests/manual/qlayout/hbwidget.cpp
@@ -58,8 +58,8 @@ HbWidget::HbWidget(QWidget *parent) :
qDebug("There should be four warnings, but no crash or freeze:");
hb->addWidget(this); ///< This command should print a warning, but should not add "this"
- hb->addWidget(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL"
+ hb->addWidget(nullptr); ///< This command should print a warning, but should not add "NULL"
hb->addLayout(hb); ///< This command should print a warning, but should not add "hb"
- hb->addLayout(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL"
+ hb->addLayout(nullptr); ///< This command should print a warning, but should not add "NULL"
qDebug("Neither crashed nor frozen");
}
diff --git a/tests/manual/qlayout/vbwidget.cpp b/tests/manual/qlayout/vbwidget.cpp
index d3898422fb..97f240f9a0 100644
--- a/tests/manual/qlayout/vbwidget.cpp
+++ b/tests/manual/qlayout/vbwidget.cpp
@@ -58,8 +58,8 @@ VbWidget::VbWidget(QWidget *parent) :
qDebug("There should be four warnings, but no crash or freeze:");
hb->addWidget(this); ///< This command should print a warning, but should not add "this"
- hb->addWidget(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL"
+ hb->addWidget(nullptr); ///< This command should print a warning, but should not add "NULL"
hb->addLayout(hb); ///< This command should print a warning, but should not add "hb"
- hb->addLayout(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL"
+ hb->addLayout(nullptr); ///< This command should print a warning, but should not add "NULL"
qDebug("Neither crashed nor frozen");
}
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 445af82e09..6fba872b12 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -73,12 +73,12 @@ public:
}
protected:
- void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE {
+ void mouseMoveEvent(QMouseEvent *ev) override {
m_cursorPos = ev->screenPos().toPoint();
updateText();
}
- void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE {
+ void mousePressEvent(QMouseEvent *ev) override {
m_cursorPos = ev->screenPos().toPoint();
qDebug() << "top level @" << m_cursorPos << ":" << QGuiApplication::topLevelAt(m_cursorPos);
updateText();
@@ -100,7 +100,7 @@ class ScreenPropertyWatcher : public PropertyWatcher
{
Q_OBJECT
public:
- ScreenPropertyWatcher(QWidget *wp = Q_NULLPTR) : PropertyWatcher(Q_NULLPTR, QString(), wp)
+ ScreenPropertyWatcher(QWidget *wp = nullptr) : PropertyWatcher(nullptr, QString(), wp)
{
// workaround for the fact that virtualSiblings is not a property,
// thus there is no change notification:
@@ -150,7 +150,7 @@ public:
QScreen *screenSubject() const { return m_watcher->screenSubject(); }
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
void startMouseMonitor();
private:
diff --git a/tests/manual/qscreen/propertywatcher.cpp b/tests/manual/qscreen/propertywatcher.cpp
index 0fb322a480..d2a552f108 100644
--- a/tests/manual/qscreen/propertywatcher.cpp
+++ b/tests/manual/qscreen/propertywatcher.cpp
@@ -34,7 +34,7 @@
#include "propertyfield.h"
PropertyWatcher::PropertyWatcher(QObject *subject, QString annotation, QWidget *parent)
- : QWidget(parent), m_subject(Q_NULLPTR), m_formLayout(new QFormLayout(this))
+ : QWidget(parent), m_subject(nullptr), m_formLayout(new QFormLayout(this))
{
setMinimumSize(450, 300);
m_formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
diff --git a/tests/manual/qscreen/propertywatcher.h b/tests/manual/qscreen/propertywatcher.h
index f371a3b9b6..d988d96c91 100644
--- a/tests/manual/qscreen/propertywatcher.h
+++ b/tests/manual/qscreen/propertywatcher.h
@@ -39,7 +39,7 @@ class PropertyWatcher : public QWidget
Q_OBJECT
public:
- explicit PropertyWatcher(QObject* subject = Q_NULLPTR, QString annotation = QString(), QWidget *parent = Q_NULLPTR);
+ explicit PropertyWatcher(QObject* subject = nullptr, QString annotation = QString(), QWidget *parent = nullptr);
QFormLayout *formLayout() { return m_formLayout; }
diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp
index 1d00ea5db5..d3c6079c7d 100644
--- a/tests/manual/touch/main.cpp
+++ b/tests/manual/touch/main.cpp
@@ -118,7 +118,7 @@ public:
explicit PanGesture(const QWidget *w, const QPanGesture *source) : Gesture(w, source)
, m_offset(source->offset()) {}
- void draw(const QRectF &rect, QPainter &painter) const Q_DECL_OVERRIDE
+ void draw(const QRectF &rect, QPainter &painter) const override
{
const QPointF hotSpot = drawHotSpot(rect, painter);
painter.drawLine(hotSpot, hotSpot + m_offset);
@@ -134,7 +134,7 @@ public:
, m_horizontal(source->horizontalDirection()), m_vertical(source->verticalDirection())
, m_angle(source->swipeAngle()) {}
- void draw(const QRectF &rect, QPainter &painter) const Q_DECL_OVERRIDE;
+ void draw(const QRectF &rect, QPainter &painter) const override;
private:
QSwipeGesture::SwipeDirection m_horizontal;
@@ -169,7 +169,7 @@ void SwipeGesture::draw(const QRectF &rect, QPainter &painter) const
Gesture *Gesture::fromQGesture(const QWidget *w, const QGesture *source)
{
- Gesture *result = Q_NULLPTR;
+ Gesture *result = nullptr;
switch (source->gestureType()) {
case Qt::TapGesture:
case Qt::TapAndHoldGesture:
@@ -197,7 +197,7 @@ class EventFilter : public QObject {
public:
explicit EventFilter(const EventTypeVector &types, QObject *p) : QObject(p), m_types(types) {}
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
signals:
void eventReceived(const QString &);
@@ -292,8 +292,8 @@ signals:
void logMessage(const QString &);
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void paintEvent(QPaintEvent *) override;
private:
void handleGestureEvent(QGestureEvent *gestureEvent);
diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
index e8844f87fd..f2c5494ebc 100644
--- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
+++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
@@ -36,7 +36,7 @@ public:
setFlags(QGraphicsItem::ItemIsSelectable);
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option*/, QWidget * /*widget*/) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option*/, QWidget * /*widget*/) override
{
if (isSelected())
painter->fillRect(rect(), QColor(255, 0, 0));
@@ -55,7 +55,7 @@ public:
connect(this, SIGNAL(rubberBandChanged(QRect, QPointF, QPointF)), this, SLOT(updateRubberbandInfo(QRect, QPointF, QPointF)));
}
protected:
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE
+ void mouseMoveEvent(QMouseEvent *event) override
{
QGraphicsView::mouseMoveEvent(event);
diff --git a/tests/manual/widgets/styles/main.cpp b/tests/manual/widgets/styles/main.cpp
index 7c840dc9ae..7df54baef5 100644
--- a/tests/manual/widgets/styles/main.cpp
+++ b/tests/manual/widgets/styles/main.cpp
@@ -87,7 +87,7 @@ static QWidget *createStandardPixmapPage(QWidget *parent)
const int maxColumns = 6;
for (int i = 0; i <= int(QStyle::SP_LineEditClearButton); ++i) {
const QStyle::StandardPixmap sp = static_cast<QStyle::StandardPixmap>(i);
- QPixmap pixmap = result->style()->standardPixmap(sp, Q_NULLPTR, result);
+ QPixmap pixmap = result->style()->standardPixmap(sp, nullptr, result);
QLabel *descriptionLabel = new QLabel(pixmapDescription(sp, pixmap));
grid->addWidget(descriptionLabel, row, column++);
QLabel *displayLabel = new QLabel;
@@ -111,7 +111,7 @@ static QWidget *createMetricsPage(QWidget *parent)
for (int i = 0; i <= int(QStyle::PM_HeaderDefaultSectionSizeVertical); ++i) {
const QStyle::PixelMetric m = static_cast<QStyle::PixelMetric>(i);
str << formatEnumValue(m) << '(' << int(m) << ")="
- << result->style()->pixelMetric(m, Q_NULLPTR, result) << '\n';
+ << result->style()->pixelMetric(m, nullptr, result) << '\n';
}
result->setPlainText(text);
return result;
@@ -126,7 +126,7 @@ static QWidget *createHintsPage(QWidget *parent)
for (int i = 0; i <= int(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave); ++i) {
const QStyle::StyleHint h = static_cast<QStyle::StyleHint>(i);
str << formatEnumValue(h) << '(' << int(h) << ")="
- << result->style()->styleHint(h, Q_NULLPTR, result) << '\n';
+ << result->style()->styleHint(h, nullptr, result) << '\n';
}
result->setPlainText(text);
return result;