summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 17:34:27 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-27 08:27:38 +0000
commite17c89f4ce74e5699ed50dc2187a39d8990316c4 (patch)
treeb1f9b85d5bd1233d8931813dc4e06f7342be2249 /examples
parente41d067227eb6225b05df88ab724708588fa5304 (diff)
use the override keyword consistently and correctly (clang-tidy)
Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/networkaccessmanagerfactory/main.cpp2
-rw-r--r--examples/qml/qmlextensionplugins/plugin.cpp6
-rw-r--r--examples/quick/imageprovider/imageprovider.cpp6
-rw-r--r--examples/quick/imageresponseprovider/imageresponseprovider.cpp10
-rw-r--r--examples/quick/quickwidgets/quickwidget/fbitem.cpp6
-rw-r--r--examples/quick/scenegraph/graph/linenode.cpp6
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp6
-rw-r--r--examples/quick/scenegraph/simplematerial/simplematerial.cpp12
-rw-r--r--examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp4
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.cpp2
-rw-r--r--examples/quick/scenegraph/threadedanimation/spinner.cpp2
-rw-r--r--examples/quick/scenegraph/twotextureproviders/xorblender.cpp12
-rw-r--r--examples/quick/textureprovider/etcprovider.cpp6
13 files changed, 40 insertions, 40 deletions
diff --git a/examples/qml/networkaccessmanagerfactory/main.cpp b/examples/qml/networkaccessmanagerfactory/main.cpp
index 76d487e029..95dfb5990d 100644
--- a/examples/qml/networkaccessmanagerfactory/main.cpp
+++ b/examples/qml/networkaccessmanagerfactory/main.cpp
@@ -74,7 +74,7 @@ static int proxyPort = 0;
class MyNetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory
{
public:
- virtual QNetworkAccessManager *create(QObject *parent);
+ QNetworkAccessManager *create(QObject *parent) override;
};
QNetworkAccessManager *MyNetworkAccessManagerFactory::create(QObject *parent)
diff --git a/examples/qml/qmlextensionplugins/plugin.cpp b/examples/qml/qmlextensionplugins/plugin.cpp
index 3ef7f04f95..4866106e4a 100644
--- a/examples/qml/qmlextensionplugins/plugin.cpp
+++ b/examples/qml/qmlextensionplugins/plugin.cpp
@@ -87,7 +87,7 @@ signals:
void timeChanged();
protected:
- void timerEvent(QTimerEvent *)
+ void timerEvent(QTimerEvent *) override
{
QTime now = QTime::currentTime();
if (now.second() == 59 && now.minute() == time.minute() && now.hour() == time.hour()) {
@@ -125,7 +125,7 @@ public:
}
}
- ~TimeModel()
+ ~TimeModel() override
{
if (--instances == 0) {
timer->stop();
@@ -154,7 +154,7 @@ class QExampleQmlPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- void registerTypes(const char *uri)
+ void registerTypes(const char *uri) override
{
Q_ASSERT(uri == QLatin1String("TimeExample"));
qmlRegisterType<TimeModel>(uri, 1, 0, "Time");
diff --git a/examples/quick/imageprovider/imageprovider.cpp b/examples/quick/imageprovider/imageprovider.cpp
index 2a2355031a..662bd8bb70 100644
--- a/examples/quick/imageprovider/imageprovider.cpp
+++ b/examples/quick/imageprovider/imageprovider.cpp
@@ -65,7 +65,7 @@ public:
{
}
- QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
+ QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
{
int width = 100;
int height = 50;
@@ -99,12 +99,12 @@ class ImageProviderExtensionPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- void registerTypes(const char *uri)
+ void registerTypes(const char *uri) override
{
Q_UNUSED(uri);
}
- void initializeEngine(QQmlEngine *engine, const char *uri)
+ void initializeEngine(QQmlEngine *engine, const char *uri) override
{
Q_UNUSED(uri);
engine->addImageProvider("colors", new ColorImageProvider);
diff --git a/examples/quick/imageresponseprovider/imageresponseprovider.cpp b/examples/quick/imageresponseprovider/imageresponseprovider.cpp
index 909a043ca5..4f7c12b1d8 100644
--- a/examples/quick/imageresponseprovider/imageresponseprovider.cpp
+++ b/examples/quick/imageresponseprovider/imageresponseprovider.cpp
@@ -66,12 +66,12 @@ class AsyncImageResponse : public QQuickImageResponse, public QRunnable
setAutoDelete(false);
}
- QQuickTextureFactory *textureFactory() const
+ QQuickTextureFactory *textureFactory() const override
{
return QQuickTextureFactory::textureFactoryForImage(m_image);
}
- void run()
+ void run() override
{
m_image = QImage(50, 50, QImage::Format_RGB32);
if (m_id == "slow") {
@@ -97,7 +97,7 @@ class AsyncImageResponse : public QQuickImageResponse, public QRunnable
class AsyncImageProvider : public QQuickAsyncImageProvider
{
public:
- QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize)
+ QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override
{
AsyncImageResponse *response = new AsyncImageResponse(id, requestedSize);
pool.start(response);
@@ -114,12 +114,12 @@ class ImageProviderExtensionPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- void registerTypes(const char *uri)
+ void registerTypes(const char *uri) override
{
Q_UNUSED(uri);
}
- void initializeEngine(QQmlEngine *engine, const char *uri)
+ void initializeEngine(QQmlEngine *engine, const char *uri) override
{
Q_UNUSED(uri);
engine->addImageProvider("async", new AsyncImageProvider);
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp
index 6c71b6184e..95ff2da2e0 100644
--- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp
+++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp
@@ -63,11 +63,11 @@ public:
// The lifetime of the FBO and this class depends on how QQuickWidget
// manages the scenegraph and context when it comes to showing and hiding
// the widget. The actual behavior is proven by the debug prints.
- ~FbRenderer() {
+ ~FbRenderer() override {
qDebug("FbRenderer destroyed");
}
- void render() {
+ void render() override {
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glClearColor(c, 0, 0, 1);
f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -77,7 +77,7 @@ public:
update();
}
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) {
+ QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override {
qDebug() << "Creating FBO" << size;
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp
index b9ce1afc38..cb7f1c8e7f 100644
--- a/examples/quick/scenegraph/graph/linenode.cpp
+++ b/examples/quick/scenegraph/graph/linenode.cpp
@@ -71,15 +71,15 @@ public:
setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/line.fsh");
}
- QList<QByteArray> attributes() const { return QList<QByteArray>() << "pos" << "t"; }
+ QList<QByteArray> attributes() const override { return QList<QByteArray>() << "pos" << "t"; }
- void updateState(const LineMaterial *m, const LineMaterial *) {
+ void updateState(const LineMaterial *m, const LineMaterial *) override {
program()->setUniformValue(id_color, m->color);
program()->setUniformValue(id_spread, m->spread);
program()->setUniformValue(id_size, m->size);
}
- void resolveUniforms() {
+ void resolveUniforms() override {
id_spread = program()->uniformLocation("spread");
id_size = program()->uniformLocation("size");
id_color = program()->uniformLocation("color");
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
index d1eaa1ec26..de5a616da2 100644
--- a/examples/quick/scenegraph/graph/noisynode.cpp
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -77,9 +77,9 @@ public:
setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/noisy.fsh");
}
- QList<QByteArray> attributes() const { return QList<QByteArray>() << "aVertex" << "aTexCoord"; }
+ QList<QByteArray> attributes() const override { return QList<QByteArray>() << "aVertex" << "aTexCoord"; }
- void updateState(const NoisyMaterial *m, const NoisyMaterial *) {
+ void updateState(const NoisyMaterial *m, const NoisyMaterial *) override {
// Set the color
program()->setUniformValue(id_color, m->color);
@@ -93,7 +93,7 @@ public:
program()->setUniformValue(id_textureSize, QSizeF(1.0 / s.width(), 1.0 / s.height()));
}
- void resolveUniforms() {
+ void resolveUniforms() override {
id_texture = program()->uniformLocation("texture");
id_textureSize = program()->uniformLocation("textureSize");
id_color = program()->uniformLocation("color");
diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.cpp b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
index 96c08aff04..6773b6fb5a 100644
--- a/examples/quick/scenegraph/simplematerial/simplematerial.cpp
+++ b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
@@ -87,7 +87,7 @@ class Shader : public QSGSimpleMaterialShader<State>
//! [2] //! [3]
public:
- const char *vertexShader() const {
+ const char *vertexShader() const override {
return
"attribute highp vec4 aVertex; \n"
"attribute highp vec2 aTexCoord; \n"
@@ -99,7 +99,7 @@ public:
"}";
}
- const char *fragmentShader() const {
+ const char *fragmentShader() const override {
return
"uniform lowp float qt_Opacity; \n"
"uniform lowp vec4 color; \n"
@@ -110,17 +110,17 @@ public:
"}";
}
//! [3] //! [4]
- QList<QByteArray> attributes() const
+ QList<QByteArray> attributes() const override
{
return QList<QByteArray>() << "aVertex" << "aTexCoord";
}
//! [4] //! [5]
- void updateState(const State *state, const State *)
+ void updateState(const State *state, const State *) override
{
program()->setUniformValue(id_color, state->color);
}
//! [5] //! [6]
- void resolveUniforms()
+ void resolveUniforms() override
{
id_color = program()->uniformLocation("color");
}
@@ -184,7 +184,7 @@ private:
//! [8] //! [9]
public:
- QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
+ QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override
{
ColorNode *n = static_cast<ColorNode *>(node);
if (!node)
diff --git a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp b/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp
index 0b9617b55f..8ba5bddb2a 100644
--- a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp
+++ b/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.cpp
@@ -64,12 +64,12 @@ public:
logo.initialize();
}
- void render() {
+ void render() override {
logo.render();
update();
}
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) {
+ QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override {
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setSamples(4);
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
index 27cb0eb5ea..c364d0b7dd 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
@@ -165,7 +165,7 @@ public:
setFiltering(QSGTexture::Linear);
}
- ~TextureNode()
+ ~TextureNode() override
{
delete m_texture;
}
diff --git a/examples/quick/scenegraph/threadedanimation/spinner.cpp b/examples/quick/scenegraph/threadedanimation/spinner.cpp
index 83c4494720..c19354b3f5 100644
--- a/examples/quick/scenegraph/threadedanimation/spinner.cpp
+++ b/examples/quick/scenegraph/threadedanimation/spinner.cpp
@@ -78,7 +78,7 @@ public:
appendChildNode(textureNode);
}
- ~SpinnerNode() {
+ ~SpinnerNode() override {
delete m_texture;
}
diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
index 3c02c4695e..8d7597addf 100644
--- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
+++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
@@ -77,7 +77,7 @@ class XorBlendShader : public QSGSimpleMaterialShader<XorBlendState>
QSG_DECLARE_SIMPLE_SHADER(XorBlendShader, XorBlendState)
public:
- const char *vertexShader() const {
+ const char *vertexShader() const override {
return
"attribute highp vec4 aVertex; \n"
"attribute highp vec2 aTexCoord; \n"
@@ -89,7 +89,7 @@ public:
"}";
}
- const char *fragmentShader() const {
+ const char *fragmentShader() const override {
return
"uniform lowp float qt_Opacity; \n"
"uniform lowp sampler2D uSource1; \n"
@@ -102,11 +102,11 @@ public:
"}";
}
- QList<QByteArray> attributes() const {
+ QList<QByteArray> attributes() const override {
return QList<QByteArray>() << "aVertex" << "aTexCoord";
}
- void updateState(const XorBlendState *state, const XorBlendState *) {
+ void updateState(const XorBlendState *state, const XorBlendState *) override {
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
// We bind the textures in inverse order so that we leave the updateState
// function with GL_TEXTURE0 as the active texture unit. This is maintain
@@ -118,7 +118,7 @@ public:
state->texture1->bind();
}
- void resolveUniforms() {
+ void resolveUniforms() override {
// The texture units never change, only the texturess we bind to them so
// we set these once and for all here.
program()->setUniformValue("uSource1", 0); // GL_TEXTURE0
@@ -165,7 +165,7 @@ public:
connect(m_provider2.data(), &QSGTextureProvider::textureChanged, this, &XorNode::textureChange, Qt::DirectConnection);
}
- void preprocess() {
+ void preprocess() override {
XorBlendState *state = m_material->state();
// Update the textures from the providers, calling into QSGDynamicTexture if required
if (m_provider1) {
diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp
index 01a3f69be3..65960169e2 100644
--- a/examples/quick/textureprovider/etcprovider.cpp
+++ b/examples/quick/textureprovider/etcprovider.cpp
@@ -166,10 +166,10 @@ public:
QSize m_size;
QSize m_paddedSize;
- QSize textureSize() const { return m_size; }
- int textureByteCount() const { return m_data.size(); }
+ QSize textureSize() const override { return m_size; }
+ int textureByteCount() const override { return m_data.size(); }
- QSGTexture *createTexture(QQuickWindow *) const {
+ QSGTexture *createTexture(QQuickWindow *) const override {
EtcTexture *texture = new EtcTexture;
texture->m_data = m_data;
texture->m_size = m_size;