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 | |
parent | 0e128824e54a4994682023b7fd0fbb4c1938892c (diff) |
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>
-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 | ||||
-rw-r--r-- | src/activeqt/container/qaxbase.cpp | 6 | ||||
-rw-r--r-- | src/activeqt/container/qaxscript.cpp | 2 | ||||
-rw-r--r-- | src/activeqt/container/qaxwidget.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/control/qaxaggregated.h | 2 | ||||
-rw-r--r-- | src/activeqt/control/qaxbindable.h | 2 | ||||
-rw-r--r-- | src/activeqt/control/qaxfactory.h | 2 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverbase.cpp | 6 | ||||
-rw-r--r-- | src/activeqt/control/qclassfactory_p.h | 2 | ||||
-rw-r--r-- | tools/dumpcpp/main.cpp | 2 |
16 files changed, 34 insertions, 36 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()) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 526a272..909d0d4 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -257,7 +257,7 @@ static const char *const type_conversion[][2] = class QAxEventSink : public IDispatch, public IPropertyNotifySink { - Q_DISABLE_COPY(QAxEventSink) + Q_DISABLE_COPY_MOVE(QAxEventSink) public: explicit QAxEventSink(QAxBase *com) : combase(com) {} virtual ~QAxEventSink() @@ -587,7 +587,7 @@ public: class QAxBasePrivate { - Q_DISABLE_COPY(QAxBasePrivate) + Q_DISABLE_COPY_MOVE(QAxBasePrivate) public: using UuidEventSinkHash = QHash<QUuid, QAxEventSink*>; @@ -4293,7 +4293,7 @@ QAxObject *QAxBase::querySubObject(const char *name, QList<QVariant> &vars) class QtPropertyBag : public IPropertyBag { - Q_DISABLE_COPY(QtPropertyBag) + Q_DISABLE_COPY_MOVE(QtPropertyBag) public: QtPropertyBag() = default; virtual ~QtPropertyBag() = default; diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index 5ae6c89..5179204 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -97,7 +97,7 @@ public: class QAxScriptSite : public IActiveScriptSite, public IActiveScriptSiteWindow { - Q_DISABLE_COPY(QAxScriptSite) + Q_DISABLE_COPY_MOVE(QAxScriptSite) public: QAxScriptSite(QAxScript *script); virtual ~QAxScriptSite() = default; diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 7e5a91b..31882b1 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -115,7 +115,7 @@ QT_BEGIN_NAMESPACE */ class QAxHostWidget : public QWidget { - Q_DISABLE_COPY(QAxHostWidget) + Q_DISABLE_COPY_MOVE(QAxHostWidget) friend class QAxClientSite; public: Q_OBJECT_CHECK @@ -178,7 +178,7 @@ class QAxClientSite : public IDispatch, public IOleDocumentSite, public IAdviseSink { - Q_DISABLE_COPY(QAxClientSite) + Q_DISABLE_COPY_MOVE(QAxClientSite) friend class QAxHostWidget; public: QAxClientSite(QAxWidget *c); diff --git a/src/activeqt/control/qaxaggregated.h b/src/activeqt/control/qaxaggregated.h index 61d1f7f..01938be 100644 --- a/src/activeqt/control/qaxaggregated.h +++ b/src/activeqt/control/qaxaggregated.h @@ -65,7 +65,7 @@ class QAxAggregated { friend class QAxServerBase; friend class QAxClientSite; - Q_DISABLE_COPY(QAxAggregated) + Q_DISABLE_COPY_MOVE(QAxAggregated) public: virtual long queryInterface(const QUuid &iid, void **iface) = 0; diff --git a/src/activeqt/control/qaxbindable.h b/src/activeqt/control/qaxbindable.h index d895d1a..5bbc463 100644 --- a/src/activeqt/control/qaxbindable.h +++ b/src/activeqt/control/qaxbindable.h @@ -63,7 +63,7 @@ struct IAxServerBase; class QAxBindable { - Q_DISABLE_COPY(QAxBindable) + Q_DISABLE_COPY_MOVE(QAxBindable) friend class QAxServerBase; public: QAxBindable(); diff --git a/src/activeqt/control/qaxfactory.h b/src/activeqt/control/qaxfactory.h index 05df3c9..d11685a 100644 --- a/src/activeqt/control/qaxfactory.h +++ b/src/activeqt/control/qaxfactory.h @@ -74,7 +74,7 @@ class QSettings; class QAxFactory : public QObject { - Q_DISABLE_COPY(QAxFactory) + Q_DISABLE_COPY_MOVE(QAxFactory) public: QAxFactory(const QUuid &libId, const QUuid &appId); ~QAxFactory() override; diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index ab73bb5..9c3786b 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -446,7 +446,7 @@ static inline QAxServerBase *axServerBaseFromWindow(HWND hWnd) class QAxServerAggregate : public IUnknown { - Q_DISABLE_COPY(QAxServerAggregate) + Q_DISABLE_COPY_MOVE(QAxServerAggregate) public: QAxServerAggregate(const QString &className, IUnknown *outerUnknown) { @@ -547,11 +547,11 @@ public: DeleteCriticalSection(&refCountSection); } - unsigned long __stdcall AddRef() + unsigned long __stdcall AddRef() override { return InterlockedIncrement(&ref); } - unsigned long __stdcall Release() + unsigned long __stdcall Release() override { LONG refCount = InterlockedDecrement(&ref); if (!refCount) diff --git a/src/activeqt/control/qclassfactory_p.h b/src/activeqt/control/qclassfactory_p.h index b74123f..7133dfc 100644 --- a/src/activeqt/control/qclassfactory_p.h +++ b/src/activeqt/control/qclassfactory_p.h @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE // One instance of this class for each ActiveX the server can provide. class QClassFactory : public IClassFactory2 { - Q_DISABLE_COPY(QClassFactory) + Q_DISABLE_COPY_MOVE(QClassFactory) public: QClassFactory(CLSID clsid); diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp index 534e3ee..d801dc3 100644 --- a/tools/dumpcpp/main.cpp +++ b/tools/dumpcpp/main.cpp @@ -1220,7 +1220,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, // class to make related error messages clearer const QByteArray className = classNameFromTypeInfo(typeinfo); declOut << "// stub for vtable-only interface\n" - << "class " << className << " : public QAxObject { Q_DISABLE_COPY(" + << "class " << className << " : public QAxObject { Q_DISABLE_COPY_MOVE(" << className << ") };\n\n"; } break; |