diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-04 15:24:37 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-04 15:47:31 +0200 |
commit | be86ffcb985e34dcd802bac9ff17a8930b11f9c9 (patch) | |
tree | 833d30bc9904aee931f90700ca711c71af2d7826 /examples | |
parent | 0e128824e54a4994682023b7fd0fbb4c1938892c (diff) | |
download | qtactiveqt-be86ffcb985e34dcd802bac9ff17a8930b11f9c9.tar.gz |
Fix class structure and definitions
- Add override
- Use "= default" for trivial constructors/destructors
- Q_DISABLE_COPY_MOVE to delete move constructors and assignment
Change-Id: If773ad8c092ab8000b268c4231f7f27e5f484e56
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/activeqt/comapp/main.cpp | 4 | ||||
-rw-r--r-- | examples/activeqt/hierarchy/objects.h | 6 | ||||
-rw-r--r-- | examples/activeqt/multiple/ax1.h | 2 | ||||
-rw-r--r-- | examples/activeqt/multiple/ax2.h | 2 | ||||
-rw-r--r-- | examples/activeqt/opengl/glbox.cpp | 8 | ||||
-rw-r--r-- | examples/activeqt/opengl/glbox.h | 8 | ||||
-rw-r--r-- | examples/activeqt/wrapper/main.cpp | 12 |
7 files changed, 20 insertions, 22 deletions
diff --git a/examples/activeqt/comapp/main.cpp b/examples/activeqt/comapp/main.cpp index d341deb..74b7fa3 100644 --- a/examples/activeqt/comapp/main.cpp +++ b/examples/activeqt/comapp/main.cpp @@ -153,9 +153,7 @@ Document::Document(DocumentList *list) m_page->show(); } -Document::~Document() -{ -} +Document::~Document() = default; Application *Document::application() const { diff --git a/examples/activeqt/hierarchy/objects.h b/examples/activeqt/hierarchy/objects.h index 91f7e9d..cc9186e 100644 --- a/examples/activeqt/hierarchy/objects.h +++ b/examples/activeqt/hierarchy/objects.h @@ -68,7 +68,7 @@ class QParentWidget : public QWidget public: explicit QParentWidget(QWidget *parent = nullptr); - QSize sizeHint() const; + QSize sizeHint() const override; public slots: void createSubWidget(const QString &name); @@ -96,10 +96,10 @@ public: void setLabel(const QString &text); QString label() const; - QSize sizeHint() const; + QSize sizeHint() const override; protected: - void paintEvent(QPaintEvent *e); + void paintEvent(QPaintEvent *e) override; private: QString m_label; diff --git a/examples/activeqt/multiple/ax1.h b/examples/activeqt/multiple/ax1.h index ba2a7f5..0a8ccb6 100644 --- a/examples/activeqt/multiple/ax1.h +++ b/examples/activeqt/multiple/ax1.h @@ -81,7 +81,7 @@ public: } protected: - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { QPainter paint(this); QRect r = rect(); diff --git a/examples/activeqt/multiple/ax2.h b/examples/activeqt/multiple/ax2.h index 13e011b..9249f1a 100644 --- a/examples/activeqt/multiple/ax2.h +++ b/examples/activeqt/multiple/ax2.h @@ -81,7 +81,7 @@ public: } protected: - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { QPainter paint(this); QPen pen = paint.pen(); diff --git a/examples/activeqt/opengl/glbox.cpp b/examples/activeqt/opengl/glbox.cpp index e0796cc..6eef79d 100644 --- a/examples/activeqt/opengl/glbox.cpp +++ b/examples/activeqt/opengl/glbox.cpp @@ -225,9 +225,9 @@ class ObjectSafetyImpl : public QAxAggregated, { public: //! [1] //! [2] - explicit ObjectSafetyImpl() {} + explicit ObjectSafetyImpl() = default; - long queryInterface(const QUuid &iid, void **iface) + long queryInterface(const QUuid &iid, void **iface) override { *iface = nullptr; if (iid == IID_IObjectSafety) @@ -243,14 +243,14 @@ public: QAXAGG_IUNKNOWN; //! [3] //! [4] - HRESULT WINAPI GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) + HRESULT WINAPI GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) override { *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER; *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER; return S_OK; } - HRESULT WINAPI SetInterfaceSafetyOptions(REFIID riid, DWORD pdwSupportedOptions, DWORD pdwEnabledOptions) + HRESULT WINAPI SetInterfaceSafetyOptions(REFIID riid, DWORD pdwSupportedOptions, DWORD pdwEnabledOptions) override { return S_OK; } diff --git a/examples/activeqt/opengl/glbox.h b/examples/activeqt/opengl/glbox.h index 00be3b9..b1bd828 100644 --- a/examples/activeqt/opengl/glbox.h +++ b/examples/activeqt/opengl/glbox.h @@ -75,7 +75,7 @@ class GLBox : public QGLWidget, public: explicit GLBox(QWidget *parent, const char *name = nullptr); virtual ~GLBox(); - QAxAggregated *createAggregate(); + QAxAggregated *createAggregate() override; public slots: void setXRotation(int degrees); @@ -84,9 +84,9 @@ public slots: void setZRotation(int degrees); protected: - void initializeGL(); - void paintGL(); - void resizeGL(int w, int h); + void initializeGL() override; + void paintGL() override; + void resizeGL(int w, int h) override; virtual GLuint makeObject(); private: diff --git a/examples/activeqt/wrapper/main.cpp b/examples/activeqt/wrapper/main.cpp index 2683a41..3d8d0a1 100644 --- a/examples/activeqt/wrapper/main.cpp +++ b/examples/activeqt/wrapper/main.cpp @@ -64,12 +64,12 @@ public: : QAxFactory(lib, app) {} - QStringList featureList() const + QStringList featureList() const override { return m_activeElements.keys(); } - QObject *createObject(const QString &key) + QObject *createObject(const QString &key) override { auto it = m_activeElements.find(key); if (it != m_activeElements.end()) @@ -77,7 +77,7 @@ public: return nullptr; } - const QMetaObject *metaObject(const QString &key) const + const QMetaObject *metaObject(const QString &key) const override { auto it = m_activeElements.find(key); if (it != m_activeElements.end()) @@ -85,7 +85,7 @@ public: return nullptr; } - QUuid classID(const QString &key) const + QUuid classID(const QString &key) const override { auto it = m_activeElements.find(key); if (it != m_activeElements.end()) @@ -93,7 +93,7 @@ public: return QUuid(); } - QUuid interfaceID(const QString &key) const + QUuid interfaceID(const QString &key) const override { auto it = m_activeElements.find(key); if (it != m_activeElements.end()) @@ -101,7 +101,7 @@ public: return QUuid(); } - QUuid eventsID(const QString &key) const + QUuid eventsID(const QString &key) const override { auto it = m_activeElements.find(key); if (it != m_activeElements.end()) |