diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-31 07:41:19 +0200 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2018-07-31 11:02:34 +0200 |
commit | df156a56c08a56eb380711a507ef739d8150a71f (patch) | |
tree | 0d0da57857fff1ba844c84fbc5de2e6cd872cb1e /profile-widget | |
parent | 7fe76a5dbdef4a833122e0311191dd51896575f4 (diff) | |
download | subsurface-df156a56c08a56eb380711a507ef739d8150a71f.tar.gz |
Cleanup: replace virtual by override where appropriate
The keyword "virtual" signalizes that the function is virtual,
i.e. the function of the derived class is called, even if the
call is on the parent class.
It is not necessary to repeat the "virtual" keyword in derived
classes. To highlight derived virtual functions, the keyword
"override" should be used instead. It results in a hard compile-
error, if no function is overridden, thus avoiding subtle bugs.
Replace "virtual" by "override" where appropriate. Moreover,
replace Q_DECL_OVERRIDE by override, since we require reasonably
recent compilers anyway. Likewise, replace /* reimp */ by
"override" for consistency and compiler support.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/divecartesianaxis.h | 2 | ||||
-rw-r--r-- | profile-widget/diveeventitem.h | 2 | ||||
-rw-r--r-- | profile-widget/divepixmapitem.h | 2 | ||||
-rw-r--r-- | profile-widget/diveprofileitem.h | 53 | ||||
-rw-r--r-- | profile-widget/divetooltipitem.h | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 22 | ||||
-rw-r--r-- | profile-widget/ruleritem.h | 2 | ||||
-rw-r--r-- | profile-widget/tankitem.h | 2 |
8 files changed, 42 insertions, 45 deletions
diff --git a/profile-widget/divecartesianaxis.h b/profile-widget/divecartesianaxis.h index a53324e9d..2d65c5586 100644 --- a/profile-widget/divecartesianaxis.h +++ b/profile-widget/divecartesianaxis.h @@ -29,7 +29,7 @@ public: RightToLeft }; DiveCartesianAxis(ProfileWidget2 *widget); - virtual ~DiveCartesianAxis(); + ~DiveCartesianAxis(); void setPrintMode(bool mode); void setMinimum(double minimum); void setMaximum(double maximum); diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h index 867b89f31..a3535f8aa 100644 --- a/profile-widget/diveeventitem.h +++ b/profile-widget/diveeventitem.h @@ -12,7 +12,7 @@ class DiveEventItem : public DivePixmapItem { Q_OBJECT public: DiveEventItem(QGraphicsItem *parent = 0); - virtual ~DiveEventItem(); + ~DiveEventItem(); void setEvent(struct event *ev, struct gasmix *lastgasmix); struct event *getEvent(); void eventVisibilityChanged(const QString &eventName, bool visible); diff --git a/profile-widget/divepixmapitem.h b/profile-widget/divepixmapitem.h index f8b922981..cf5b86d7c 100644 --- a/profile-widget/divepixmapitem.h +++ b/profile-widget/divepixmapitem.h @@ -20,7 +20,7 @@ class CloseButtonItem : public DivePixmapItem { public: CloseButtonItem(QGraphicsItem *parent = 0); protected: - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; public slots: void hide(); void show(); diff --git a/profile-widget/diveprofileitem.h b/profile-widget/diveprofileitem.h index 4cf33d2be..d0b65dd72 100644 --- a/profile-widget/diveprofileitem.h +++ b/profile-widget/diveprofileitem.h @@ -42,9 +42,6 @@ public: void setHorizontalDataColumn(int column); void setVerticalDataColumn(int column); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0; - virtual void clear() - { - } public slots: virtual void settingsChanged(); @@ -75,10 +72,10 @@ class DiveProfileItem : public AbstractProfilePolygonItem { public: DiveProfileItem(); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; void settingsToggled(bool toggled); - virtual void settingsChanged(); + void settingsChanged() override; void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color); int maxCeiling(int row); @@ -92,8 +89,8 @@ class DiveMeanDepthItem : public AbstractProfilePolygonItem { Q_OBJECT public: DiveMeanDepthItem(); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; private: void createTextItem(); @@ -105,8 +102,8 @@ class DiveTemperatureItem : public AbstractProfilePolygonItem { Q_OBJECT public: DiveTemperatureItem(); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; private: void createTextItem(int seconds, int mkelvin); @@ -116,8 +113,8 @@ class DiveHeartrateItem : public AbstractProfilePolygonItem { Q_OBJECT public: DiveHeartrateItem(); - virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; private: void createTextItem(int seconds, int hr); @@ -128,8 +125,8 @@ class DivePercentageItem : public AbstractProfilePolygonItem { Q_OBJECT public: DivePercentageItem(int i); - virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; private: QString visibilityKey; @@ -142,8 +139,8 @@ class DiveAmbPressureItem : public AbstractProfilePolygonItem { Q_OBJECT public: DiveAmbPressureItem(); - virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; private: QString visibilityKey; @@ -153,8 +150,8 @@ class DiveGFLineItem : public AbstractProfilePolygonItem { Q_OBJECT public: DiveGFLineItem(); - virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; private: QString visibilityKey; @@ -164,8 +161,8 @@ class DiveGasPressureItem : public AbstractProfilePolygonItem { Q_OBJECT public: - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; private: void plotPressureValue(int mbar, int sec, QFlags<Qt::AlignmentFlag> align, double offset); @@ -178,9 +175,9 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem { public: DiveCalculatedCeiling(ProfileWidget2 *profileWidget); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - virtual void settingsChanged(); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; + void settingsChanged() override; public slots: @@ -198,8 +195,8 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem { public: DiveReportedCeiling(); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; }; class DiveCalculatedTissue : public DiveCalculatedCeiling { @@ -207,15 +204,15 @@ class DiveCalculatedTissue : public DiveCalculatedCeiling { public: DiveCalculatedTissue(ProfileWidget2 *profileWidget); void setVisible(bool visible); - virtual void settingsChanged(); + void settingsChanged() override; }; class PartialPressureGasItem : public AbstractProfilePolygonItem { Q_OBJECT public: PartialPressureGasItem(); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; void setThresholdSettingsKey(double *prefPointerMin, double *prefPointerMax); void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey); void setColors(const QColor &normalColor, const QColor &alertColor); diff --git a/profile-widget/divetooltipitem.h b/profile-widget/divetooltipitem.h index bdab4ed79..714782843 100644 --- a/profile-widget/divetooltipitem.h +++ b/profile-widget/divetooltipitem.h @@ -30,7 +30,7 @@ public: }; explicit ToolTipItem(QGraphicsItem *parent = 0); - virtual ~ToolTipItem(); + ~ToolTipItem(); void collapse(); void expand(); diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index bbad5b7cc..f9fbba3b3 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -84,7 +84,7 @@ public: double getFontPrintScale(); void setFontPrintScale(double scale); #ifndef SUBSURFACE_MOBILE - virtual bool eventFilter(QObject *, QEvent *) override; + bool eventFilter(QObject *, QEvent *) override; void clearHandlers(); #endif void recalcCeiling(); @@ -146,18 +146,18 @@ slots: // Necessary to call from QAction's signals. #endif protected: - void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *event) override; #ifndef SUBSURFACE_MOBILE - void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; - void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void contextMenuEvent(QContextMenuEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; #endif - void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; - void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent *event) override; + void dragEnterEvent(QDragEnterEvent *event) override; + void dragMoveEvent(QDragMoveEvent *event) override; private: /*methods*/ diff --git a/profile-widget/ruleritem.h b/profile-widget/ruleritem.h index 75ada45d5..3a6c59480 100644 --- a/profile-widget/ruleritem.h +++ b/profile-widget/ruleritem.h @@ -22,7 +22,7 @@ public: void recalculate(); protected: - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; private: struct plot_info pInfo; struct plot_data *entry; diff --git a/profile-widget/tankitem.h b/profile-widget/tankitem.h index 713bc92dc..8ccfcb5bb 100644 --- a/profile-widget/tankitem.h +++ b/profile-widget/tankitem.h @@ -22,7 +22,7 @@ public: signals: public slots: - virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); + void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); private: void createBar(qreal x, qreal w, struct gasmix *gas); |