Skip to content

Commit

Permalink
Add missing override keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Feb 23, 2017
1 parent 2be6694 commit 8ee47c4
Show file tree
Hide file tree
Showing 55 changed files with 364 additions and 352 deletions.
54 changes: 30 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,44 +69,50 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif()

if (PEDANTIC)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall")
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall \
-Wsuggest-override \
")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything \
-Winconsistent-missing-override \
")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-Wno-c++98-compat \
-Wno-c++98-compat-pedantic \
-Wno-shadow-field-in-constructor \
-Wno-weak-vtables \
-Wno-disabled-macro-expansion \
-fcomment-block-commands=retval \
")

# TODO: Fix these.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
-Wno-global-constructors \
-Wno-exit-time-destructors \
")

# Disable errors from moc-generated files.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
-Wno-undefined-reinterpret-cast \
-Wno-missing-prototypes \
")
endif()

set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -pedantic -Werror \
-Wno-c++98-compat \
-Wno-c++98-compat-pedantic \
-Wno-padded \
-Wno-shadow-field-in-constructor \
-Wno-switch-enum \
-Wno-weak-vtables \
-Wno-disabled-macro-expansion \
-fcomment-block-commands=retval \
\
")

# TODO: Fix these.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
-Wno-global-constructors \
-Wno-exit-time-destructors \
")

# Disable Q_OBJECT macro warnings.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
-Wno-unused-member-function \
")

# Disable errors from moc-generated files.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
-Wno-undefined-reinterpret-cast \
-Wno-missing-prototypes \
")
endif()

if(WITH_TESTS)
Expand Down
34 changes: 17 additions & 17 deletions plugins/itemdata/itemdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class ItemData : public QLabel, public ItemWidget
ItemData(const QModelIndex &index, int maxBytes, QWidget *parent);

protected:
virtual void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette);
void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette) override;

virtual QWidget *createEditor(QWidget *) const { return nullptr; }
QWidget *createEditor(QWidget *) const override { return nullptr; }

virtual void mousePressEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e) override;

virtual void mouseDoubleClickEvent(QMouseEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e) override;

virtual void contextMenuEvent(QContextMenuEvent *e);
void contextMenuEvent(QContextMenuEvent *e) override;
};

class ItemDataLoader : public QObject, public ItemLoaderInterface
Expand All @@ -63,23 +63,23 @@ class ItemDataLoader : public QObject, public ItemLoaderInterface
ItemDataLoader();
~ItemDataLoader();

virtual ItemWidget *create(const QModelIndex &index, QWidget *parent, bool preview) const;
ItemWidget *create(const QModelIndex &index, QWidget *parent, bool preview) const override;

virtual int priority() const { return -20; }
int priority() const override { return -20; }

virtual QString id() const { return "itemdata"; }
virtual QString name() const { return tr("Data"); }
virtual QString author() const { return QString(); }
virtual QString description() const { return tr("Various data to save."); }
virtual QVariant icon() const { return QVariant(IconFileText); }
QString id() const override { return "itemdata"; }
QString name() const override { return tr("Data"); }
QString author() const override { return QString(); }
QString description() const override { return tr("Various data to save."); }
QVariant icon() const override { return QVariant(IconFileText); }

virtual QStringList formatsToSave() const;
QStringList formatsToSave() const override;

virtual QVariantMap applySettings();
QVariantMap applySettings() override;

virtual void loadSettings(const QVariantMap &settings) { m_settings = settings; }
void loadSettings(const QVariantMap &settings) override { m_settings = settings; }

virtual QWidget *createSettingsWidget(QWidget *parent);
QWidget *createSettingsWidget(QWidget *parent) override;

private slots:
void on_treeWidgetFormats_itemActivated(QTreeWidgetItem *item, int column);
Expand Down
44 changes: 22 additions & 22 deletions plugins/itemencrypted/itemencrypted.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class ItemEncrypted : public QWidget, public ItemWidget
public:
ItemEncrypted(QWidget *parent);

virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;

virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;

void setTagged(bool tagged);
void setTagged(bool tagged) override;
};

class ItemEncryptedLoader : public QObject, public ItemLoaderInterface
Expand All @@ -60,37 +60,37 @@ class ItemEncryptedLoader : public QObject, public ItemLoaderInterface

~ItemEncryptedLoader();

virtual ItemWidget *create(const QModelIndex &index, QWidget *parent, bool) const;
ItemWidget *create(const QModelIndex &index, QWidget *parent, bool) const override;

virtual QString id() const { return "itemencrypted"; }
virtual QString name() const { return tr("Encryption"); }
virtual QString author() const { return QString(); }
virtual QString description() const { return tr("Encrypt items and tabs."); }
virtual QVariant icon() const { return QVariant(IconLock); }
QString id() const override { return "itemencrypted"; }
QString name() const override { return tr("Encryption"); }
QString author() const override { return QString(); }
QString description() const override { return tr("Encrypt items and tabs."); }
QVariant icon() const override { return QVariant(IconLock); }

virtual QStringList formatsToSave() const;
QStringList formatsToSave() const override;

virtual QVariantMap applySettings();
QVariantMap applySettings() override;

virtual void loadSettings(const QVariantMap &settings) { m_settings = settings; }
void loadSettings(const QVariantMap &settings) override { m_settings = settings; }

virtual QWidget *createSettingsWidget(QWidget *parent);
QWidget *createSettingsWidget(QWidget *parent) override;

virtual bool canLoadItems(QIODevice *file) const;
bool canLoadItems(QIODevice *file) const override;

virtual bool canSaveItems(const QAbstractItemModel &model) const;
bool canSaveItems(const QAbstractItemModel &model) const override;

virtual bool loadItems(QAbstractItemModel *model, QIODevice *file);
bool loadItems(QAbstractItemModel *model, QIODevice *file) override;

virtual bool saveItems(const QAbstractItemModel &model, QIODevice *file);
bool saveItems(const QAbstractItemModel &model, QIODevice *file) override;

virtual bool initializeTab(QAbstractItemModel *model);
bool initializeTab(QAbstractItemModel *model) override;

virtual const QObject *signaler() const { return this; }
const QObject *signaler() const override { return this; }

virtual QString script() const;
QString script() const override;

virtual QList<Command> commands() const;
QList<Command> commands() const override;

signals:
void error(const QString &);
Expand Down
8 changes: 7 additions & 1 deletion plugins/itemfakevim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ copyq_add_plugin(itemfakevim)

# Disable warnings for 3rd-party source code.
if (PEDANTIC)
if (CMAKE_COMPILER_IS_GNUCXX)
set(IGNORE_PEDANTIC_FLAGS "-Wno-suggest-override")
else()
set(IGNORE_PEDANTIC_FLAGS "-Wno-unused-macros")
endif()

set_source_files_properties(
fakevim/fakevimhandler.cpp
PROPERTIES COMPILE_FLAGS
Expand All @@ -27,7 +33,7 @@ if (PEDANTIC)
-Wno-unreachable-code \
-Wno-documentation-unknown-command \
-Wno-shadow \
-Wno-unused-macros \
${IGNORE_PEDANTIC_FLAGS} \
")
endif()

2 changes: 1 addition & 1 deletion plugins/itemfakevim/fakevim/fakevimhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public slots:
class Private;

private:
bool eventFilter(QObject *ob, QEvent *ev);
bool eventFilter(QObject *ob, QEvent *ev) override;

Private *d;
};
Expand Down
44 changes: 22 additions & 22 deletions plugins/itemfakevim/itemfakevim.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@ class ItemFakeVim : public ItemWidget
public:
ItemFakeVim(ItemWidget *childItem, const QString &sourceFileName);

virtual void setCurrent(bool current);
void setCurrent(bool current) override;

protected:
virtual void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette);
void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette) override;

virtual void updateSize(const QSize &maximumSize, int idealWidth);
void updateSize(const QSize &maximumSize, int idealWidth) override;

virtual QWidget *createEditor(QWidget *parent) const;
QWidget *createEditor(QWidget *parent) const override;

virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;

virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;

virtual bool hasChanges(QWidget *editor) const;
bool hasChanges(QWidget *editor) const override;

virtual QObject *createExternalEditor(const QModelIndex &index, QWidget *parent) const;
QObject *createExternalEditor(const QModelIndex &index, QWidget *parent) const override;

virtual void setTagged(bool tagged);
void setTagged(bool tagged) override;

private:
QScopedPointer<ItemWidget> m_childItem;
Expand All @@ -71,23 +71,23 @@ class ItemFakeVimLoader : public QObject, public ItemLoaderInterface
ItemFakeVimLoader();
~ItemFakeVimLoader();

virtual QString id() const { return "itemfakevim"; }
virtual QString name() const { return tr("FakeVim"); }
virtual QString author() const
QString id() const override { return "itemfakevim"; }
QString name() const override { return tr("FakeVim"); }
QString author() const override
{ return tr("FakeVim plugin is part of Qt Creator")
+ " (Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies))."; }
virtual QString description() const { return tr("Emulate Vim editor while editing items."); }
virtual QVariant icon() const;
+ " (Copyright (C) override 2013 Digia Plc and/or its subsidiary(-ies))."; }
QString description() const override { return tr("Emulate Vim editor while editing items."); }
QVariant icon() const override;

virtual QVariantMap applySettings();
QVariantMap applySettings() override;

virtual void loadSettings(const QVariantMap &settings);
void loadSettings(const QVariantMap &settings) override;

virtual QWidget *createSettingsWidget(QWidget *parent);
QWidget *createSettingsWidget(QWidget *parent) override;

virtual ItemWidget *transform(ItemWidget *itemWidget, const QModelIndex &index);
ItemWidget *transform(ItemWidget *itemWidget, const QModelIndex &index) override;

virtual QObject *tests(const TestInterfacePtr &test) const;
QObject *tests(const TestInterfacePtr &test) const override;

private:
bool m_enabled;
Expand Down
32 changes: 16 additions & 16 deletions plugins/itemimage/itemimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class ItemImage : public QLabel, public ItemWidget
const QString &imageEditor, const QString &svgEditor,
QWidget *parent);

virtual QWidget *createEditor(QWidget *) const { return nullptr; }
QWidget *createEditor(QWidget *) const override { return nullptr; }

virtual QObject *createExternalEditor(const QModelIndex &index, QWidget *parent) const;
QObject *createExternalEditor(const QModelIndex &index, QWidget *parent) const override;

virtual void setCurrent(bool current);
void setCurrent(bool current) override;

protected:
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;

private:
void startAnimation();
Expand All @@ -77,23 +77,23 @@ class ItemImageLoader : public QObject, public ItemLoaderInterface
ItemImageLoader();
~ItemImageLoader();

virtual ItemWidget *create(const QModelIndex &index, QWidget *parent, bool preview) const;
ItemWidget *create(const QModelIndex &index, QWidget *parent, bool preview) const override;

virtual int priority() const { return 15; }
int priority() const override { return 15; }

virtual QString id() const { return "itemimage"; }
virtual QString name() const { return tr("Images"); }
virtual QString author() const { return QString(); }
virtual QString description() const { return tr("Display images."); }
virtual QVariant icon() const { return QVariant(IconCamera); }
QString id() const override { return "itemimage"; }
QString name() const override { return tr("Images"); }
QString author() const override { return QString(); }
QString description() const override { return tr("Display images."); }
QVariant icon() const override { return QVariant(IconCamera); }

virtual QStringList formatsToSave() const;
QStringList formatsToSave() const override;

virtual QVariantMap applySettings();
QVariantMap applySettings() override;

virtual void loadSettings(const QVariantMap &settings) { m_settings = settings; }
void loadSettings(const QVariantMap &settings) override { m_settings = settings; }

virtual QWidget *createSettingsWidget(QWidget *parent);
QWidget *createSettingsWidget(QWidget *parent) override;

private:
QVariantMap m_settings;
Expand Down
Loading

0 comments on commit 8ee47c4

Please sign in to comment.