From 177f040c6c79571eadaf51c3e4ad90ae7b023b0d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 23 Jul 2020 08:19:45 +0200 Subject: Fix build with mingw gcc 9 and -Wsuggest-override Change-Id: I780b0761a7f6b19022116b738efa7aca1378b715 Reviewed-by: Friedemann Kleint --- src/corelib/io/qfilesystemengine_win.cpp | 51 +++++++++------------- .../platforms/offscreen/qoffscreenintegration.cpp | 6 +-- src/plugins/platforms/windows/main.cpp | 2 +- src/plugins/platforms/windows/qwindowscombase.h | 6 +-- .../platforms/windows/qwindowsdialoghelpers.cpp | 23 ++++++---- src/plugins/platforms/windows/qwindowsdrag.cpp | 4 +- src/plugins/platforms/windows/qwindowsdrag.h | 10 +++-- .../platforms/windows/qwindowsdropdataobject.h | 4 +- .../platforms/windows/qwindowsintegration.h | 3 +- src/plugins/platforms/windows/qwindowsole.h | 30 ++++++------- src/printsupport/kernel/qprintengine_win_p.h | 30 ++++++------- src/widgets/dialogs/qwizard.cpp | 2 +- 12 files changed, 86 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 1c99f07400..b3d7ecfed8 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -413,11 +413,8 @@ public: {} virtual ~FileOperationProgressSink() {} - ULONG STDMETHODCALLTYPE AddRef() - { - return ++ref; - } - ULONG STDMETHODCALLTYPE Release() + ULONG STDMETHODCALLTYPE AddRef() override { return ++ref; } + ULONG STDMETHODCALLTYPE Release() override { if (--ref == 0) { delete this; @@ -425,7 +422,7 @@ public: } return ref; } - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) override { if (!ppvObject) return E_POINTER; @@ -446,31 +443,30 @@ public: return E_NOINTERFACE; } - HRESULT STDMETHODCALLTYPE StartOperations() - { return S_OK; } - HRESULT STDMETHODCALLTYPE FinishOperations(HRESULT) - { return S_OK; } - HRESULT STDMETHODCALLTYPE PreRenameItem(DWORD, IShellItem *, LPCWSTR) - { return S_OK; } - HRESULT STDMETHODCALLTYPE PostRenameItem(DWORD, IShellItem *, LPCWSTR, HRESULT, IShellItem *) + HRESULT STDMETHODCALLTYPE StartOperations() override { return S_OK; } + HRESULT STDMETHODCALLTYPE FinishOperations(HRESULT) override { return S_OK; } + HRESULT STDMETHODCALLTYPE PreRenameItem(DWORD, IShellItem *, LPCWSTR) override { return S_OK; } + HRESULT STDMETHODCALLTYPE PostRenameItem(DWORD, IShellItem *, LPCWSTR, HRESULT, + IShellItem *) override { return S_OK; } - HRESULT STDMETHODCALLTYPE PreMoveItem(DWORD, IShellItem *, IShellItem *, LPCWSTR) + HRESULT STDMETHODCALLTYPE PreMoveItem(DWORD, IShellItem *, IShellItem *, LPCWSTR) override { return S_OK; } HRESULT STDMETHODCALLTYPE PostMoveItem(DWORD, IShellItem *, IShellItem *, LPCWSTR, HRESULT, - IShellItem *) + IShellItem *) override { return S_OK; } - HRESULT STDMETHODCALLTYPE PreCopyItem(DWORD, IShellItem *, IShellItem *, LPCWSTR ) + HRESULT STDMETHODCALLTYPE PreCopyItem(DWORD, IShellItem *, IShellItem *, LPCWSTR) override { return S_OK; } HRESULT STDMETHODCALLTYPE PostCopyItem(DWORD, IShellItem *, IShellItem *, LPCWSTR, HRESULT, - IShellItem *) + IShellItem *) override { return S_OK; } - HRESULT STDMETHODCALLTYPE PreDeleteItem(DWORD dwFlags, IShellItem *) + HRESULT STDMETHODCALLTYPE PreDeleteItem(DWORD dwFlags, IShellItem *) override { // stop the operation if the file will be deleted rather than trashed return (dwFlags & TSF_DELETE_RECYCLE_IF_POSSIBLE) ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE PostDeleteItem(DWORD /* dwFlags */, IShellItem * /* psiItem */, - HRESULT /* hrDelete */, IShellItem *psiNewlyCreated) + HRESULT /* hrDelete */, + IShellItem *psiNewlyCreated) override { if (psiNewlyCreated) { wchar_t *pszName = nullptr; @@ -482,19 +478,14 @@ public: } return S_OK; } - HRESULT STDMETHODCALLTYPE PreNewItem(DWORD, IShellItem *, LPCWSTR) - { return S_OK; } + HRESULT STDMETHODCALLTYPE PreNewItem(DWORD, IShellItem *, LPCWSTR) override { return S_OK; } HRESULT STDMETHODCALLTYPE PostNewItem(DWORD, IShellItem *, LPCWSTR, LPCWSTR, DWORD, HRESULT, - IShellItem *) - { return S_OK; } - HRESULT STDMETHODCALLTYPE UpdateProgress(UINT,UINT) - { return S_OK; } - HRESULT STDMETHODCALLTYPE ResetTimer() - { return S_OK; } - HRESULT STDMETHODCALLTYPE PauseTimer() - { return S_OK; } - HRESULT STDMETHODCALLTYPE ResumeTimer() + IShellItem *) override { return S_OK; } + HRESULT STDMETHODCALLTYPE UpdateProgress(UINT, UINT) override { return S_OK; } + HRESULT STDMETHODCALLTYPE ResetTimer() override { return S_OK; } + HRESULT STDMETHODCALLTYPE PauseTimer() override { return S_OK; } + HRESULT STDMETHODCALLTYPE ResumeTimer() override { return S_OK; } QString targetPath; private: diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index ef0eb7e9cf..16020557eb 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -80,20 +80,20 @@ public: { } - bool processEvents(QEventLoop::ProcessEventsFlags flags) + bool processEvents(QEventLoop::ProcessEventsFlags flags) override { bool didSendEvents = BaseEventDispatcher::processEvents(flags); return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents; } - bool hasPendingEvents() + bool hasPendingEvents() override { return BaseEventDispatcher::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued(); } - void flush() + void flush() override { if (qApp) qApp->sendPostedEvents(); diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp index 94d8470ab1..a3f81ec9fc 100644 --- a/src/plugins/platforms/windows/main.cpp +++ b/src/plugins/platforms/windows/main.cpp @@ -101,7 +101,7 @@ class QWindowsIntegrationPlugin : public QPlatformIntegrationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "windows.json") public: - QPlatformIntegration *create(const QString&, const QStringList&, int &, char **); + QPlatformIntegration *create(const QString &, const QStringList &, int &, char **) override; }; QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList, int &, char **) diff --git a/src/plugins/platforms/windows/qwindowscombase.h b/src/plugins/platforms/windows/qwindowscombase.h index bb4b295395..9f6f11170f 100644 --- a/src/plugins/platforms/windows/qwindowscombase.h +++ b/src/plugins/platforms/windows/qwindowscombase.h @@ -85,16 +85,16 @@ public: explicit QWindowsComBase(ULONG initialRefCount = 1) : m_ref(initialRefCount) {} virtual ~QWindowsComBase() = default; - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) override { *iface = nullptr; return qWindowsComQueryInterface(this, id, iface) || qWindowsComQueryInterface(this, id, iface) ? S_OK : E_NOINTERFACE; } - ULONG STDMETHODCALLTYPE AddRef() { return ++m_ref; } + ULONG STDMETHODCALLTYPE AddRef() override { return ++m_ref; } - ULONG STDMETHODCALLTYPE Release() + ULONG STDMETHODCALLTYPE Release() override { if (!--m_ref) { delete this; diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 16a9110918..51b7b6d175 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -273,7 +273,7 @@ public: explicit QWindowsDialogThread(const QWindowsNativeDialogBasePtr &d, HWND owner) : m_dialog(d), m_owner(owner) {} - void run(); + void run() override; private: const QWindowsNativeDialogBasePtr m_dialog; @@ -508,14 +508,21 @@ public: static IFileDialogEvents *create(QWindowsNativeFileDialogBase *nativeFileDialog); // IFileDialogEvents methods - IFACEMETHODIMP OnFileOk(IFileDialog *); - IFACEMETHODIMP OnFolderChange(IFileDialog *) { return S_OK; } - IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *); + IFACEMETHODIMP OnFileOk(IFileDialog *) override; + IFACEMETHODIMP OnFolderChange(IFileDialog *) override { return S_OK; } + IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *) override; IFACEMETHODIMP OnHelp(IFileDialog *) { return S_OK; } - IFACEMETHODIMP OnSelectionChange(IFileDialog *); - IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, FDE_SHAREVIOLATION_RESPONSE *) { return S_OK; } - IFACEMETHODIMP OnTypeChange(IFileDialog *); - IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; } + IFACEMETHODIMP OnSelectionChange(IFileDialog *) override; + IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, + FDE_SHAREVIOLATION_RESPONSE *) override + { + return S_OK; + } + IFACEMETHODIMP OnTypeChange(IFileDialog *) override; + IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) override + { + return S_OK; + } QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) : m_nativeFileDialog(nativeFileDialog) {} diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index bb1e1345dc..1c27e4e85b 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -231,8 +231,8 @@ public: void createCursors(); // IDropSource methods - STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState); - STDMETHOD(GiveFeedback)(DWORD dwEffect); + STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState) override; + STDMETHOD(GiveFeedback)(DWORD dwEffect) override; private: struct CursorEntry { diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h index 5f30c59882..33b583b479 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.h +++ b/src/plugins/platforms/windows/qwindowsdrag.h @@ -66,10 +66,12 @@ public: ~QWindowsOleDropTarget() override; // IDropTarget methods - STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragLeave)(); - STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + STDMETHOD(DragEnter) + (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override; + STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override; + STDMETHOD(DragLeave)() override; + STDMETHOD(Drop) + (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override; private: void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect); diff --git a/src/plugins/platforms/windows/qwindowsdropdataobject.h b/src/plugins/platforms/windows/qwindowsdropdataobject.h index 16ba7b036a..407c809243 100644 --- a/src/plugins/platforms/windows/qwindowsdropdataobject.h +++ b/src/plugins/platforms/windows/qwindowsdropdataobject.h @@ -51,8 +51,8 @@ public: ~QWindowsDropDataObject() override; // overridden IDataObject methods - STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium); - STDMETHOD(QueryGetData)(LPFORMATETC pformatetc); + STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override; + STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override; private: bool shouldIgnore(LPFORMATETC pformatetc) const; diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index eaf62c750d..e0af1e6512 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -95,7 +95,8 @@ public: static QWindowsStaticOpenGLContext *staticOpenGLContext(); HMODULE openGLModuleHandle() const override; - QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const; + QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, + QOpenGLContext *shareContext) const override; #endif QAbstractEventDispatcher *createEventDispatcher() const override; void initialize() override; diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h index 759779c6c3..c556a3fb9c 100644 --- a/src/plugins/platforms/windows/qwindowsole.h +++ b/src/plugins/platforms/windows/qwindowsole.h @@ -65,17 +65,17 @@ public: DWORD reportedPerformedEffect() const; // IDataObject methods - STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium); - STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium); - STDMETHOD(QueryGetData)(LPFORMATETC pformatetc); - STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut); - STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, - BOOL fRelease); - STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc); - STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf, - LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); - STDMETHOD(DUnadvise)(DWORD dwConnection); - STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); + STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override; + STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium) override; + STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override; + STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut) override; + STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease) override; + STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc) override; + STDMETHOD(DAdvise) + (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink, + DWORD FAR *pdwConnection) override; + STDMETHOD(DUnadvise)(DWORD dwConnection) override; + STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR *ppenumAdvise) override; private: QPointer data; @@ -93,10 +93,10 @@ public: bool isNull() const; // IEnumFORMATETC methods - STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched); - STDMETHOD(Skip)(ULONG celt); - STDMETHOD(Reset)(void); - STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum); + STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR *pceltFetched) override; + STDMETHOD(Skip)(ULONG celt) override; + STDMETHOD(Reset)(void) override; + STDMETHOD(Clone)(LPENUMFORMATETC FAR *newEnum) override; private: bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const; diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index 876155a3a5..878de9a7ac 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -76,30 +76,30 @@ public: QWin32PrintEngine(QPrinter::PrinterMode mode, const QString &deviceId); // override QWin32PaintEngine - bool begin(QPaintDevice *dev); - bool end(); + bool begin(QPaintDevice *dev) override; + bool end() override; - void updateState(const QPaintEngineState &state); + void updateState(const QPaintEngineState &state) override; void updateMatrix(const QTransform &matrix); void updateClipPath(const QPainterPath &clip, Qt::ClipOperation op); - void drawPath(const QPainterPath &path); - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawTextItem(const QPointF &p, const QTextItem &textItem); + void drawPath(const QPainterPath &path) override; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p); - void setProperty(PrintEnginePropertyKey key, const QVariant &value); - QVariant property(PrintEnginePropertyKey key) const; + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p) override; + void setProperty(PrintEnginePropertyKey key, const QVariant &value) override; + QVariant property(PrintEnginePropertyKey key) const override; - bool newPage(); - bool abort(); - int metric(QPaintDevice::PaintDeviceMetric) const; + bool newPage() override; + bool abort() override; + int metric(QPaintDevice::PaintDeviceMetric) const override; - QPrinter::PrinterState printerState() const; + QPrinter::PrinterState printerState() const override; - QPaintEngine::Type type() const { return Windows; } + QPaintEngine::Type type() const override { return Windows; } HDC getDC() const; void releaseDC(HDC) const; diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 24d996dad4..2a8c87379a 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -529,7 +529,7 @@ public: : QWidget(wizard) , wizardPrivate(wizardPrivate) {} protected: - void paintEvent(QPaintEvent *); + void paintEvent(QPaintEvent *) override; #else QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *) : QWidget(wizard) -- cgit v1.2.3