Remove most compiler warnings about missing overrides

Remove around 1000 compiler warnings about missing overrides
in our auto tests.

This significantly reduce the compiler warning noise in our auto
tests, so that one can actually better see the real problems
inbetween.

Change-Id: Id0c04dba43fcaf55d8cd2b5c6697358857c31bf9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Lars Knoll 2020-09-10 20:39:49 +02:00
parent 459e8dfdfb
commit 6ae7a02104
151 changed files with 808 additions and 772 deletions

View File

@ -89,7 +89,7 @@ class PrintFor : public IterateKernel<TestIterator, void>
{
public:
PrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); }
bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *)
bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override
{
iterations.fetchAndAddRelaxed(end - begin);
#ifdef PRINT
@ -97,7 +97,7 @@ public:
#endif
return false;
}
bool runIteration(TestIterator it, int index , void *result)
bool runIteration(TestIterator it, int index , void *result) override
{
return runIterations(it, index, index + 1, result);
}
@ -108,7 +108,7 @@ class SleepPrintFor : public IterateKernel<TestIterator, void>
{
public:
SleepPrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); }
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *)
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override
{
QTest::qSleep(200);
iterations.fetchAndAddRelaxed(end - begin);
@ -117,7 +117,7 @@ public:
#endif
return false;
}
bool runIteration(TestIterator it, int index , void *result)
bool runIteration(TestIterator it, int index , void *result) override
{
return runIterations(it, index, index + 1, result);
}
@ -148,12 +148,12 @@ class CountFor : public IterateKernel<TestIterator, void>
{
public:
CountFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); }
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *)
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override
{
counter.fetchAndAddRelaxed(end - begin);
return false;
}
bool runIteration(TestIterator it, int index , void *result)
bool runIteration(TestIterator it, int index , void *result) override
{
return runIterations(it, index, index + 1, result);
}
@ -187,7 +187,7 @@ public:
// and then records how many threads that run between
// iterations 140 and 160.
ThrottleFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); throttling = false; }
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *)
inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override
{
if (200 >= begin && 200 < end) {
throttling = false;
@ -210,12 +210,12 @@ public:
return false;
}
bool runIteration(TestIterator it, int index , void *result)
bool runIteration(TestIterator it, int index , void *result) override
{
return runIterations(it, index, index + 1, result);
}
bool shouldThrottleThread()
bool shouldThrottleThread() override
{
const int load = iterations.loadRelaxed();
return (load > 100 && load < 200);
@ -243,7 +243,7 @@ class MultipleResultsFor : public IterateKernel<TestIterator, int>
{
public:
MultipleResultsFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, int>(QThreadPool::globalInstance(), begin, end) { }
inline bool runIterations(TestIterator, int begin, int end, int *results)
inline bool runIterations(TestIterator, int begin, int end, int *results) override
{
for (int i = begin; i < end; ++i)
results[i - begin] = i;

View File

@ -56,7 +56,7 @@ class PrintUser : public ThreadEngine<void>
{
public:
PrintUser() : ThreadEngine(QThreadPool::globalInstance()) {}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
QTest::qSleep(50);
QTest::qSleep(100);
@ -86,18 +86,18 @@ public:
: ThreadEngine(QThreadPool::globalInstance())
, done(false) { }
bool shouldStartThread()
bool shouldStartThread() override
{
return !done;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
done = true;
return ThreadFinished;
}
QString *result()
QString *result() override
{
foo = "Foo";
return &foo;
@ -117,18 +117,18 @@ class VoidResultUser : public ThreadEngine<void>
public:
VoidResultUser() : ThreadEngine(QThreadPool::globalInstance()) {}
bool shouldStartThread()
bool shouldStartThread() override
{
return !done;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
done = true;
return ThreadFinished;
}
void *result()
void *result() override
{
return 0;
}
@ -155,12 +155,12 @@ class CancelUser : public ThreadEngine<void>
public:
CancelUser() : ThreadEngine(QThreadPool::globalInstance()) {}
void *result()
void *result() override
{
return 0;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
while (this->isCanceled() == false)
{
@ -198,12 +198,12 @@ public:
finishing = false;
}
bool shouldStartThread()
bool shouldStartThread() override
{
return !finishing;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
forever {
const int local = count.loadRelaxed();
@ -253,12 +253,12 @@ public:
finishing = finishImmediately;
}
bool shouldStartThread()
bool shouldStartThread() override
{
return !finishing;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
{
QMutexLocker lock(&mutex);
@ -315,12 +315,12 @@ class MultipleResultsUser : public ThreadEngine<int>
{
public:
MultipleResultsUser() : ThreadEngine(QThreadPool::globalInstance()) {}
bool shouldStartThread()
bool shouldStartThread() override
{
return false;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
for (int i = 0; i < 10; ++i)
this->reportResult(&i);
@ -344,17 +344,17 @@ void tst_QtConcurrentThreadEngine::multipleResults()
class NoThreadsUser : public ThreadEngine<void>
{
public:
bool shouldStartThread()
bool shouldStartThread() override
{
return false;
}
ThreadFunctionResult threadFunction()
ThreadFunctionResult threadFunction() override
{
return ThreadFinished;
}
void *result()
void *result() override
{
return 0;
}
@ -385,8 +385,8 @@ class SlowUser : public ThreadEngine<void>
{
public:
SlowUser() : ThreadEngine(QThreadPool::globalInstance()) {}
bool shouldStartThread() { return false; }
ThreadFunctionResult threadFunction() { QTest::qSleep(sleepTime); return ThreadFinished; }
bool shouldStartThread() override { return false; }
ThreadFunctionResult threadFunction() override { QTest::qSleep(sleepTime); return ThreadFinished; }
};
void tst_QtConcurrentThreadEngine::cancelQueuedSlowUser()

View File

@ -58,8 +58,8 @@ public:
TestableQAbstractAnimation() : m_duration(10) {}
virtual ~TestableQAbstractAnimation() {};
int duration() const { return m_duration; }
virtual void updateCurrentTime(int) {}
int duration() const override { return m_duration; }
virtual void updateCurrentTime(int) override {}
void setDuration(int duration) { m_duration = duration; }
private:
@ -70,8 +70,8 @@ class DummyQAnimationGroup : public QAnimationGroup
{
Q_OBJECT
public:
int duration() const { return 10; }
virtual void updateCurrentTime(int) {}
int duration() const override { return 10; }
virtual void updateCurrentTime(int) override {}
};
void tst_QAbstractAnimation::construction()

View File

@ -79,9 +79,9 @@ class TestAnimation : public QVariantAnimation
{
Q_OBJECT
public:
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)};
virtual void updateState(QAbstractAnimation::State oldState,
QAbstractAnimation::State newState)
QAbstractAnimation::State newState) override
{
Q_UNUSED(oldState);
Q_UNUSED(newState);
@ -98,10 +98,10 @@ public:
setDuration(250);
}
int duration() const { return -1; /* not time driven */ }
int duration() const override { return -1; /* not time driven */ }
protected:
void timerEvent(QTimerEvent *event)
void timerEvent(QTimerEvent *event) override
{
if (event->timerId() == id)
stop();

View File

@ -92,9 +92,9 @@ class TestAnimation : public QVariantAnimation
{
Q_OBJECT
public:
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)};
virtual void updateState(QAbstractAnimation::State newState,
QAbstractAnimation::State oldState)
QAbstractAnimation::State oldState) override
{
Q_UNUSED(oldState);
Q_UNUSED(newState);
@ -108,15 +108,15 @@ public:
TestAnimation2(QAbstractAnimation *animation) : QVariantAnimation(animation) {}
TestAnimation2(int duration, QAbstractAnimation *animation) : QVariantAnimation(animation), m_duration(duration) {}
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)};
virtual void updateState(QAbstractAnimation::State newState,
QAbstractAnimation::State oldState)
QAbstractAnimation::State oldState) override
{
Q_UNUSED(oldState);
Q_UNUSED(newState);
};
virtual int duration() const {
virtual int duration() const override {
return m_duration;
}
private:
@ -134,10 +134,10 @@ public:
setEndValue(0);
}
int duration() const { return -1; /* not time driven */ }
int duration() const override { return -1; /* not time driven */ }
protected:
void timerEvent(QTimerEvent *event)
void timerEvent(QTimerEvent *event) override
{
if (event->timerId() == id)
stop();

View File

@ -64,7 +64,7 @@ public:
int m_updateCurrentTimeCount;
protected:
void updateCurrentTime(int currentTime)
void updateCurrentTime(int currentTime) override
{
QPauseAnimation::updateCurrentTime(currentTime);
++m_updateCurrentTimeCount;

View File

@ -39,10 +39,10 @@ class UncontrolledAnimation : public QPropertyAnimation
{
Q_OBJECT
public:
int duration() const { return -1; /* not time driven */ }
int duration() const override { return -1; /* not time driven */ }
protected:
void updateCurrentTime(int currentTime)
void updateCurrentTime(int currentTime) override
{
QPropertyAnimation::updateCurrentTime(currentTime);
if (currentTime >= QPropertyAnimation::duration() || currentLoop() >= 1)
@ -1283,7 +1283,7 @@ public:
innerAnim->start();
}
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override
{
QPropertyAnimation::updateState(newState, oldState);
if (newState == QAbstractAnimation::Stopped)

View File

@ -96,9 +96,9 @@ class TestAnimation : public QVariantAnimation
{
Q_OBJECT
public:
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)};
virtual void updateState(QAbstractAnimation::State newState,
QAbstractAnimation::State oldState)
QAbstractAnimation::State oldState) override
{
Q_UNUSED(oldState);
Q_UNUSED(newState);
@ -129,10 +129,10 @@ public:
setEndValue(0);
}
int duration() const { return -1; /* not time driven */ }
int duration() const override { return -1; /* not time driven */ }
protected:
void updateCurrentTime(int currentTime)
void updateCurrentTime(int currentTime) override
{
QPropertyAnimation::updateCurrentTime(currentTime);
if (currentTime >= QPropertyAnimation::duration())

View File

@ -50,7 +50,7 @@ class TestableQVariantAnimation : public QVariantAnimation
{
Q_OBJECT
public:
void updateCurrentValue(const QVariant&) {}
void updateCurrentValue(const QVariant&) override {}
};
void tst_QVariantAnimation::construction()

View File

@ -182,7 +182,7 @@ void tst_QGlobalStatic::threadStressTest()
{
public:
QReadWriteLock *lock;
void run()
void run() override
{
QReadLocker l(lock);
//usleep(QRandomGenerator::global()->generate(200));

View File

@ -76,7 +76,7 @@ public:
{
}
bool open(QIODevice::OpenMode openMode)
bool open(QIODevice::OpenMode openMode) override
{
if (openForRead_ || openForWrite_) {
qWarning("%s: file is already open for %s",
@ -108,7 +108,7 @@ public:
return true;
}
bool close()
bool close() override
{
openFile_.clear();
@ -119,7 +119,7 @@ public:
return true;
}
qint64 size() const
qint64 size() const override
{
QSharedPointer<File> file = resolveFile(false);
if (!file)
@ -129,7 +129,7 @@ public:
return file->content.size();
}
qint64 pos() const
qint64 pos() const override
{
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
@ -138,7 +138,7 @@ public:
return position_;
}
bool seek(qint64 pos)
bool seek(qint64 pos) override
{
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
@ -153,7 +153,7 @@ public:
return false;
}
bool flush()
bool flush() override
{
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
@ -163,7 +163,7 @@ public:
return true;
}
bool remove()
bool remove() override
{
QMutexLocker lock(&fileSystemMutex);
int count = fileSystem.remove(fileName_);
@ -171,7 +171,7 @@ public:
return (count == 1);
}
bool copy(const QString &newName)
bool copy(const QString &newName) override
{
QMutexLocker lock(&fileSystemMutex);
if (!fileSystem.contains(fileName_)
@ -182,7 +182,7 @@ public:
return true;
}
bool rename(const QString &newName)
bool rename(const QString &newName) override
{
QMutexLocker lock(&fileSystemMutex);
if (!fileSystem.contains(fileName_)
@ -215,7 +215,7 @@ public:
// return false;
// }
bool setSize(qint64 size)
bool setSize(qint64 size) override
{
if (size < 0)
return false;
@ -234,7 +234,7 @@ public:
return (file->content.size() == size);
}
FileFlags fileFlags(FileFlags type) const
FileFlags fileFlags(FileFlags type) const override
{
QSharedPointer<File> file = resolveFile(false);
if (file) {
@ -252,7 +252,7 @@ public:
// return false;
// }
QString fileName(FileName file) const
QString fileName(FileName file) const override
{
switch (file) {
case DefaultName:
@ -281,7 +281,7 @@ public:
return QString();
}
uint ownerId(FileOwner owner) const
uint ownerId(FileOwner owner) const override
{
QSharedPointer<File> file = resolveFile(false);
if (file) {
@ -302,7 +302,7 @@ public:
return -2;
}
QString owner(FileOwner owner) const
QString owner(FileOwner owner) const override
{
QSharedPointer<File> file = resolveFile(false);
if (file) {
@ -335,7 +335,7 @@ public:
return QString();
}
QDateTime fileTime(FileTime time) const
QDateTime fileTime(FileTime time) const override
{
QSharedPointer<File> file = resolveFile(false);
if (file) {
@ -355,14 +355,14 @@ public:
return QDateTime();
}
bool setFileTime(const QDateTime &newDate, FileTime time)
bool setFileTime(const QDateTime &newDate, FileTime time) override
{
Q_UNUSED(newDate);
Q_UNUSED(time);
return false;
}
void setFileName(const QString &file)
void setFileName(const QString &file) override
{
if (openForRead_ || openForWrite_)
qWarning("%s: Can't set file name while file is open", Q_FUNC_INFO);
@ -384,7 +384,7 @@ public:
// return 0;
// }
qint64 read(char *data, qint64 maxLen)
qint64 read(char *data, qint64 maxLen) override
{
if (!openForRead_) {
qWarning("%s: file must be open for reading", Q_FUNC_INFO);
@ -407,7 +407,7 @@ public:
return readSize;
}
qint64 write(const char *data, qint64 length)
qint64 write(const char *data, qint64 length) override
{
if (!openForWrite_) {
qWarning("%s: file must be open for writing", Q_FUNC_INFO);
@ -508,15 +508,15 @@ public:
names.append("bar");
index = -1;
}
QString currentFileName() const
QString currentFileName() const override
{
return names.at(index);
}
bool hasNext() const
bool hasNext() const override
{
return index < names.size() - 1;
}
QString next()
QString next() override
{
if (!hasNext())
return QString();
@ -530,11 +530,11 @@ public:
: QFSFileEngine(fileName)
{
}
Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames)
Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override
{
return new Iterator(filters, filterNames);
}
FileFlags fileFlags(FileFlags type) const
FileFlags fileFlags(FileFlags type) const override
{
if (fileName(DefaultName).endsWith(".tar")) {
FileFlags ret = QFSFileEngine::fileFlags(type);
@ -556,7 +556,7 @@ QHash<QString, QSharedPointer<ReferenceFileEngine::File> > ReferenceFileEngine::
class FileEngineHandler
: QAbstractFileEngineHandler
{
QAbstractFileEngine *create(const QString &fileName) const
QAbstractFileEngine *create(const QString &fileName) const override
{
if (fileName.endsWith(".tar") || fileName.contains(".tar/"))
return new MountingFileEngine(fileName);

View File

@ -477,14 +477,14 @@ public:
: QFSFileEngine(fileName)
{ }
QAbstractFileEngineIterator *beginEntryList(QDir::Filters, const QStringList &)
QAbstractFileEngineIterator *beginEntryList(QDir::Filters, const QStringList &) override
{ return 0; }
};
class EngineWithNoIteratorHandler : public QAbstractFileEngineHandler
{
public:
QAbstractFileEngine *create(const QString &fileName) const
QAbstractFileEngine *create(const QString &fileName) const override
{
return new EngineWithNoIterator(fileName);
}

View File

@ -2181,33 +2181,33 @@ public:
MyEngine(int n) { number = n; }
virtual ~MyEngine() {}
void setFileName(const QString &) {}
bool open(QIODevice::OpenMode) { return false; }
bool close() { return false; }
bool flush() { return false; }
qint64 size() const { return 123 + number; }
void setFileName(const QString &) override {}
bool open(QIODevice::OpenMode) override { return false; }
bool close() override { return false; }
bool flush() override { return false; }
qint64 size() const override { return 123 + number; }
qint64 at() const { return -1; }
bool seek(qint64) { return false; }
bool isSequential() const { return false; }
qint64 read(char *, qint64) { return -1; }
qint64 write(const char *, qint64) { return -1; }
bool remove() { return false; }
bool copy(const QString &) { return false; }
bool rename(const QString &) { return false; }
bool link(const QString &) { return false; }
bool mkdir(const QString &, bool) const { return false; }
bool rmdir(const QString &, bool) const { return false; }
bool setSize(qint64) { return false; }
QStringList entryList(QDir::Filters, const QStringList &) const { return QStringList(); }
bool caseSensitive() const { return false; }
bool isRelativePath() const { return false; }
FileFlags fileFlags(FileFlags) const { return { }; }
bool seek(qint64) override { return false; }
bool isSequential() const override { return false; }
qint64 read(char *, qint64) override { return -1; }
qint64 write(const char *, qint64) override { return -1; }
bool remove() override { return false; }
bool copy(const QString &) override { return false; }
bool rename(const QString &) override { return false; }
bool link(const QString &) override { return false; }
bool mkdir(const QString &, bool) const override { return false; }
bool rmdir(const QString &, bool) const override { return false; }
bool setSize(qint64) override { return false; }
QStringList entryList(QDir::Filters, const QStringList &) const override { return QStringList(); }
bool caseSensitive() const override { return false; }
bool isRelativePath() const override { return false; }
FileFlags fileFlags(FileFlags) const override { return { }; }
bool chmod(uint) { return false; }
QString fileName(FileName) const { return name; }
uint ownerId(FileOwner) const { return 0; }
QString owner(FileOwner) const { return QString(); }
QDateTime fileTime(FileTime) const { return QDateTime(); }
bool setFileTime(const QDateTime &, FileTime) { return false; }
QString fileName(FileName) const override { return name; }
uint ownerId(FileOwner) const override { return 0; }
QString owner(FileOwner) const override { return QString(); }
QDateTime fileTime(FileTime) const override { return QDateTime(); }
bool setFileTime(const QDateTime &, FileTime) override { return false; }
private:
int number;
@ -2217,7 +2217,7 @@ private:
class MyHandler : public QAbstractFileEngineHandler
{
public:
inline QAbstractFileEngine *create(const QString &) const
inline QAbstractFileEngine *create(const QString &) const override
{
return new MyEngine(1);
}
@ -2226,7 +2226,7 @@ public:
class MyHandler2 : public QAbstractFileEngineHandler
{
public:
inline QAbstractFileEngine *create(const QString &) const
inline QAbstractFileEngine *create(const QString &) const override
{
return new MyEngine(2);
}
@ -2257,7 +2257,7 @@ void tst_QFile::fileEngineHandler()
class MyRecursiveHandler : public QAbstractFileEngineHandler
{
public:
inline QAbstractFileEngine *create(const QString &fileName) const
inline QAbstractFileEngine *create(const QString &fileName) const override
{
if (fileName.startsWith(":!")) {
QDir dir;
@ -2671,7 +2671,7 @@ void tst_QFile::renameWithAtEndSpecialFile() const
class PeculiarAtEnd : public QFile
{
public:
virtual bool atEnd() const
virtual bool atEnd() const override
{
return true;
}

View File

@ -133,7 +133,7 @@ public:
: _logtext(logtext), _configuration(configuration)
{}
protected:
void run()
void run() override
{
for (int i = 0; i < 2000; i++) {
_configuration->addKey("Digia*", true);

View File

@ -49,7 +49,7 @@ void tst_QProcessNoApplication::initializationDeadlock()
struct MyThread : public QThread
{
void run()
void run() override
{
// what we execute does not matter, as long as we try to
// and that the process exits

View File

@ -1192,7 +1192,7 @@ public:
}
protected:
inline void run()
inline void run() override
{
exitCode = 90210;

View File

@ -134,26 +134,26 @@ class QtTestModel: public QAbstractItemModel
public:
QtTestModel(int rows, int columns, QObject *parent = 0);
QtTestModel(const QList<QList<QString> > tbl, QObject *parent = 0);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
bool hasChildren(const QModelIndex &) const;
QVariant data(const QModelIndex &idx, int) const;
bool setData(const QModelIndex &idx, const QVariant &value, int);
bool insertRows(int row, int count, const QModelIndex &parent= QModelIndex());
bool insertColumns(int column, int count, const QModelIndex &parent= QModelIndex());
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &) const override;
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
bool hasChildren(const QModelIndex &) const override;
QVariant data(const QModelIndex &idx, int) const override;
bool setData(const QModelIndex &idx, const QVariant &value, int) override;
bool insertRows(int row, int count, const QModelIndex &parent= QModelIndex()) override;
bool insertColumns(int column, int count, const QModelIndex &parent= QModelIndex()) override;
void setPersistent(const QModelIndex &from, const QModelIndex &to);
bool removeRows ( int row, int count, const QModelIndex & parent = QModelIndex() );
bool removeColumns( int column, int count, const QModelIndex & parent = QModelIndex());
bool removeRows ( int row, int count, const QModelIndex & parent = QModelIndex()) override;
bool removeColumns( int column, int count, const QModelIndex & parent = QModelIndex()) override;
bool moveRows (const QModelIndex &sourceParent, int sourceRow, int count,
const QModelIndex &destinationParent, int destinationChild);
const QModelIndex &destinationParent, int destinationChild) override;
bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count,
const QModelIndex &destinationParent, int destinationChild);
const QModelIndex &destinationParent, int destinationChild) override;
void reset();
bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent) const;
int row, int column, const QModelIndex &parent) const override;
int cCount, rCount;
mutable bool wrongIndex;
@ -2171,14 +2171,14 @@ public:
}
QHash<int, QByteArray> roleNames() const
QHash<int, QByteArray> roleNames() const override
{
QHash<int, QByteArray> roles = QStringListModel::roleNames();
roles.insert(Qt::UserRole + 2, "custom");
return roles;
}
Qt::DropActions supportedDragActions() const
Qt::DropActions supportedDragActions() const override
{
return QStringListModel::supportedDragActions() | Qt::MoveAction;
}

View File

@ -67,29 +67,29 @@ class SubQAbstractProxyModel : public QAbstractProxyModel
{
public:
// QAbstractProxyModel::mapFromSource is a pure virtual function.
QModelIndex mapFromSource(QModelIndex const& sourceIndex) const
QModelIndex mapFromSource(QModelIndex const& sourceIndex) const override
{ Q_UNUSED(sourceIndex); return QModelIndex(); }
// QAbstractProxyModel::mapToSource is a pure virtual function.
QModelIndex mapToSource(QModelIndex const& proxyIndex) const
QModelIndex mapToSource(QModelIndex const& proxyIndex) const override
{ Q_UNUSED(proxyIndex); return QModelIndex(); }
QModelIndex index(int, int, const QModelIndex&) const
QModelIndex index(int, int, const QModelIndex&) const override
{
return QModelIndex();
}
QModelIndex parent(const QModelIndex&) const
QModelIndex parent(const QModelIndex&) const override
{
return QModelIndex();
}
int rowCount(const QModelIndex&) const
int rowCount(const QModelIndex&) const override
{
return 0;
}
int columnCount(const QModelIndex&) const
int columnCount(const QModelIndex&) const override
{
return 0;
}
@ -399,7 +399,7 @@ class SwappingProxy : public QAbstractProxyModel
}
}
public:
virtual QModelIndex index(int row, int column, const QModelIndex &parentIdx) const
virtual QModelIndex index(int row, int column, const QModelIndex &parentIdx) const override
{
if (!sourceModel())
return QModelIndex();
@ -412,28 +412,28 @@ public:
return createIndex(row, column, parentIdx.internalPointer());
}
virtual QModelIndex parent(const QModelIndex &parentIdx) const
virtual QModelIndex parent(const QModelIndex &parentIdx) const override
{
// well, we're a 2D model
Q_UNUSED(parentIdx);
return QModelIndex();
}
virtual int rowCount(const QModelIndex &parentIdx) const
virtual int rowCount(const QModelIndex &parentIdx) const override
{
if (parentIdx.isValid() || !sourceModel())
return 0;
return sourceModel()->rowCount();
}
virtual int columnCount(const QModelIndex &parentIdx) const
virtual int columnCount(const QModelIndex &parentIdx) const override
{
if (parentIdx.isValid() || !sourceModel())
return 0;
return sourceModel()->rowCount();
}
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
{
if (!proxyIndex.isValid())
return QModelIndex();
@ -443,7 +443,7 @@ public:
return sourceModel()->index(swapRow(proxyIndex.row()), proxyIndex.column(), QModelIndex());
}
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
{
if (!sourceIndex.isValid())
return QModelIndex();
@ -485,9 +485,9 @@ void tst_QAbstractProxyModel::testSwappingRowsProxy()
class StandardItemModelWithCustomDragAndDrop : public QStandardItemModel
{
public:
QStringList mimeTypes() const { return QStringList() << QStringLiteral("foo/mimetype"); }
Qt::DropActions supportedDragActions() const { return Qt::CopyAction | Qt::LinkAction; }
Qt::DropActions supportedDropActions() const { return Qt::MoveAction; }
QStringList mimeTypes() const override { return QStringList() << QStringLiteral("foo/mimetype"); }
Qt::DropActions supportedDragActions() const override { return Qt::CopyAction | Qt::LinkAction; }
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
};
void tst_QAbstractProxyModel::testDragAndDrop()

View File

@ -43,9 +43,9 @@ Q_LOGGING_CATEGORY(lcItemModels, "qt.corelib.tests.itemmodels")
class DataChangedModel : public QAbstractListModel
{
public:
int rowCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 1; }
QVariant data(const QModelIndex&, int) const { return QVariant(); }
QModelIndex index(int row, int column, const QModelIndex &) const { return createIndex(row, column); }
int rowCount(const QModelIndex &parent) const override { return parent.isValid() ? 0 : 1; }
QVariant data(const QModelIndex&, int) const override { return QVariant(); }
QModelIndex index(int row, int column, const QModelIndex &) const override { return createIndex(row, column); }
void changeData()
{
@ -399,7 +399,7 @@ void tst_QIdentityProxyModel::dataChanged()
class AppendStringProxy : public QIdentityProxyModel
{
public:
QVariant data(const QModelIndex &index, int role) const
QVariant data(const QModelIndex &index, int role) const override
{
const QVariant result = QIdentityProxyModel::data(index, role);
if (role != Qt::DisplayRole)

View File

@ -127,17 +127,17 @@ public:
return helper.QAbstractItemModel::createIndex(row, column, data);
}
QModelIndex index(int, int, const QModelIndex&) const
QModelIndex index(int, int, const QModelIndex&) const override
{ return QModelIndex(); }
QModelIndex parent(const QModelIndex&) const
QModelIndex parent(const QModelIndex&) const override
{ return QModelIndex(); }
int rowCount(const QModelIndex & = QModelIndex()) const
int rowCount(const QModelIndex & = QModelIndex()) const override
{ return 0; }
int columnCount(const QModelIndex & = QModelIndex()) const
int columnCount(const QModelIndex & = QModelIndex()) const override
{ return 0; }
QVariant data(const QModelIndex &, int = Qt::DisplayRole) const
QVariant data(const QModelIndex &, int = Qt::DisplayRole) const override
{ return QVariant(); }
bool hasChildren(const QModelIndex &) const
bool hasChildren(const QModelIndex &) const override
{ return false; }
};
@ -2099,11 +2099,11 @@ public:
{
}
int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; }
int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; }
int rowCount(const QModelIndex& = QModelIndex()) const override { return row_count; }
int columnCount(const QModelIndex& = QModelIndex()) const override { return column_count; }
bool isEditable(const QModelIndex &) const { return true; }
QVariant data(const QModelIndex &idx, int role) const
QVariant data(const QModelIndex &idx, int role) const override
{
if (role == Qt::DisplayRole || role == Qt::EditRole)
return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',')
@ -2305,7 +2305,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2()
struct MyFilterModel : public QSortFilterProxyModel
{ // Override sort filter proxy to remove even numbered rows.
bool filtering;
virtual bool filterAcceptsRow( int source_row, const QModelIndex& /* source_parent */) const
virtual bool filterAcceptsRow( int source_row, const QModelIndex& /* source_parent */) const override
{
return !filtering || !( source_row & 1 );
}
@ -2693,7 +2693,7 @@ public:
{
}
void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override
{
QItemSelectionModel::select(selection, command);
m_target->select(selection, command);
@ -2701,13 +2701,13 @@ public:
using QItemSelectionModel::select;
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override
{
QItemSelectionModel::setCurrentIndex(index, command);
m_target->setCurrentIndex(index, command);
}
void clearCurrentIndex()
void clearCurrentIndex() override
{
QItemSelectionModel::clearCurrentIndex();
m_target->clearCurrentIndex();

View File

@ -44,7 +44,7 @@ class EventSpy : public QObject
public:
QList<int> recordedEvents;
bool eventFilter(QObject *, QEvent *event)
bool eventFilter(QObject *, QEvent *event) override
{
recordedEvents.append(event->type());
return false;
@ -234,7 +234,7 @@ class EventGenerator : public QObject
public:
QObject *other;
bool event(QEvent *e)
bool event(QEvent *e) override
{
if (e->type() == QEvent::MaxUser) {
QCoreApplication::sendPostedEvents(other, 0);
@ -424,7 +424,7 @@ signals:
void progress(int);
protected:
void run()
void run() override
{
emit progress(1);
emit progress(2);
@ -492,7 +492,7 @@ public slots:
}
public:
bool event(QEvent *event)
bool event(QEvent *event) override
{
switch (event->type()) {
case QEvent::User:
@ -545,7 +545,7 @@ class GlobalPostedEventsCountObject : public QObject
public:
QList<int> globalPostedEventsCount;
bool event(QEvent *event)
bool event(QEvent *event) override
{
if (event->type() == QEvent::User)
globalPostedEventsCount.append(qGlobalPostedEventsCount());
@ -591,7 +591,7 @@ public:
: counter(0)
{ }
bool event(QEvent *event)
bool event(QEvent *event) override
{
if (event->type() == QEvent::User)
++counter;
@ -622,7 +622,7 @@ class QuitBlocker : public QObject
Q_OBJECT
public:
bool eventFilter(QObject *, QEvent *event)
bool eventFilter(QObject *, QEvent *event) override
{
if (event->type() == QEvent::Quit) {
event->ignore();
@ -728,21 +728,21 @@ void tst_QCoreApplication::eventLoopExecAfterExit()
class DummyEventDispatcher : public QAbstractEventDispatcher {
public:
DummyEventDispatcher() : QAbstractEventDispatcher(), visited(false) {}
bool processEvents(QEventLoop::ProcessEventsFlags) {
bool processEvents(QEventLoop::ProcessEventsFlags) override {
visited = true;
emit awake();
QCoreApplication::sendPostedEvents();
return false;
}
void registerSocketNotifier(QSocketNotifier *) {}
void unregisterSocketNotifier(QSocketNotifier *) {}
void registerTimer(int , int , Qt::TimerType, QObject *) {}
bool unregisterTimer(int ) { return false; }
bool unregisterTimers(QObject *) { return false; }
QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); }
int remainingTime(int) { return 0; }
void wakeUp() {}
void interrupt() {}
void registerSocketNotifier(QSocketNotifier *) override {}
void unregisterSocketNotifier(QSocketNotifier *) override {}
void registerTimer(int , int , Qt::TimerType, QObject *) override {}
bool unregisterTimer(int ) override { return false; }
bool unregisterTimers(QObject *) override { return false; }
QList<TimerInfo> registeredTimers(QObject *) const override { return QList<TimerInfo>(); }
int remainingTime(int) override { return 0; }
void wakeUp() override {}
void interrupt() override {}
#ifdef Q_OS_WIN
bool registerEventNotifier(QWinEventNotifier *) { return false; }

View File

@ -51,7 +51,7 @@ class tst_QEventDispatcher : public QObject
bool doubleTimer = false;
protected:
bool event(QEvent *e);
bool event(QEvent *e) override;
public:
inline tst_QEventDispatcher()
@ -314,7 +314,7 @@ public:
inline ProcessEventsOnlySendsQueuedEvents() : eventsReceived(0) {}
bool event(QEvent *event)
bool event(QEvent *event) override
{
++eventsReceived;

View File

@ -77,7 +77,7 @@ signals:
void checkPoint();
public:
QEventLoop *eventLoop;
void run();
void run() override;
};
void EventLoopThread::run()
@ -101,7 +101,7 @@ public:
volatile int result2;
MultipleExecThread() : result1(0xdead), result2(0xbeef) {}
void run()
void run() override
{
QMutexLocker locker(&mutex);
// this exec should work
@ -180,7 +180,7 @@ private slots:
void testQuitLock();
protected:
void customEvent(QEvent *e);
void customEvent(QEvent *e) override;
};
void tst_QEventLoop::processEvents()
@ -446,7 +446,7 @@ class SocketTestThread : public QThread
Q_OBJECT
public:
SocketTestThread():QThread(0),testResult(false){};
void run()
void run() override
{
SocketEventsTester *tester = new SocketEventsTester();
if (tester->init())
@ -489,7 +489,7 @@ public:
: QObject(), gotTimerEvent(-1)
{ }
void timerEvent(QTimerEvent *event)
void timerEvent(QTimerEvent *event) override
{
gotTimerEvent = event->timerId();
}
@ -546,7 +546,7 @@ namespace DeliverInDefinedOrder {
}
int lastReceived[NbEventQueue];
int count;
virtual void customEvent(QEvent* e) {
virtual void customEvent(QEvent* e) override {
QVERIFY(e->type() >= QEvent::User);
QVERIFY(e->type() < QEvent::User + 5);
uint idx = e->type() - QEvent::User;

View File

@ -1342,9 +1342,9 @@ class TestObject : public QObject
// Manually expanded from Q_OBJECT macro
public:
static QMetaObject staticMetaObject;
virtual const QMetaObject *metaObject() const;
virtual void *qt_metacast(const char *);
virtual int qt_metacall(QMetaObject::Call, int, void **);
virtual const QMetaObject *metaObject() const override;
virtual void *qt_metacast(const char *) override;
virtual int qt_metacall(QMetaObject::Call, int, void **) override;
private:
Q_DECL_HIDDEN static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);

View File

@ -477,7 +477,7 @@ class MetaTypeTorturer: public QThread
{
Q_OBJECT
protected:
void run()
void run() override
{
Bar space[1];
space[0].~Bar();

View File

@ -776,9 +776,9 @@ public:
disconnectedSignals.clear();
}
protected:
void connectNotify(const QMetaMethod &signal)
void connectNotify(const QMetaMethod &signal) override
{ connectedSignals.append(signal); }
void disconnectNotify(const QMetaMethod &signal)
void disconnectNotify(const QMetaMethod &signal) override
{ disconnectedSignals.append(signal); }
};
@ -1003,9 +1003,9 @@ public:
disconnectedSignals.clear();
}
protected:
void connectNotify(const QMetaMethod &signal)
void connectNotify(const QMetaMethod &signal) override
{ connectedSignals.append(signal); }
void disconnectNotify(const QMetaMethod &signal)
void disconnectNotify(const QMetaMethod &signal) override
{ disconnectedSignals.append(signal); }
Q_SIGNALS:
void signal1();
@ -1606,7 +1606,7 @@ class TestThread : public QThread
{
Q_OBJECT
public:
inline void run()
inline void run() override
{
*object = new QObject;
*child = new QObject(*object);
@ -1689,7 +1689,7 @@ public:
: QObject(parent), timerEventThread(0), customEventThread(0), slotThread(0)
{ }
void customEvent(QEvent *)
void customEvent(QEvent *) override
{
if (customEventThread)
qFatal("%s: customEventThread should be null", Q_FUNC_INFO);
@ -1697,7 +1697,7 @@ public:
emit theSignal();
}
void timerEvent(QTimerEvent *)
void timerEvent(QTimerEvent *) override
{
if (timerEventThread)
qFatal("%s: timerEventThread should be null", Q_FUNC_INFO);
@ -1736,7 +1736,7 @@ public:
// wait for thread to start
(void) eventLoop.exec();
}
void run()
void run() override
{ (void) exec(); }
};
@ -2311,7 +2311,7 @@ class FooObject: public QObject, public Foo::Bar
Q_OBJECT
Q_INTERFACES(Foo::Bar)
public:
int rtti() const { return 42; }
int rtti() const override { return 42; }
};
class BlehObject : public QObject, public Foo::Bleh
@ -2319,7 +2319,7 @@ class BlehObject : public QObject, public Foo::Bleh
Q_OBJECT
Q_INTERFACES(Foo::Bleh)
public:
int rtti() const { return 43; }
int rtti() const override { return 43; }
};
void tst_QObject::declareInterface()
@ -2913,7 +2913,7 @@ class DynamicPropertyObject : public PropertyObject
public:
inline DynamicPropertyObject() {}
inline virtual bool event(QEvent *e) {
inline virtual bool event(QEvent *e) override {
if (e->type() == QEvent::DynamicPropertyChange) {
changedDynamicProperties.append(static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName());
}
@ -3060,7 +3060,7 @@ public:
events.clear();
}
bool eventFilter(QObject *object, QEvent *event)
bool eventFilter(QObject *object, QEvent *event) override
{
events.append(qMakePair(object, event->type()));
return false;
@ -3198,7 +3198,7 @@ void tst_QObject::installEventFilter()
class EmitThread : public QThread
{ Q_OBJECT
public:
void run(void) {
void run(void) override {
emit work();
}
signals:
@ -4292,7 +4292,7 @@ public:
ThreadAffinityThread(SenderObject *sender)
: sender(sender)
{ }
void run()
void run() override
{
sender->emitSignal1();
}
@ -5655,7 +5655,7 @@ signals:
class VirtualSlotsObject : public VirtualSlotsObjectBase {
Q_OBJECT
public slots:
virtual void slot1() {
virtual void slot1() override {
derived_counter1++;
}
public:
@ -5704,8 +5704,8 @@ public:
public slots:
void regularSlot() { ++regular_call_count; }
virtual void slot1() { ++derived_counter2; }
virtual void slot2() { ++virtual_base_count; }
virtual void slot1() override { ++derived_counter2; }
virtual void slot2() override { ++virtual_base_count; }
};
struct NormalBase
@ -6804,6 +6804,7 @@ public:
explicit CountedExceptionThrower(bool throwException, QObject *parent = nullptr)
: QObject(parent)
{
Q_UNUSED(throwException);
#ifndef QT_NO_EXCEPTIONS
if (throwException)
throw ObjectException();

View File

@ -327,7 +327,8 @@ void tst_QPointer::castDuringDestruction()
}
class TestRunnable : public QObject, public QRunnable {
void run() {
void run() override
{
QPointer<QObject> obj1 = new QObject;
QPointer<QObject> obj2 = new QObject;
obj1->moveToThread(thread()); // this is the owner thread

View File

@ -593,7 +593,7 @@ class Consumer : public QThread
{
public:
void run()
void run() override
{
QSharedMemory consumer(QLatin1String("market"));
while (!consumer.attach()) {
@ -641,7 +641,7 @@ public:
}
}
void run()
void run() override
{
char *memory = (char*)producer.data();

View File

@ -335,7 +335,8 @@ public:
secondTimerId = -1; // started later
}
bool event(QEvent *e) {
bool event(QEvent *e) override
{
if (e->type() == 4002) {
// got the posted event
if (timeoutsForFirst == 1 && timeoutsForSecond == 0)
@ -345,7 +346,8 @@ public:
return QObject::event(e);
}
void timerEvent(QTimerEvent *te) {
void timerEvent(QTimerEvent *te) override
{
if (te->timerId() == firstTimerId) {
if (++timeoutsForFirst == 1) {
killTimer(extraTimerId);
@ -403,7 +405,7 @@ public:
: inTimerEvent(false), timerEventRecursed(false), interval(interval)
{ }
void timerEvent(QTimerEvent *timerEvent)
void timerEvent(QTimerEvent *timerEvent) override
{
timerEventRecursed = inTimerEvent;
if (timerEventRecursed) {
@ -460,7 +462,7 @@ public:
: times(0), target(target), recurse(false)
{ }
void timerEvent(QTimerEvent *timerEvent)
void timerEvent(QTimerEvent *timerEvent) override
{
if (++times == target) {
killTimer(timerEvent->timerId());
@ -579,7 +581,7 @@ public:
interval = interval ? 0 : 1000;
}
void timerEvent(QTimerEvent* ev)
void timerEvent(QTimerEvent* ev) override
{
if (ev->timerId() != m_timer.timerId())
return;
@ -677,7 +679,7 @@ public:
delete timer;
}
void run()
void run() override
{
QEventLoop eventLoop;
timer = new QTimer;
@ -947,7 +949,7 @@ class DontBlockEvents : public QObject
Q_OBJECT
public:
DontBlockEvents();
void timerEvent(QTimerEvent*);
void timerEvent(QTimerEvent*) override;
int count;
int total;

View File

@ -37,7 +37,7 @@ class tst_QTranslator : public QObject
public:
tst_QTranslator();
protected:
bool eventFilter(QObject *obj, QEvent *event);
bool eventFilter(QObject *obj, QEvent *event) override;
private slots:
void initTestCase();
@ -157,7 +157,7 @@ void tst_QTranslator::load()
class TranslatorThread : public QThread
{
void run() {
void run() override {
QTranslator tor( 0 );
tor.load("hellotr_la");
@ -316,7 +316,7 @@ struct TranslateThread : public QThread
QMutex startupLock;
QWaitCondition runningCondition;
void run() {
void run() override {
bool startSignalled = false;
while (terminate.loadRelaxed() == 0) {

View File

@ -39,7 +39,7 @@ class Plugin1 : public QObject, public PluginInterface1
Q_INTERFACES(PluginInterface1)
public:
virtual QString pluginName() const;
virtual QString pluginName() const override;
};
#endif // THEPLUGIN_H

View File

@ -39,7 +39,7 @@ class Plugin2 : public QObject, public PluginInterface2
Q_INTERFACES(PluginInterface2)
public:
virtual QString pluginName() const;
virtual QString pluginName() const override;
};
#endif // THEPLUGIN_H

View File

@ -39,7 +39,7 @@ class AlmostPlugin : public QObject, public PluginInterface
Q_INTERFACES(PluginInterface)
public:
QString pluginName() const;
QString pluginName() const override;
void unresolvedSymbol() const;
};

View File

@ -39,7 +39,7 @@ class ThePlugin : public QObject, public PluginInterface
Q_INTERFACES(PluginInterface)
public:
virtual QString pluginName() const;
virtual QString pluginName() const override;
};
#endif // THEPLUGIN_H

View File

@ -380,7 +380,7 @@ class UuidThread : public QThread
public:
QUuid uuid;
void run()
void run() override
{
uuid = QUuid::createUuid();
}

View File

@ -2795,7 +2795,7 @@ void tst_QTextStream::status_word_read()
class FakeBuffer : public QBuffer
{
protected:
qint64 writeData(const char *c, qint64 i) { return m_lock ? 0 : QBuffer::writeData(c, i); }
qint64 writeData(const char *c, qint64 i) override { return m_lock ? 0 : QBuffer::writeData(c, i); }
public:
FakeBuffer(bool locked = false) : m_lock(locked) {}
void setLocked(bool locked) { m_lock = locked; }

View File

@ -853,7 +853,7 @@ void tst_QXmlStream::addExtraNamespaceDeclarations()
class EntityResolver : public QXmlStreamEntityResolver {
public:
QString resolveUndeclaredEntity(const QString &name) {
QString resolveUndeclaredEntity(const QString &name) override {
static int count = 0;
return name.toUpper() + QString::number(++count);
}
@ -1467,7 +1467,7 @@ void tst_QXmlStream::crashInXmlStreamReader() const
class FakeBuffer : public QBuffer
{
protected:
qint64 writeData(const char *c, qint64 i)
qint64 writeData(const char *c, qint64 i) override
{
qint64 ai = qMin(m_capacity, i);
m_capacity -= ai;

View File

@ -1828,7 +1828,7 @@ public:
QStringEncoder encode;
QStringDecoder decode;
QString *target;
void run()
void run() override
{
QString str = QString::fromLatin1("abcdefghijklmonpqrstufvxyz");
for (int i = 0; i < 10000; ++i) {

View File

@ -887,7 +887,7 @@ void tst_QAtomicInt::fetchAndAdd_loop()
class FetchAndAddThread : public QThread
{
public:
void run()
void run() override
{
for (int i = 0; i < iterations; ++i)

View File

@ -232,7 +232,7 @@ void tst_QFutureWatcher::canceled()
class IntTask : public RunFunctionTask<int>
{
public:
void runFunctor()
void runFunctor() override
{
result = 10;
}
@ -466,7 +466,7 @@ const int maxProgress = 100000;
class ProgressEmitterTask : public RunFunctionTask<void>
{
public:
void runFunctor()
void runFunctor() override
{
promise.setProgressRange(0, maxProgress);
for (int p = 0; p <= maxProgress; ++p)
@ -496,7 +496,7 @@ template <typename T>
class ProgressTextTask : public RunFunctionTask<T>
{
public:
void runFunctor()
void runFunctor() override
{
this->promise.setProgressValueAndText(1, QLatin1String("Foo 1"));

View File

@ -204,7 +204,7 @@ void tst_QMutex::tryLock_non_recursive()
class Thread : public QThread
{
public:
void run()
void run() override
{
testsTurn.release();
@ -331,7 +331,7 @@ void tst_QMutex::try_lock_for_non_recursive() {
class Thread : public QThread
{
public:
void run()
void run() override
{
testsTurn.release();
@ -460,7 +460,7 @@ void tst_QMutex::try_lock_until_non_recursive()
class Thread : public QThread
{
public:
void run()
void run() override
{
const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution);
testsTurn.release();
@ -586,7 +586,7 @@ void tst_QMutex::tryLock_recursive()
class Thread : public QThread
{
public:
void run()
void run() override
{
testsTurn.release();
@ -713,7 +713,7 @@ void tst_QMutex::try_lock_for_recursive()
class Thread : public QThread
{
public:
void run()
void run() override
{
testsTurn.release();
@ -841,7 +841,7 @@ void tst_QMutex::try_lock_until_recursive()
class Thread : public QThread
{
public:
void run()
void run() override
{
const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution);
testsTurn.release();
@ -972,7 +972,7 @@ public:
inline mutex_Thread(QMutex &m) : test_mutex(m) { }
void run()
void run() override
{
test_mutex.lock();
@ -997,7 +997,7 @@ public:
inline rmutex_Thread(QRecursiveMutex &m) : test_mutex(m) { }
void run()
void run() override
{
test_mutex.lock();
test_mutex.lock();
@ -1101,7 +1101,7 @@ public:
t.start();
QThread::start();
}
void run()
void run() override
{
while (t.elapsed() < one_minute) {
mutex.lock();
@ -1140,7 +1140,7 @@ class TryLockRaceThread : public QThread
public:
static QMutex mutex;
void run()
void run() override
{
QElapsedTimer t;
t.start();
@ -1186,7 +1186,8 @@ void tst_QMutex::tryLockDeadlock()
struct TrylockThread : QThread {
TrylockThread(QMutex &mut) : mut(mut) {}
QMutex &mut;
void run() {
void run() override
{
for (int i = 0; i < 100000; ++i) {
if (mut.tryLock(0)) {
if ((++tryLockDeadlockCounter) != 1)
@ -1239,7 +1240,8 @@ void tst_QMutex::tryLockNegative()
QMutex &mut;
int timeout;
int tryLockResult;
void run() {
void run() override
{
tryLockResult = mut.tryLock(timeout);
mut.unlock();
}
@ -1281,7 +1283,7 @@ public:
t.start();
QThread::start();
}
void run()
void run() override
{
quint64 i = 0;
while (t.elapsed() < one_minute) {

View File

@ -74,7 +74,7 @@ void tst_QMutexLocker::scopeTest()
class ScopeTestThread : public tst_QMutexLockerThread
{
public:
void run()
void run() override
{
waitForTest();
@ -119,7 +119,7 @@ void tst_QMutexLocker::unlockAndRelockTest()
class UnlockAndRelockThread : public tst_QMutexLockerThread
{
public:
void run()
void run() override
{
QMutexLocker locker(&mutex);
@ -165,7 +165,7 @@ void tst_QMutexLocker::lockerStateTest()
class LockerStateThread : public tst_QMutexLockerThread
{
public:
void run()
void run() override
{
{
QMutexLocker locker(&mutex);

View File

@ -73,7 +73,7 @@ void tst_QReadLocker::scopeTest()
class ScopeTestThread : public tst_QReadLockerThread
{
public:
void run()
void run() override
{
waitForTest();
@ -118,7 +118,7 @@ void tst_QReadLocker::unlockAndRelockTest()
class UnlockAndRelockThread : public tst_QReadLockerThread
{
public:
void run()
void run() override
{
QReadLocker locker(&lock);
@ -164,7 +164,7 @@ void tst_QReadLocker::lockerStateTest()
class LockerStateThread : public tst_QReadLockerThread
{
public:
void run()
void run() override
{
{
QReadLocker locker(&lock);

View File

@ -214,7 +214,7 @@ void tst_QReadWriteLock::tryReadLock()
class Thread : public QThread
{
public:
void run()
void run() override
{
testsTurn.release();
@ -331,7 +331,7 @@ void tst_QReadWriteLock::tryWriteLock()
{
public:
Thread() : failureCount(0) { }
void run()
void run() override
{
testsTurn.release();
@ -416,7 +416,7 @@ class WriteLockThread : public QThread
public:
QReadWriteLock &testRwlock;
inline WriteLockThread(QReadWriteLock &l) : testRwlock(l) { }
void run()
void run() override
{
testRwlock.lockForWrite();
testRwlock.unlock();
@ -434,7 +434,7 @@ class ReadLockThread : public QThread
public:
QReadWriteLock &testRwlock;
inline ReadLockThread(QReadWriteLock &l) : testRwlock(l) { }
void run()
void run() override
{
testRwlock.lockForRead();
testRwlock.unlock();
@ -451,7 +451,7 @@ class WriteLockReleasableThread : public QThread
public:
QReadWriteLock &testRwlock;
inline WriteLockReleasableThread(QReadWriteLock &l) : testRwlock(l) { }
void run()
void run() override
{
testRwlock.lockForWrite();
while (release.loadRelaxed() == false) {
@ -471,7 +471,7 @@ class ReadLockReleasableThread : public QThread
public:
QReadWriteLock &testRwlock;
inline ReadLockReleasableThread(QReadWriteLock &l) : testRwlock(l) { }
void run()
void run() override
{
testRwlock.lockForRead();
while (release.loadRelaxed() == false) {
@ -505,7 +505,7 @@ public:
,waitTime(waitTime)
,print(print)
{ }
void run()
void run() override
{
t.start();
while (t.elapsed()<runTime) {
@ -541,7 +541,7 @@ public:
,waitTime(waitTime)
,print(print)
{ }
void run()
void run() override
{
t.start();
while (t.elapsed() < runTime) {
@ -578,7 +578,7 @@ public:
,waitTime(waitTime)
,maxval(maxval)
{ }
void run()
void run() override
{
t.start();
while (t.elapsed() < runTime) {
@ -618,7 +618,7 @@ public:
,runTime(runTime)
,waitTime(waitTime)
{ }
void run()
void run() override
{
t.start();
while (t.elapsed() < runTime) {
@ -845,7 +845,7 @@ class DeleteOnUnlockThread : public QThread
public:
DeleteOnUnlockThread(QReadWriteLock **lock, QWaitCondition *startup, QMutex *waitMutex)
:m_lock(lock), m_startup(startup), m_waitMutex(waitMutex) {}
void run()
void run() override
{
m_waitMutex->lock();
m_startup->wakeAll();
@ -943,7 +943,7 @@ void tst_QReadWriteLock::recursiveReadLock()
QReadWriteLock *lock;
bool tryLockForWriteResult;
void run()
void run() override
{
testsTurn.release();
@ -1038,7 +1038,7 @@ void tst_QReadWriteLock::recursiveWriteLock()
QReadWriteLock *lock;
bool tryLockForReadResult;
void run()
void run() override
{
testsTurn.release();

View File

@ -57,7 +57,7 @@ public:
ThreadOne() {}
protected:
void run()
void run() override
{
int i = 0;
while ( i < 100 ) {
@ -76,7 +76,7 @@ public:
ThreadN(int n) :N(n) { }
protected:
void run()
void run() override
{
int i = 0;
while ( i < 100 ) {
@ -400,7 +400,7 @@ void tst_QSemaphore::tryAcquireWithTimeoutStarvation()
QSemaphore *semaphore;
int amountToConsume, timeout;
void run()
void run() override
{
startup.release();
forever {
@ -497,7 +497,7 @@ QSemaphore usedSpace;
class Producer : public QThread
{
public:
void run();
void run() override;
};
static const int Timeout = 60 * 1000; // 1min
@ -521,7 +521,7 @@ void Producer::run()
class Consumer : public QThread
{
public:
void run();
void run() override;
};
void Consumer::run()

View File

@ -142,7 +142,7 @@ public:
Qt::HANDLE id;
QThread *thread;
void run()
void run() override
{
id = QThread::currentThreadId();
thread = QThread::currentThread();
@ -155,7 +155,7 @@ public:
QMutex mutex;
QWaitCondition cond;
void run()
void run() override
{
QMutexLocker locker(&mutex);
cond.wakeOne();
@ -180,7 +180,7 @@ public:
int code;
int result;
void run()
void run() override
{
Simple_Thread::run();
if (object) {
@ -195,7 +195,7 @@ public:
class Terminate_Thread : public Simple_Thread
{
public:
void run()
void run() override
{
setTerminationEnabled(false);
{
@ -224,7 +224,7 @@ public:
Quit_Object *object;
int result;
void run()
void run() override
{
Simple_Thread::run();
if (object) {
@ -245,7 +245,7 @@ public:
int elapsed; // result, in *MILLISECONDS*
void run()
void run() override
{
QMutexLocker locker(&mutex);
@ -563,7 +563,7 @@ void tst_QThread::exec()
MultipleExecThread() : res1(-2), res2(-2) { }
void run()
void run() override
{
{
Exit_Object o;
@ -1002,7 +1002,8 @@ void tst_QThread::exitAndExec()
QSemaphore sem1;
QSemaphore sem2;
volatile int value;
void run() {
void run() override
{
sem1.acquire();
value = exec(); //First entrence
sem2.release();
@ -1053,7 +1054,7 @@ public:
QWaitCondition cond1;
QWaitCondition cond2;
void run()
void run() override
{
QMutexLocker locker(&mutex);
cond1.wait(&mutex);
@ -1118,7 +1119,7 @@ void tst_QThread::wait3_slowDestructor()
void tst_QThread::destroyFinishRace()
{
class Thread : public QThread { void run() {} };
class Thread : public QThread { void run() override {} };
for (int i = 0; i < 15; i++) {
Thread *thr = new Thread;
connect(thr, SIGNAL(finished()), thr, SLOT(deleteLater()));
@ -1138,7 +1139,8 @@ void tst_QThread::startFinishRace()
class Thread : public QThread {
public:
Thread() : i (50) {}
void run() {
void run() override
{
i--;
if (!i) disconnect(this, SIGNAL(finished()), 0, 0);
}
@ -1161,7 +1163,7 @@ void tst_QThread::startFinishRace()
void tst_QThread::startAndQuitCustomEventLoop()
{
struct Thread : QThread {
void run() { QEventLoop().exec(); }
void run() override { QEventLoop().exec(); }
};
for (int i = 0; i < 5; i++) {
@ -1213,21 +1215,21 @@ QT_END_NAMESPACE
class DummyEventDispatcher : public QAbstractEventDispatcher {
public:
DummyEventDispatcher() : QAbstractEventDispatcher() {}
bool processEvents(QEventLoop::ProcessEventsFlags) {
bool processEvents(QEventLoop::ProcessEventsFlags) override {
visited.storeRelaxed(true);
emit awake();
QCoreApplication::sendPostedEvents();
return false;
}
void registerSocketNotifier(QSocketNotifier *) {}
void unregisterSocketNotifier(QSocketNotifier *) {}
void registerTimer(int, int, Qt::TimerType, QObject *) {}
bool unregisterTimer(int ) { return false; }
bool unregisterTimers(QObject *) { return false; }
QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); }
int remainingTime(int) { return 0; }
void wakeUp() {}
void interrupt() {}
void registerSocketNotifier(QSocketNotifier *) override {}
void unregisterSocketNotifier(QSocketNotifier *) override {}
void registerTimer(int, int, Qt::TimerType, QObject *) override {}
bool unregisterTimer(int) override { return false; }
bool unregisterTimers(QObject *) override { return false; }
QList<TimerInfo> registeredTimers(QObject *) const override { return QList<TimerInfo>(); }
int remainingTime(int) override { return 0; }
void wakeUp() override {}
void interrupt() override {}
#ifdef Q_OS_WIN
bool registerEventNotifier(QWinEventNotifier *) { return false; }

View File

@ -77,7 +77,7 @@ public:
~IncrementThread() { wait(); }
protected:
void run()
void run() override
{
sem2.release();
sem1.acquire(); // synchronize

View File

@ -43,7 +43,7 @@ class FunctionPointerTask : public QRunnable
public:
FunctionPointerTask(FunctionPointer function)
:function(function) {}
void run() { function(); }
void run() override { function(); }
private:
FunctionPointer function;
};
@ -228,7 +228,7 @@ QAtomicInt ran; // bool
class TestTask : public QRunnable
{
public:
void run()
void run() override
{
ran.storeRelaxed(true);
}
@ -256,7 +256,7 @@ QAtomicInt *value = 0;
class IntAccessor : public QRunnable
{
public:
void run()
void run() override
{
for (int i = 0; i < 100; ++i) {
value->ref();
@ -286,7 +286,7 @@ QThread *recycledThread = 0;
class ThreadRecorderTask : public QRunnable
{
public:
void run()
void run() override
{
recycledThread = QThread::currentThread();
threadRecyclingSemaphore.release();
@ -332,7 +332,7 @@ public:
setAutoDelete(false);
}
void run()
void run() override
{
thread = QThread::currentThread();
runCount.ref();
@ -474,7 +474,7 @@ void tst_QThreadPool::setMaxThreadCountStartsAndStopsThreads()
WaitingTask() { setAutoDelete(false); }
void run()
void run() override
{
waitForStarted.release();
waitToFinish.acquire();
@ -671,7 +671,7 @@ void tst_QThreadPool::reserveAndStart() // QTBUG-21051
WaitingTask() { setAutoDelete(false); }
void run()
void run() override
{
count.ref();
waitForStarted.release();
@ -722,7 +722,8 @@ void tst_QThreadPool::reserveAndStart() // QTBUG-21051
QAtomicInt count;
class CountingRunnable : public QRunnable
{
public: void run()
public:
void run() override
{
count.ref();
}
@ -750,7 +751,7 @@ void tst_QThreadPool::tryStart()
WaitingTask() { setAutoDelete(false); }
void run()
void run() override
{
semaphore.acquire();
count.ref();
@ -780,7 +781,7 @@ void tst_QThreadPool::tryStartPeakThreadCount()
public:
CounterTask() { setAutoDelete(false); }
void run()
void run() override
{
{
QMutexLocker lock(&mutex);
@ -819,7 +820,7 @@ void tst_QThreadPool::tryStartCount()
public:
SleeperTask() { setAutoDelete(false); }
void run()
void run() override
{
QTest::qWait(50);
}
@ -854,7 +855,7 @@ void tst_QThreadPool::priorityStart()
public:
QSemaphore &sem;
Holder(QSemaphore &sem) : sem(sem) {}
void run()
void run() override
{
sem.acquire();
}
@ -864,7 +865,7 @@ void tst_QThreadPool::priorityStart()
public:
QAtomicPointer<QRunnable> &ptr;
Runner(QAtomicPointer<QRunnable> &ptr) : ptr(ptr) {}
void run()
void run() override
{
ptr.testAndSetRelaxed(0, this);
}
@ -928,7 +929,7 @@ void tst_QThreadPool::waitForDoneTimeout()
QMutex &mutex;
explicit BlockedTask(QMutex &m) : mutex(m) {}
void run()
void run() override
{
mutex.lock();
mutex.unlock();
@ -953,7 +954,7 @@ void tst_QThreadPool::clear()
public:
QSemaphore & sem;
BlockingRunnable(QSemaphore & sem) : sem(sem){}
void run()
void run() override
{
sem.acquire();
count.ref();
@ -1105,7 +1106,7 @@ void tst_QThreadPool::stackSize()
}
void run()
void run() override
{
*stackSize = QThread::currentThread()->stackSize();
}
@ -1136,7 +1137,7 @@ void tst_QThreadPool::stressTest()
semaphore.acquire();
}
void run()
void run() override
{
semaphore.release();
}
@ -1162,7 +1163,8 @@ void tst_QThreadPool::takeAllAndIncreaseMaxThreadCount() {
setAutoDelete(false);
}
void run() {
void run() override
{
m_mainBarrier->release();
m_threadBarrier->acquire();
}
@ -1224,7 +1226,7 @@ void tst_QThreadPool::waitForDoneAfterTake()
, m_threadBarrier(threadBarrier)
{}
void run()
void run() override
{
m_mainBarrier->release();
m_threadBarrier->acquire();

View File

@ -129,7 +129,7 @@ public:
: pointers(p)
{ }
void run()
void run() override
{
pointers.setLocalData(new Pointer);
@ -249,7 +249,7 @@ void tst_QThreadStorage::ensureCleanupOrder()
: first(first), second(second)
{ }
void run()
void run() override
{
// set in reverse order, but shouldn't matter, the data
// will be deleted in the order the thread storage objects
@ -340,7 +340,7 @@ void tst_QThreadStorage::leakInDestructor()
Thread(QThreadStorage<ThreadStorageLocalDataTester *> &t) : tls(t) { }
void run()
void run() override
{
QVERIFY(!tls.hasLocalData());
tls.setLocalData(new ThreadStorageLocalDataTester);
@ -392,7 +392,7 @@ void tst_QThreadStorage::resetInDestructor()
class Thread : public QThread
{
public:
void run()
void run() override
{
QVERIFY(!ThreadStorageResetLocalDataTesterTls()->hasLocalData());
ThreadStorageResetLocalDataTesterTls()->setLocalData(new ThreadStorageResetLocalDataTester);
@ -428,7 +428,8 @@ void tst_QThreadStorage::valueBased()
Thread(QThreadStorage<SPointer> &t1, QThreadStorage<QString> &t2, QThreadStorage<int> &t3)
: tlsSPointer(t1), tlsString(t2), tlsInt(t3) { }
void run() {
void run() override
{
/*QVERIFY(!tlsSPointer.hasLocalData());
QVERIFY(!tlsString.hasLocalData());
QVERIFY(!tlsInt.hasLocalData());*/

View File

@ -77,7 +77,7 @@ public:
inline wait_QMutex_Thread_1()
{ }
void run()
void run() override
{
mutex.lock();
cond.wakeOne();
@ -98,7 +98,7 @@ public:
: mutex(0), cond(0)
{ }
void run()
void run() override
{
mutex->lock();
started.wakeOne();
@ -116,7 +116,7 @@ public:
inline wait_QReadWriteLock_Thread_1()
{ }
void run()
void run() override
{
readWriteLock.lockForWrite();
cond.wakeOne();
@ -137,7 +137,7 @@ public:
: readWriteLock(0), cond(0)
{ }
void run()
void run() override
{
readWriteLock->lockForRead();
started.wakeOne();
@ -398,7 +398,7 @@ public:
static inline void sleep(ulong s)
{ QThread::sleep(s); }
void run()
void run() override
{
Q_ASSERT(count);
Q_ASSERT(mutex);
@ -430,7 +430,7 @@ public:
static inline void sleep(ulong s)
{ QThread::sleep(s); }
void run()
void run() override
{
Q_ASSERT(count);
Q_ASSERT(readWriteLock);
@ -764,7 +764,8 @@ public:
QWaitCondition *startup;
QWaitCondition *waitCondition;
void run() {
void run() override
{
mutex->lock();
ready = true;
@ -796,7 +797,8 @@ public:
QWaitCondition *startup;
QWaitCondition *waitCondition;
void run() {
void run() override
{
readWriteLock->lockForWrite();
ready = true;

View File

@ -73,7 +73,7 @@ void tst_QWriteLocker::scopeTest()
class ScopeTestThread : public tst_QWriteLockerThread
{
public:
void run()
void run() override
{
waitForTest();
@ -118,7 +118,7 @@ void tst_QWriteLocker::unlockAndRelockTest()
class UnlockAndRelockThread : public tst_QWriteLockerThread
{
public:
void run()
void run() override
{
QWriteLocker locker(&lock);
@ -164,7 +164,7 @@ void tst_QWriteLocker::lockerStateTest()
class LockerStateThread : public tst_QWriteLockerThread
{
public:
void run()
void run() override
{
{
QWriteLocker locker(&lock);

View File

@ -79,8 +79,8 @@ public:
class Derived : public Base
{
public:
virtual Base *clone() { return new Derived(*this); }
virtual bool isBase() const { return false; }
virtual Base *clone() override { return new Derived(*this); }
virtual bool isBase() const override { return false; }
};
QT_BEGIN_NAMESPACE

View File

@ -120,7 +120,7 @@ class FreeListThread : public QThread
public:
inline FreeListThread() : QThread() { }
inline void run()
inline void run() override
{
QElapsedTimer t;
t.start();

View File

@ -160,7 +160,7 @@ public:
class SubClass : public AbstractClass
{
public:
virtual int member() const
virtual int member() const override
{
return 5;
}

View File

@ -115,7 +115,7 @@ public:
class SubClass : public AbstractClass
{
public:
int member() const { return 5; }
int member() const override { return 5; }
};
void tst_QTaggedPointer::dereferenceOperator()

View File

@ -487,7 +487,7 @@ public:
wait();
}
void run()
void run() override
{
QDBusConnection con = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "ThreadConnection");
if (!con.isConnected())

View File

@ -270,12 +270,12 @@ class VirtualObject: public QDBusVirtualObject
public:
VirtualObject() :success(true) {}
QString introspect(const QString & /* path */) const
QString introspect(const QString & /* path */) const override
{
return QString();
}
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) {
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override {
++callCount;
lastMessage = message;

View File

@ -405,7 +405,8 @@ class VirtualObject: public QDBusVirtualObject
public:
VirtualObject() :success(true) {}
QString introspect(const QString &path) const {
QString introspect(const QString &path) const override
{
Q_ASSERT(QThread::currentThread() == thread());
if (path == "/some/path/superNode")
return "zitroneneis";
@ -416,7 +417,8 @@ public:
return QString();
}
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) {
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override
{
Q_ASSERT(QThread::currentThread() == thread());
++callCount;
lastMessage = message;

View File

@ -323,7 +323,7 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded()
public:
tst_QDBusPendingCall *tst;
WorkerThread(tst_QDBusPendingCall *tst) : tst(tst) {}
void run()
void run() override
{
QDBusPendingCall ac = tst->sendMessage();
// QVERIFY(!ac.isFinished());

View File

@ -41,7 +41,7 @@ class Thread : public QThread
static int counter;
public:
Thread(bool automatic = true);
void run();
void run() override;
using QThread::exec;
};

View File

@ -115,7 +115,8 @@ public:
virtual ~QSequentialFile() {}
virtual bool isSequential() const {
virtual bool isSequential() const override
{
return true;
}

View File

@ -50,8 +50,8 @@ class MyImageIOHandler : public QImageIOHandler
{
public:
MyImageIOHandler() : QImageIOHandler() { }
bool canRead() const { return true; }
bool read(QImage *) { return true; }
bool canRead() const override { return true; }
bool read(QImage *) override { return true; }
};
tst_QImageIOHandler::tst_QImageIOHandler()

View File

@ -152,11 +152,11 @@ class PaintEngine : public QPaintEngine
{
public:
PaintEngine() : QPaintEngine() {}
bool begin(QPaintDevice *) { return true; }
bool end() { return true; }
void updateState(const QPaintEngineState &) {}
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {}
Type type() const { return Raster; }
bool begin(QPaintDevice *) override { return true; }
bool end() override { return true; }
void updateState(const QPaintEngineState &) override {}
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {}
Type type() const override { return Raster; }
QFont font() { return state->font(); }
};
@ -165,7 +165,7 @@ class Picture : public QPicture
{
public:
Picture() : QPicture() {}
QPaintEngine *paintEngine() const { return (QPaintEngine*)&mPaintEngine; }
QPaintEngine *paintEngine() const override { return (QPaintEngine*)&mPaintEngine; }
private:
PaintEngine mPaintEngine;
};

View File

@ -1063,7 +1063,7 @@ void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
class Thread : public QThread
{
public:
void run()
void run() override
{
QTest::ignoreMessage(QtWarningMsg,
"QPixmap: It is not safe to use pixmaps outside the GUI thread");

View File

@ -53,12 +53,12 @@ public:
{
}
void resizeEvent(QResizeEvent *)
void resizeEvent(QResizeEvent *) override
{
backingStore.resize(size());
}
void exposeEvent(QExposeEvent *event)
void exposeEvent(QExposeEvent *event) override
{
QRect rect(QPoint(), size());

View File

@ -55,7 +55,7 @@ private:
QByteArray readFileContent(QFileOpenEvent& event);
bool appendFileContent(QFileOpenEvent& event, const QByteArray& writeContent);
bool event(QEvent *);
bool event(QEvent *) override;
QTemporaryDir m_temporaryDir;
QString m_originalCurrent;

View File

@ -186,7 +186,7 @@ class DummyWindow : public QWindow
public:
DummyWindow() : m_focusObject(nullptr) {}
virtual QObject *focusObject() const
virtual QObject *focusObject() const override
{
return m_focusObject;
}
@ -353,14 +353,14 @@ void tst_QGuiApplication::abortQuitOnShow()
class FocusChangeWindow: public QWindow
{
protected:
virtual bool event(QEvent *ev)
virtual bool event(QEvent *ev) override
{
if (ev->type() == QEvent::FocusAboutToChange)
windowDuringFocusAboutToChange = qGuiApp->focusWindow();
return QWindow::event(ev);
}
virtual void focusOutEvent(QFocusEvent *)
virtual void focusOutEvent(QFocusEvent *) override
{
windowDuringFocusOut = qGuiApp->focusWindow();
}
@ -602,7 +602,7 @@ public:
inline explicit BlockableWindow(QWindow *parent = nullptr)
: QWindow(parent), blocked(false), leaves(0), enters(0) {}
bool event(QEvent *e)
bool event(QEvent *e) override
{
switch (e->type()) {
case QEvent::WindowBlocked:
@ -985,7 +985,7 @@ class TestPluginFactory : public QGenericPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "testplugin.json")
public:
QObject* create(const QString &key, const QString &)
QObject* create(const QString &key, const QString &) override
{
if (key == "testplugin")
return new TestPlugin;
@ -1003,7 +1003,7 @@ public:
: customEvents(0)
{}
virtual void customEvent(QEvent *)
virtual void customEvent(QEvent *) override
{
customEvents++;
}

View File

@ -39,7 +39,7 @@ class InputItem : public QObject
public:
InputItem() : cursorRectangle(1, 2, 3, 4), m_enabled(true) {}
bool event(QEvent *event)
bool event(QEvent *event) override
{
if (event->type() == QEvent::InputMethodQuery) {
QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
@ -74,7 +74,7 @@ class DummyWindow : public QWindow
public:
DummyWindow() : m_focusObject(0) {}
virtual QObject *focusObject() const
virtual QObject *focusObject() const override
{
return m_focusObject;
}

View File

@ -37,8 +37,8 @@ class Window : public QWindow
public:
~Window() { reset(); }
void keyPressEvent(QKeyEvent *event) { recordEvent(event); }
void keyReleaseEvent(QKeyEvent *event) { recordEvent(event); }
void keyPressEvent(QKeyEvent *event) override { recordEvent(event); }
void keyReleaseEvent(QKeyEvent *event) override { recordEvent(event); }
void reset() {
qDeleteAll(keyEvents.begin(), keyEvents.end());

View File

@ -46,7 +46,7 @@ public:
int mouseReleaseButtons;
int mouseReleaseModifiers;
protected:
void mousePressEvent(QMouseEvent *e)
void mousePressEvent(QMouseEvent *e) override
{
QWindow::mousePressEvent(e);
mousePressButton = e->button();
@ -55,7 +55,7 @@ protected:
mousePressEventRecieved = true;
e->accept();
}
void mouseReleaseEvent(QMouseEvent *e)
void mouseReleaseEvent(QMouseEvent *e) override
{
QWindow::mouseReleaseEvent(e);
mouseReleaseButton = e->button();

View File

@ -88,7 +88,7 @@ public:
TstDialog( QWidget *mouseWidget, QWidget *parent, const char *name );
int count() { return c; }
protected:
void showEvent ( QShowEvent * );
void showEvent(QShowEvent *) override;
public slots:
void releaseMouse();
void closeDialog();

View File

@ -402,7 +402,8 @@ public:
using Window::Window;
protected:
void paintEvent(QPaintEvent *) {
void paintEvent(QPaintEvent *) override
{
// Handled, not calling base class
}
};

View File

@ -58,11 +58,11 @@ class MyPaintEngine : public QPaintEngine
{
public:
MyPaintEngine() : QPaintEngine() {}
bool begin(QPaintDevice *) { return true; }
bool end() { return true; }
void updateState(const QPaintEngineState &) {}
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {}
Type type() const { return Raster; }
bool begin(QPaintDevice *) override { return true; }
bool end() override { return true; }
void updateState(const QPaintEngineState &) override {}
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {}
Type type() const override { return Raster; }
};
// Testing get/set functions

View File

@ -2634,17 +2634,17 @@ class DummyPaintEngine : public QPaintEngine, public QPaintDevice
{
public:
DummyPaintEngine() : QPaintEngine(no_porter_duff()) {}
virtual bool begin(QPaintDevice *) { return true; }
virtual bool end() { return true; }
virtual bool begin(QPaintDevice *) override { return true; }
virtual bool end() override { return true; }
virtual void updateState(const QPaintEngineState &) {}
virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {}
virtual void updateState(const QPaintEngineState &) override {}
virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {}
virtual Type type() const { return User; }
virtual Type type() const override { return User; }
virtual QPaintEngine *paintEngine() const { return (QPaintEngine *)this; }
virtual QPaintEngine *paintEngine() const override { return (QPaintEngine *)this; }
virtual int metric(PaintDeviceMetric metric) const { Q_UNUSED(metric); return 0; };
virtual int metric(PaintDeviceMetric metric) const override { Q_UNUSED(metric); return 0; };
};
static bool success;
@ -2698,7 +2698,8 @@ class ViewportTestWidget : public QWidget
{
public:
ViewportTestWidget(QWidget *parent = 0) : QWidget(parent), hasPainted(false) {}
QSize sizeHint() const {
QSize sizeHint() const override
{
return QSize(100, 100);
}
@ -2706,7 +2707,8 @@ public:
bool hasPainted;
protected:
void paintEvent(QPaintEvent *) {
void paintEvent(QPaintEvent *) override
{
hasPainted = true;
QPainter p(this);
viewport = p.viewport();
@ -4451,7 +4453,7 @@ class TestProxy : public QGraphicsProxyWidget
{
public:
TestProxy() : QGraphicsProxyWidget() {}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
{
QGraphicsProxyWidget::paint(painter, option, widget);
deviceTransform = painter->deviceTransform();
@ -4464,7 +4466,7 @@ class TestWidget : public QWidget
Q_OBJECT
public:
TestWidget() : QWidget(), painted(false) {}
void paintEvent(QPaintEvent *)
void paintEvent(QPaintEvent *) override
{
QPainter p(this);
deviceTransform = p.deviceTransform();
@ -4645,7 +4647,7 @@ void tst_QPainter::drawPointScaled()
class GradientProducer : public QThread
{
protected:
void run();
void run() override;
};
void GradientProducer::run()
@ -4739,7 +4741,7 @@ void tst_QPainter::QTBUG38781_NoBrushAndQBitmap()
class TextDrawerThread : public QThread
{
public:
void run();
void run() override;
QImage rendering;
};

View File

@ -150,14 +150,14 @@ struct SharedResource : public QOpenGLSharedResource
tracker->destructorCalls++;
}
void invalidateResource()
void invalidateResource() override
{
resource = 0;
if (tracker)
tracker->invalidateResourceCalls++;
}
void freeResource(QOpenGLContext *context)
void freeResource(QOpenGLContext *context) override
{
Q_ASSERT(context == QOpenGLContext::currentContext());
Q_UNUSED(context);

View File

@ -72,13 +72,14 @@ public:
{
}
void draw(QPainter *, const PaintContext &) {}
int hitTest(const QPointF &, Qt::HitTestAccuracy) const { return 0; }
int pageCount() const { return 0; }
QSizeF documentSize() const { return QSizeF(); }
QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); }
QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); }
void documentChanged(int from, int /* oldLength */, int length) {
void draw(QPainter *, const PaintContext &) override {}
int hitTest(const QPointF &, Qt::HitTestAccuracy) const override { return 0; }
int pageCount() const override { return 0; }
QSizeF documentSize() const override { return QSizeF(); }
QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); }
QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); }
void documentChanged(int from, int /* oldLength */, int length) override
{
++changeEvents;
QTextBlock last = document()->lastBlock();

View File

@ -887,30 +887,30 @@ public:
styleSheets.append(sheet);
}
virtual QStringList nodeNames(NodePtr node) const { return QStringList(reinterpret_cast<QDomElement *>(node.ptr)->tagName()); }
virtual QString attribute(NodePtr node, const QString &name) const { return reinterpret_cast<QDomElement *>(node.ptr)->attribute(name); }
virtual QStringList nodeNames(NodePtr node) const override { return QStringList(reinterpret_cast<QDomElement *>(node.ptr)->tagName()); }
virtual QString attribute(NodePtr node, const QString &name) const override { return reinterpret_cast<QDomElement *>(node.ptr)->attribute(name); }
virtual bool hasAttribute(NodePtr node, const QString &name) const { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttribute(name); }
virtual bool hasAttributes(NodePtr node) const { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttributes(); }
virtual bool hasAttributes(NodePtr node) const override { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttributes(); }
virtual bool isNullNode(NodePtr node) const {
virtual bool isNullNode(NodePtr node) const override {
return reinterpret_cast<QDomElement *>(node.ptr)->isNull();
}
virtual NodePtr parentNode(NodePtr node) const {
virtual NodePtr parentNode(NodePtr node) const override {
NodePtr parent;
parent.ptr = new QDomElement(reinterpret_cast<QDomElement *>(node.ptr)->parentNode().toElement());
return parent;
}
virtual NodePtr duplicateNode(NodePtr node) const {
virtual NodePtr duplicateNode(NodePtr node) const override {
NodePtr n;
n.ptr = new QDomElement(*reinterpret_cast<QDomElement *>(node.ptr));
return n;
}
virtual NodePtr previousSiblingNode(NodePtr node) const {
virtual NodePtr previousSiblingNode(NodePtr node) const override {
NodePtr sibling;
sibling.ptr = new QDomElement(reinterpret_cast<QDomElement *>(node.ptr)->previousSiblingElement());
return sibling;
}
virtual void freeNode(NodePtr node) const {
virtual void freeNode(NodePtr node) const override {
delete reinterpret_cast<QDomElement *>(node.ptr);
}

View File

@ -847,7 +847,7 @@ public:
TestPixmap(int w, int h) : QPixmap(w, h), testPaintEngine(new TestPaintEngine) {}
~TestPixmap() { delete testPaintEngine; }
QPaintEngine *paintEngine() const
QPaintEngine *paintEngine() const override
{
return testPaintEngine;
}

View File

@ -45,18 +45,18 @@ public:
inline QTestDocumentLayout(QTextDocument *doc)
: QAbstractTextDocumentLayout(doc), documentChangedCalled(false) {}
virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) {}
virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) override {}
virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const { return 0; }
virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; }
virtual void documentChanged(int, int, int) { documentChangedCalled = true; }
virtual void documentChanged(int, int, int) override { documentChangedCalled = true; }
virtual int pageCount() const { return 1; }
virtual int pageCount() const override { return 1; }
virtual QSizeF documentSize() const { return QSize(); }
virtual QSizeF documentSize() const override { return QSize(); }
virtual QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); }
virtual QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); }
virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); }
virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); }
bool documentChangedCalled;
};
@ -122,7 +122,7 @@ public:
inline TestHighlighter(QTextDocument *parent)
: QSyntaxHighlighter(parent), highlighted(false), callCount(0) {}
virtual void highlightBlock(const QString &text)
virtual void highlightBlock(const QString &text) override
{
for (int i = 0; i < formats.count(); ++i) {
const QTextLayout::FormatRange &range = formats.at(i);
@ -179,7 +179,7 @@ public:
highlighted = false;
}
virtual void highlightBlock(const QString &text)
virtual void highlightBlock(const QString &text) override
{
QTextCharFormat commentFormat;
commentFormat.setForeground(Qt::darkGreen);
@ -294,7 +294,7 @@ public:
state = 0;
}
virtual void highlightBlock(const QString &text)
virtual void highlightBlock(const QString &text) override
{
highlighted = true;
if (text == QLatin1String("changestate"))

View File

@ -36,10 +36,10 @@ class QTestDocumentLayout : public QAbstractTextDocumentLayout
Q_OBJECT
public:
QTestDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc), f(-1), called(false) {}
virtual void draw(QPainter *, const PaintContext &) {}
virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const { return 0; }
virtual void draw(QPainter *, const PaintContext &) override {}
virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; }
virtual void documentChanged(int from, int oldLength, int length)
virtual void documentChanged(int from, int oldLength, int length) override
{
called = true;
lastDocumentLengths.append(QTextDocumentPrivate::get(document())->length());
@ -55,11 +55,11 @@ public:
}
}
virtual int pageCount() const { return 1; }
virtual QSizeF documentSize() const { return QSizeF(); }
virtual int pageCount() const override { return 1; }
virtual QSizeF documentSize() const override { return QSizeF(); }
virtual QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); }
virtual QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); }
virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); }
virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); }
int f;
int o;

View File

@ -209,13 +209,13 @@ class MyAbstractTextDocumentLayout : public QAbstractTextDocumentLayout
{
public:
MyAbstractTextDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc) {}
void draw(QPainter *, const PaintContext &) {}
int hitTest(const QPointF &, Qt::HitTestAccuracy) const { return 0; }
int pageCount() const { return 0; }
QSizeF documentSize() const { return QSizeF(); }
QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); }
QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); }
void documentChanged(int, int, int) {}
void draw(QPainter *, const PaintContext &) override {}
int hitTest(const QPointF &, Qt::HitTestAccuracy) const override { return 0; }
int pageCount() const override { return 0; }
QSizeF documentSize() const override { return QSizeF(); }
QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); }
QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); }
void documentChanged(int, int, int) override {}
};
QString tst_QTextDocument::cssFontSizeString(const QFont &font)
@ -2384,7 +2384,7 @@ public:
bool hasResourceCached();
protected:
virtual QVariant loadResource(int type, const QUrl &name);
virtual QVariant loadResource(int type, const QUrl &name) override;
private:
QUrl url;
@ -3185,7 +3185,7 @@ class BaseDocument : public QTextDocument
public:
QUrl loadedResource() const { return resourceUrl; }
QVariant loadResource(int type, const QUrl &name)
QVariant loadResource(int type, const QUrl &name) override
{
resourceUrl = name;
return QTextDocument::loadResource(type, name);

View File

@ -3134,7 +3134,8 @@ public:
QPixmap testPixmap;
virtual QVariant loadResource(int type, const QUrl &name) {
virtual QVariant loadResource(int type, const QUrl &name) override
{
if (name.toString() == QLatin1String("testPixmap")) {
return testPixmap;
}

View File

@ -1683,8 +1683,8 @@ QT_END_NAMESPACE
void tst_QTextLayout::testTabDPIScale()
{
class MyPaintDevice : public QPaintDevice {
QPaintEngine *paintEngine () const { return 0; }
int metric (QPaintDevice::PaintDeviceMetric metric) const {
QPaintEngine *paintEngine () const override { return 0; }
int metric (QPaintDevice::PaintDeviceMetric metric) const override {
switch(metric) {
case QPaintDevice::PdmWidth:
case QPaintDevice::PdmHeight:

View File

@ -1043,30 +1043,30 @@ public:
PaintEngine()
: QPaintEngine(QPaintEngine::PaintEngineFeatures{ })
{}
virtual Type type() const
virtual Type type() const override
{
return User;
}
virtual bool begin(QPaintDevice *)
virtual bool begin(QPaintDevice *) override
{
return true;
}
virtual bool end()
virtual bool end() override
{
return true;
}
virtual void updateState(const QPaintEngineState &)
virtual void updateState(const QPaintEngineState &) override
{}
virtual void drawRects(const QRect *, int)
virtual void drawRects(const QRect *, int) override
{}
virtual void drawRects(const QRectF *r, int)
virtual void drawRects(const QRectF *r, int) override
{
if (painter()->brush() == QBrush(Qt::green))
{
rects.append(*r);
}
}
virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &)
virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override
{}
};
@ -1115,7 +1115,7 @@ public:
layout.setUnits(QPageLayout::Point);
setPageLayout(layout);
}
virtual int metric(PaintDeviceMetric metric) const
virtual int metric(PaintDeviceMetric metric) const override
{
if (PdmDevicePixelRatio == metric)
return 1;
@ -1131,11 +1131,11 @@ public:
return 700;
return 900;
}
virtual QPaintEngine *paintEngine() const
virtual QPaintEngine *paintEngine() const override
{
return engine;
}
bool newPage()
bool newPage() override
{
++pages;
return true;

View File

@ -40,8 +40,8 @@ public:
InsertCommand(QString *str, int idx, const QString &text,
QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual void undo() override;
virtual void redo() override;
private:
QString *m_str;
@ -54,8 +54,8 @@ class RemoveCommand : public QUndoCommand
public:
RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual void undo() override;
virtual void redo() override;
private:
QString *m_str;
@ -68,10 +68,10 @@ class AppendCommand : public QUndoCommand
public:
AppendCommand(QString *str, const QString &text, QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual int id() const;
virtual bool mergeWith(const QUndoCommand *other);
virtual void undo() override;
virtual void redo() override;
virtual int id() const override;
virtual bool mergeWith(const QUndoCommand *other) override;
bool merged;

View File

@ -41,8 +41,8 @@ public:
InsertCommand(QString *str, int idx, const QString &text,
QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual void undo() override;
virtual void redo() override;
private:
QString *m_str;
@ -55,8 +55,8 @@ class RemoveCommand : public QUndoCommand
public:
RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
virtual void undo() override;
virtual void redo() override;
private:
QString *m_str;
@ -71,10 +71,10 @@ public:
QUndoCommand *parent = 0);
~AppendCommand();
virtual void undo();
virtual void redo();
virtual int id() const;
virtual bool mergeWith(const QUndoCommand *other);
virtual void undo() override;
virtual void redo() override;
virtual int id() const override;
virtual bool mergeWith(const QUndoCommand *other) override;
bool merged;
bool fail_merge;
@ -91,8 +91,8 @@ public:
IdleCommand(QUndoCommand *parent = 0);
~IdleCommand();
virtual void undo();
virtual void redo();
virtual void undo() override;
virtual void redo() override;
};
class MoveMouseCommand : public QUndoCommand
@ -101,10 +101,10 @@ public:
MoveMouseCommand(QPoint *mouse, QPoint oldPoint, QPoint newPoint, QUndoCommand *parent = 0);
~MoveMouseCommand();
virtual void undo();
virtual void redo();
virtual int id() const;
virtual bool mergeWith(const QUndoCommand *other);
virtual void undo() override;
virtual void redo() override;
virtual int id() const override;
virtual bool mergeWith(const QUndoCommand *other) override;
private:
QPoint *m_mouse;

View File

@ -86,7 +86,7 @@ public:
clear();
}
QIODevice *data(const QUrl &url)
QIODevice *data(const QUrl &url) override
{
gotData = true;
return QNetworkDiskCache::data(url);

View File

@ -111,7 +111,7 @@ public:
open(QIODevice::ReadOnly | QIODevice::Unbuffered);
}
qint64 readData(char *data, qint64 maxlen) { return inputBuffer.read(data, maxlen); }
qint64 readData(char *data, qint64 maxlen) override { return inputBuffer.read(data, maxlen); }
QBuffer inputBuffer;
};

View File

@ -668,7 +668,7 @@ public:
, cachePath(cachePath)
{}
void run()
void run() override
{
QByteArray longString = "Hello World, this is some long string, well not really that long";
for (int j = 0; j < 10; ++j)

View File

@ -616,7 +616,7 @@ public:
}
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
//qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6;
#ifndef QT_NO_SSL
@ -767,7 +767,7 @@ public:
lastQuery = QNetworkProxyQuery();
}
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override
{
lastQuery = query;
++callCount;
@ -785,17 +785,17 @@ public:
MyMemoryCache(QObject *parent) : QAbstractNetworkCache(parent) {}
QNetworkCacheMetaData metaData(const QUrl &url)
QNetworkCacheMetaData metaData(const QUrl &url) override
{
return cache.value(url.toEncoded()).first;
}
void updateMetaData(const QNetworkCacheMetaData &metaData)
void updateMetaData(const QNetworkCacheMetaData &metaData) override
{
cache[metaData.url().toEncoded()].first = metaData;
}
QIODevice *data(const QUrl &url)
QIODevice *data(const QUrl &url) override
{
CacheData::ConstIterator it = cache.find(url.toEncoded());
if (it == cache.constEnd())
@ -807,13 +807,13 @@ public:
return io;
}
bool remove(const QUrl &url)
bool remove(const QUrl &url) override
{
cache.remove(url.toEncoded());
return true;
}
qint64 cacheSize() const
qint64 cacheSize() const override
{
qint64 total = 0;
foreach (const CachedContent &entry, cache)
@ -821,17 +821,17 @@ public:
return total;
}
QIODevice *prepare(const QNetworkCacheMetaData &)
QIODevice *prepare(const QNetworkCacheMetaData &) override
{
qFatal("%s: Should not have tried to add to the cache", Q_FUNC_INFO);
return 0;
}
void insert(QIODevice *)
void insert(QIODevice *) override
{
qFatal("%s: Should not have tried to add to the cache", Q_FUNC_INFO);
}
void clear() { cache.clear(); }
void clear() override { cache.clear(); }
};
Q_DECLARE_METATYPE(MyMemoryCache::CachedContent)
Q_DECLARE_METATYPE(MyMemoryCache::CacheData)
@ -849,32 +849,32 @@ public:
QHash<QUrl, QIODevice*> m_buffers;
QList<QUrl> m_insertedUrls;
QNetworkCacheMetaData metaData(const QUrl &)
QNetworkCacheMetaData metaData(const QUrl &) override
{
return QNetworkCacheMetaData();
}
void updateMetaData(const QNetworkCacheMetaData &)
void updateMetaData(const QNetworkCacheMetaData &) override
{
}
QIODevice *data(const QUrl &)
QIODevice *data(const QUrl &) override
{
return 0;
}
bool remove(const QUrl &url)
bool remove(const QUrl &url) override
{
delete m_buffers.take(url);
return m_insertedUrls.removeAll(url) > 0;
}
qint64 cacheSize() const
qint64 cacheSize() const override
{
return 0;
}
QIODevice *prepare(const QNetworkCacheMetaData &metaData)
QIODevice *prepare(const QNetworkCacheMetaData &metaData) override
{
QBuffer* buffer = new QBuffer;
buffer->open(QIODevice::ReadWrite);
@ -883,14 +883,14 @@ public:
return buffer;
}
void insert(QIODevice *buffer)
void insert(QIODevice *buffer) override
{
QUrl url = buffer->property("url").toUrl();
m_insertedUrls << url;
delete m_buffers.take(url);
}
void clear() { m_insertedUrls.clear(); }
void clear() override { m_insertedUrls.clear(); }
};
class DataReader: public QObject
@ -985,7 +985,7 @@ public:
return nextPendingConnection();
}
}
virtual void incomingConnection(qintptr socketDescriptor)
virtual void incomingConnection(qintptr socketDescriptor) override
{
#ifndef QT_NO_SSL
if (doSsl) {
@ -1090,7 +1090,7 @@ public:
}
protected:
void run()
void run() override
{
BlockingTcpServer server(doSsl);
server.listen();
@ -1234,7 +1234,7 @@ private slots:
}
protected:
void timerEvent(QTimerEvent *)
void timerEvent(QTimerEvent *) override
{
//qDebug() << "RateControlledReader: timerEvent bytesAvailable=" << device->bytesAvailable();
if (readBufferSize > 0 && device->bytesAvailable() > readBufferSize) {
@ -5011,7 +5011,7 @@ class SslServer : public QTcpServer
Q_OBJECT
public:
SslServer() : socket(0), m_ssl(true) {}
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
QSslSocket *serverSocket = new QSslSocket;
serverSocket->setParent(this);
@ -7921,7 +7921,7 @@ void tst_QNetworkReply::synchronousAuthenticationCache()
{
public:
MiniAuthServer(QThread *thread) : MiniHttpServer(QByteArray(), false, thread) {}
virtual void reply()
virtual void reply() override
{
dataToTransmit =
@ -8139,13 +8139,13 @@ public:
timer.start();
}
virtual qint64 writeData(const char* , qint64 )
virtual qint64 writeData(const char* , qint64 ) override
{
Q_ASSERT(false);
return 0;
}
virtual qint64 readData(char* data, qint64 maxlen)
virtual qint64 readData(char* data, qint64 maxlen) override
{
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota;
maxlen = qMin(maxlen, buffer.bytesAvailable());
@ -8163,14 +8163,14 @@ public:
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota << read << ret << buffer.bytesAvailable();
return ret;
}
virtual bool atEnd() const { return buffer.atEnd(); }
virtual qint64 size() const { return data.length(); }
qint64 bytesAvailable() const
virtual bool atEnd() const override { return buffer.atEnd(); }
virtual qint64 size() const override { return data.length(); }
qint64 bytesAvailable() const override
{
return buffer.bytesAvailable() + QIODevice::bytesAvailable();
}
virtual bool isSequential() const { return false; } // random access, we can seek
virtual bool seek (qint64 pos) { return buffer.seek(pos); }
virtual bool isSequential() const override { return false; } // random access, we can seek
virtual bool seek (qint64 pos) override { return buffer.seek(pos); }
protected slots:
void timeoutSlot()
{

View File

@ -525,7 +525,7 @@ void tst_QHostInfo::raceCondition()
class LookupThread : public QThread
{
protected:
inline void run()
inline void run() override
{
QHostInfo info = QHostInfo::fromName("a-single" TEST_DOMAIN);
QCOMPARE(info.error(), QHostInfo::NoError);

View File

@ -73,14 +73,14 @@ private slots:
void incomplete();
protected slots:
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth);
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth) override;
private:
void readNotification() { }
void writeNotification() { }
void closeNotification() { }
void exceptionNotification() { }
void connectionNotification() { }
void readNotification() override { }
void writeNotification() override { }
void closeNotification() override { }
void exceptionNotification() override { }
void connectionNotification() override { }
};
class MiniSocks5ResponseHandler : public QObject

View File

@ -474,7 +474,7 @@ public:
}
protected:
void run()
void run() override
{
sleep(2);
@ -575,7 +575,7 @@ public:
bool ok;
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
// how a user woulddo it (qabstractsocketengine is not public)
unsigned long arg = 0;
@ -713,7 +713,7 @@ public:
lastQuery = QNetworkProxyQuery();
}
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override
{
lastQuery = query;
++callCount;

View File

@ -56,7 +56,7 @@ public:
My4Server(QObject *parent = 0);
protected:
void incomingConnection(qintptr socket);
void incomingConnection(qintptr socket) override;
private slots:
void stopServer();

View File

@ -1375,7 +1375,7 @@ public:
}
protected:
void run()
void run() override
{
bool timedOut = false;
while (!quit) {
@ -1865,7 +1865,7 @@ public:
}
protected:
inline void run()
inline void run() override
{
#ifndef QT_NO_SSL
QFETCH_GLOBAL(bool, ssl);
@ -2265,7 +2265,7 @@ class TestThread2 : public QThread
{
Q_OBJECT
public:
void run()
void run() override
{
QFile fileWriter("fifo");
QVERIFY(fileWriter.open(QFile::WriteOnly));
@ -2880,7 +2880,7 @@ public:
lastQuery = QNetworkProxyQuery();
}
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override
{
lastQuery = query;
++callCount;

View File

@ -1221,7 +1221,7 @@ void tst_QSslCertificate::extensionsCritical()
class TestThread : public QThread
{
public:
void run()
void run() override
{
effectiveDate = cert.effectiveDate();
expiryDate = cert.expiryDate();

View File

@ -1228,7 +1228,7 @@ signals:
void alertSent(QSsl::AlertLevel level, QSsl::AlertType type, const QString &message);
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
QSslConfiguration configuration = config;
socket = new QSslSocket(this);
@ -1881,7 +1881,7 @@ void tst_QSslSocket::wildcard()
class SslServer2 : public QTcpServer
{
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
QSslSocket *socket = new QSslSocket(this);
socket->ignoreSslErrors();
@ -2111,7 +2111,7 @@ public:
QSslSocket *socket;
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
socket = new QSslSocket(this);
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
@ -2163,7 +2163,7 @@ signals:
void listening();
protected:
void run()
void run() override
{
// if all goes well (no timeouts), this thread will sleep for a total of 500 ms
// (i.e., 5 times 100 ms, one sleep for each operation)
@ -2292,7 +2292,7 @@ public:
QSslSocket *socket;
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
socket = new QSslSocket(this);
@ -3010,7 +3010,7 @@ public:
QSslSocket *socket;
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
socket = new QSslSocket;
socket->setSocketDescriptor(socketDescriptor);
@ -3612,7 +3612,7 @@ public:
PskProvider m_pskProvider;
protected:
void incomingConnection(qintptr socketDescriptor)
void incomingConnection(qintptr socketDescriptor) override
{
socket = new QSslSocket(this);
socket->setSslConfiguration(config);

View File

@ -33,7 +33,7 @@
class DerivedClass : public BaseClass
{
public:
void wasAPureVirtualFunction();
void wasAPureVirtualFunction() override;
};
#endif

View File

@ -41,12 +41,12 @@ class DynamicTreeModel : public QAbstractItemModel
public:
DynamicTreeModel(QObject *parent = 0);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &index = QModelIndex()) const;
int columnCount(const QModelIndex &index = QModelIndex()) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &index = QModelIndex()) const override;
int columnCount(const QModelIndex &index = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void clear();
@ -137,7 +137,7 @@ public:
{
}
virtual void doCommand();
virtual void doCommand() override;
};
class ModelMoveCommand : public ModelChangeCommand
@ -153,7 +153,7 @@ public:
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
const QModelIndex &destParent, int destRow);
virtual void doCommand();
virtual void doCommand() override;
virtual void emitPostSignal();
@ -184,8 +184,8 @@ public:
virtual ~ModelResetCommand();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
const QModelIndex &destParent, int destRow) override;
virtual void emitPostSignal() override;
};
/**
@ -200,8 +200,8 @@ public:
virtual ~ModelResetCommandFixed();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
const QModelIndex &destParent, int destRow) override;
virtual void emitPostSignal() override;
};
class ModelChangeChildrenLayoutsCommand : public ModelChangeCommand
@ -214,7 +214,7 @@ public:
{
}
virtual void doCommand();
virtual void doCommand() override;
void setSecondAncestorRowNumbers(QList<int> rows)
{

View File

@ -104,7 +104,8 @@ public:
QThread::start();
}
void run() {
void run() override
{
QTimer zeroTimer;
connect(&zeroTimer, SIGNAL(timeout()), object, SLOT(theSlot()));
connect(&zeroTimer, SIGNAL(timeout()), this, SLOT(checkStopWatch()), Qt::DirectConnection);
@ -219,7 +220,8 @@ public:
objects[i]->moveToThread(this);
}
void run() {
void run() override
{
for (int i = number-1; i >= 0; --i) {
/* Do some more connection and disconnection between object in this thread that have not been destroyed yet */
@ -417,7 +419,7 @@ public:
{
}
void run()
void run() override
{
while (!isInterruptionRequested()) {
QMetaObject::Connection conn = connect(sender, &DisconnectRaceSenderObject::theSignal,
@ -441,7 +443,7 @@ public:
{
}
void run()
void run() override
{
while (!isInterruptionRequested()) {
emit sender->theSignal();
@ -490,7 +492,7 @@ public:
{
}
void run()
void run() override
{
QScopedPointer<DeleteReceiverRaceReceiver> receiver(new DeleteReceiverRaceReceiver(sender));
exec();

Some files were not shown because too many files have changed in this diff Show More