diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2014-07-14 09:13:02 +0200 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2014-07-15 08:44:44 +0200 |
commit | 3b0c2b7c1b3ccdfe6867884a7e210bfc63e10f84 (patch) | |
tree | 4c75a4fa9f023c4bfc6746a4412922a8efe3b017 /examples/network/torrent/peerwireclient.h | |
parent | 6d87e3ed40173eac8c275d5926266359d53c74c7 (diff) |
Examples: Add Q_DECL_OVERRIDE to overridden functions
Q_DECL_OVERRIDE (which expands to 'override' for supported compiler)
helps to declare the intent (that it is an overridden function) and
force compilation error when there is no such virtual function in the
base class.
The examples should show the best practice of having it, as it may save
the programmer quite some time in case of change of API or typo in the
function name or arguments.
This change was done automatically with
clang-modernize -add-override -override-macros
And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint
Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'examples/network/torrent/peerwireclient.h')
-rw-r--r-- | examples/network/torrent/peerwireclient.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/network/torrent/peerwireclient.h b/examples/network/torrent/peerwireclient.h index 35e4cc6ffb..12ce0696f6 100644 --- a/examples/network/torrent/peerwireclient.h +++ b/examples/network/torrent/peerwireclient.h @@ -112,14 +112,14 @@ public: qint64 uploadSpeed() const; bool canTransferMore() const; - qint64 bytesAvailable() const { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); } + qint64 bytesAvailable() const Q_DECL_OVERRIDE { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); } qint64 socketBytesAvailable() const { return socket.bytesAvailable(); } qint64 socketBytesToWrite() const { return socket.bytesToWrite(); } - void setReadBufferSize(qint64 size); + void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE; void connectToHost(const QHostAddress &address, - quint16 port, OpenMode openMode = ReadWrite); + quint16 port, OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE; void diconnectFromHost(); signals: @@ -138,11 +138,11 @@ signals: void bytesReceived(qint64 size); protected: - void timerEvent(QTimerEvent *event); + void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; - qint64 readData(char *data, qint64 maxlen); - qint64 readLineData(char *data, qint64 maxlen); - qint64 writeData(const char *data, qint64 len); + qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; + qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; + qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; private slots: void sendHandShake(); |