From 640467aa494a3b678557e28ba58e933fe840dac4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 3 Aug 2023 17:23:14 +0200 Subject: [PATCH] Gui: modernize C++: use override --- src/Gui/Quarter/ContextMenu.h | 2 +- src/Gui/Quarter/InteractionMode.h | 4 ++-- src/Gui/Quarter/NativeEvent.h | 2 +- src/Gui/Quarter/QuarterWidget.cpp | 10 +++++----- src/Gui/Quarter/QuarterWidget.h | 10 +++++----- src/Gui/Quarter/SensorManager.h | 2 +- src/Gui/Quarter/SignalThread.h | 4 ++-- src/Gui/Quarter/SoQTQuarterAdaptor.h | 8 ++++---- src/Gui/Quarter/devices/Keyboard.h | 4 ++-- src/Gui/Quarter/devices/Mouse.h | 4 ++-- src/Gui/Quarter/devices/SpaceNavigatorDevice.h | 4 ++-- src/Gui/Quarter/eventhandlers/DragDropHandler.h | 4 ++-- src/Gui/Quarter/eventhandlers/EventFilter.h | 4 ++-- src/Gui/Quarter/eventhandlers/FocusHandler.h | 4 ++-- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Gui/Quarter/ContextMenu.h b/src/Gui/Quarter/ContextMenu.h index 13603e194d..8638684297 100644 --- a/src/Gui/Quarter/ContextMenu.h +++ b/src/Gui/Quarter/ContextMenu.h @@ -46,7 +46,7 @@ class ContextMenu : public QObject { Q_OBJECT public: ContextMenu(QuarterWidget * quarterwidget); - ~ContextMenu(); + ~ContextMenu() override; QMenu * getMenu() const; diff --git a/src/Gui/Quarter/InteractionMode.h b/src/Gui/Quarter/InteractionMode.h index 0f03f10432..d0444d9a33 100644 --- a/src/Gui/Quarter/InteractionMode.h +++ b/src/Gui/Quarter/InteractionMode.h @@ -53,7 +53,7 @@ class QUARTER_DLL_API InteractionMode : public QObject { Q_OBJECT public: InteractionMode(QuarterWidget * quarterwidget); - virtual ~InteractionMode(); + ~InteractionMode() override; void setEnabled(bool yes); bool enabled() const; @@ -62,7 +62,7 @@ public: bool on() const; protected: - virtual bool eventFilter(QObject *, QEvent * event); + bool eventFilter(QObject *, QEvent * event) override; private: bool keyPressEvent(QKeyEvent * event); diff --git a/src/Gui/Quarter/NativeEvent.h b/src/Gui/Quarter/NativeEvent.h index 92e59bb03e..165b8c965a 100644 --- a/src/Gui/Quarter/NativeEvent.h +++ b/src/Gui/Quarter/NativeEvent.h @@ -50,7 +50,7 @@ public: NativeEvent(); #endif // !HAVE_SPACENAV_LIB - virtual ~NativeEvent(); + ~NativeEvent() override; private: void * rawevent; diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index 26e12dce72..bf97ad6e59 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -164,10 +164,10 @@ public: #endif setFormat(surfaceFormat); } - ~CustomGLWidget() + ~CustomGLWidget() override { } - void initializeGL() + void initializeGL() override { QOpenGLContext *context = QOpenGLContext::currentContext(); #if defined (_DEBUG) && 0 @@ -193,7 +193,7 @@ public: // gl = mdi.findChild(QtWidgets.QOpenGLWidget) // img = gl.grabFramebuffer() // \endcode - void paintGL() + void paintGL() override { QuarterWidget* qw = qobject_cast(parentWidget()); if (qw) { @@ -211,7 +211,7 @@ public: Qt::DirectConnection, QGenericReturnArgument()); } - bool event(QEvent *e) + bool event(QEvent *e) override { // If a debug logger is activated then Qt's default implementation // first releases the context before stopping the logger. However, @@ -233,7 +233,7 @@ public: { qDebug() << message; } - void showEvent(QShowEvent*) + void showEvent(QShowEvent*) override { update(); // force update when changing window mode } diff --git a/src/Gui/Quarter/QuarterWidget.h b/src/Gui/Quarter/QuarterWidget.h index f1d7f586cc..5b50cac0cf 100644 --- a/src/Gui/Quarter/QuarterWidget.h +++ b/src/Gui/Quarter/QuarterWidget.h @@ -117,7 +117,7 @@ public: explicit QuarterWidget(QWidget * parent = nullptr, const QtGLWidget * sharewidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); explicit QuarterWidget(QtGLContext * context, QWidget * parent = nullptr, const QtGLWidget * sharewidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); explicit QuarterWidget(const QtGLFormat & format, QWidget * parent = nullptr, const QtGLWidget * shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); - virtual ~QuarterWidget(); + ~QuarterWidget() override; TransparencyType transparencyType() const; RenderMode renderMode() const; @@ -172,7 +172,7 @@ public: void removeStateMachine(SoScXMLStateMachine * statemachine); virtual bool processSoEvent(const SoEvent * event); - virtual QSize minimumSizeHint() const; + QSize minimumSizeHint() const override; QList transparencyTypeActions() const; QList stereoModeActions() const; @@ -196,9 +196,9 @@ private Q_SLOTS: virtual void aboutToDestroyGLContext(); protected: - virtual void paintEvent(QPaintEvent*); - virtual void resizeEvent(QResizeEvent*); - virtual bool viewportEvent(QEvent* event); + void paintEvent(QPaintEvent*) override; + void resizeEvent(QResizeEvent*) override; + bool viewportEvent(QEvent* event) override; virtual void actualRedraw(); virtual bool updateDevicePixelRatio(); diff --git a/src/Gui/Quarter/SensorManager.h b/src/Gui/Quarter/SensorManager.h index 4b8043b3a8..8ab8f422e8 100644 --- a/src/Gui/Quarter/SensorManager.h +++ b/src/Gui/Quarter/SensorManager.h @@ -46,7 +46,7 @@ class SensorManager : public QObject { typedef QObject inherited; public: SensorManager(); - ~SensorManager(); + ~SensorManager() override; public Q_SLOTS: void idleTimeout(); diff --git a/src/Gui/Quarter/SignalThread.h b/src/Gui/Quarter/SignalThread.h index 2b350c7719..f96f2245ae 100644 --- a/src/Gui/Quarter/SignalThread.h +++ b/src/Gui/Quarter/SignalThread.h @@ -46,9 +46,9 @@ class SignalThread : public QThread { Q_OBJECT public: SignalThread(); - virtual ~SignalThread(); + ~SignalThread() override; - virtual void run(); + void run() override; void trigger(); void stopThread(); diff --git a/src/Gui/Quarter/SoQTQuarterAdaptor.h b/src/Gui/Quarter/SoQTQuarterAdaptor.h index d3bcb90a29..d5e883fe80 100644 --- a/src/Gui/Quarter/SoQTQuarterAdaptor.h +++ b/src/Gui/Quarter/SoQTQuarterAdaptor.h @@ -50,7 +50,7 @@ public: explicit SoQTQuarterAdaptor(QWidget* parent = nullptr, const QtGLWidget* sharewidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); explicit SoQTQuarterAdaptor(const QtGLFormat& format, QWidget* parent = nullptr, const QtGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); explicit SoQTQuarterAdaptor(QtGLContext* context, QWidget* parent = nullptr, const QtGLWidget* sharewidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); - virtual ~SoQTQuarterAdaptor(); + ~SoQTQuarterAdaptor() override; //the functions available in soqtviewer but missing in quarter QWidget* getWidget(); @@ -93,12 +93,12 @@ public: virtual void resetToHomePosition(); virtual bool hasHomePosition() const {return m_storedcamera;} - virtual void setSceneGraph(SoNode* root) { + void setSceneGraph(SoNode* root) override { QuarterWidget::setSceneGraph(root); } - virtual bool processSoEvent(const SoEvent* event); - virtual void paintEvent(QPaintEvent*); + bool processSoEvent(const SoEvent* event) override; + void paintEvent(QPaintEvent*) override; //this functions still need to be ported virtual void afterRealizeHook() {} //enables spacenav and joystick in soqt, dunno if this is needed diff --git a/src/Gui/Quarter/devices/Keyboard.h b/src/Gui/Quarter/devices/Keyboard.h index 2299adf3d9..d63cf30aa8 100644 --- a/src/Gui/Quarter/devices/Keyboard.h +++ b/src/Gui/Quarter/devices/Keyboard.h @@ -45,9 +45,9 @@ class QUARTER_DLL_API Keyboard : public InputDevice { public: Keyboard(QuarterWidget* quarter); Keyboard(); - virtual ~Keyboard(); + ~Keyboard() override; - virtual const SoEvent * translateEvent(QEvent * event); + const SoEvent * translateEvent(QEvent * event) override; private: friend class KeyboardP; diff --git a/src/Gui/Quarter/devices/Mouse.h b/src/Gui/Quarter/devices/Mouse.h index 6ac878063d..988a06ec8c 100644 --- a/src/Gui/Quarter/devices/Mouse.h +++ b/src/Gui/Quarter/devices/Mouse.h @@ -45,9 +45,9 @@ class QUARTER_DLL_API Mouse : public InputDevice { public: Mouse(QuarterWidget* quarter); Mouse(); - virtual ~Mouse(); + ~Mouse() override; - virtual const SoEvent * translateEvent(QEvent * event); + const SoEvent * translateEvent(QEvent * event) override; private: friend class MouseP; diff --git a/src/Gui/Quarter/devices/SpaceNavigatorDevice.h b/src/Gui/Quarter/devices/SpaceNavigatorDevice.h index c8f6e8a5b3..f9e99fba61 100644 --- a/src/Gui/Quarter/devices/SpaceNavigatorDevice.h +++ b/src/Gui/Quarter/devices/SpaceNavigatorDevice.h @@ -44,8 +44,8 @@ class QUARTER_DLL_API SpaceNavigatorDevice : public InputDevice { public: SpaceNavigatorDevice(QuarterWidget* quarter); SpaceNavigatorDevice(); - virtual ~SpaceNavigatorDevice(); - virtual const SoEvent * translateEvent(QEvent * event); + ~SpaceNavigatorDevice() override; + const SoEvent * translateEvent(QEvent * event) override; private: class SpaceNavigatorDeviceP * pimpl; diff --git a/src/Gui/Quarter/eventhandlers/DragDropHandler.h b/src/Gui/Quarter/eventhandlers/DragDropHandler.h index 83d439c261..5f194f6d27 100644 --- a/src/Gui/Quarter/eventhandlers/DragDropHandler.h +++ b/src/Gui/Quarter/eventhandlers/DragDropHandler.h @@ -47,10 +47,10 @@ class QUARTER_DLL_API DragDropHandler : public QObject { Q_OBJECT public: DragDropHandler(QuarterWidget * parent); - virtual ~DragDropHandler(); + ~DragDropHandler() override; protected: - virtual bool eventFilter(QObject *, QEvent * event); + bool eventFilter(QObject *, QEvent * event) override; private: friend class DragDropHandlerP; diff --git a/src/Gui/Quarter/eventhandlers/EventFilter.h b/src/Gui/Quarter/eventhandlers/EventFilter.h index 5f4f95bd1b..5fa746f6e9 100644 --- a/src/Gui/Quarter/eventhandlers/EventFilter.h +++ b/src/Gui/Quarter/eventhandlers/EventFilter.h @@ -48,7 +48,7 @@ class QUARTER_DLL_API EventFilter : public QObject { public: EventFilter(QObject * parent); - ~EventFilter(); + ~EventFilter() override; void registerInputDevice(InputDevice * device); void unregisterInputDevice(InputDevice * device); @@ -56,7 +56,7 @@ public: const QPoint & globalMousePosition() const; protected: - bool eventFilter(QObject * obj, QEvent * event); + bool eventFilter(QObject * obj, QEvent * event) override; private: class EventFilterP * pimpl; diff --git a/src/Gui/Quarter/eventhandlers/FocusHandler.h b/src/Gui/Quarter/eventhandlers/FocusHandler.h index 20edca610c..4c5200cc2c 100644 --- a/src/Gui/Quarter/eventhandlers/FocusHandler.h +++ b/src/Gui/Quarter/eventhandlers/FocusHandler.h @@ -46,10 +46,10 @@ class FocusHandler : public QObject { Q_OBJECT public: FocusHandler(QObject * parent); - virtual ~FocusHandler(); + ~FocusHandler() override; protected: - virtual bool eventFilter(QObject *, QEvent * event); + bool eventFilter(QObject *, QEvent * event) override; private: void focusEvent(const SbName & focusevent);