From 3b0c2b7c1b3ccdfe6867884a7e210bfc63e10f84 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 14 Jul 2014 09:13:02 +0200 Subject: Examples: Add Q_DECL_OVERRIDE to overridden functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Q_DECL_OVERRIDE (which expands to 'override' for supported compiler) helps to declare the intent (that it is an overridden function) and force compilation error when there is no such virtual function in the base class. The examples should show the best practice of having it, as it may save the programmer quite some time in case of change of API or typo in the function name or arguments. This change was done automatically with clang-modernize -add-override -override-macros And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a Reviewed-by: Jędrzej Nowacki --- .../widgets/itemviews/addressbook/tablemodel.h | 16 ++++----- examples/widgets/itemviews/chart/pieview.h | 40 +++++++++++----------- .../customsortfiltermodel/mysortfilterproxymodel.h | 4 +-- .../itemviews/editabletreemodel/treemodel.h | 26 +++++++------- .../widgets/itemviews/fetchmore/filelistmodel.h | 8 ++--- .../itemviews/frozencolumn/freezetablewidget.h | 6 ++-- examples/widgets/itemviews/interview/model.h | 16 ++++----- examples/widgets/itemviews/pixelator/imagemodel.h | 8 ++--- .../widgets/itemviews/pixelator/pixeldelegate.h | 4 +-- examples/widgets/itemviews/puzzle/piecesmodel.h | 16 ++++----- examples/widgets/itemviews/puzzle/puzzlewidget.h | 12 +++---- .../widgets/itemviews/simpledommodel/dommodel.h | 14 ++++---- .../widgets/itemviews/simpletreemodel/treemodel.h | 14 ++++---- .../widgets/itemviews/spinboxdelegate/delegate.h | 8 ++--- .../itemviews/spreadsheet/spreadsheetdelegate.h | 6 ++-- .../itemviews/spreadsheet/spreadsheetitem.h | 6 ++-- .../widgets/itemviews/stardelegate/stardelegate.h | 10 +++--- .../widgets/itemviews/stardelegate/stareditor.h | 8 ++--- 18 files changed, 111 insertions(+), 111 deletions(-) (limited to 'examples/widgets/itemviews') diff --git a/examples/widgets/itemviews/addressbook/tablemodel.h b/examples/widgets/itemviews/addressbook/tablemodel.h index e282defa1b..d505dbf6e7 100644 --- a/examples/widgets/itemviews/addressbook/tablemodel.h +++ b/examples/widgets/itemviews/addressbook/tablemodel.h @@ -54,14 +54,14 @@ public: TableModel(QObject *parent = 0); TableModel(QList > listofPairs, QObject *parent = 0); - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()); - bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()); + int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) Q_DECL_OVERRIDE; + bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) Q_DECL_OVERRIDE; QList > getList(); private: diff --git a/examples/widgets/itemviews/chart/pieview.h b/examples/widgets/itemviews/chart/pieview.h index e8eb59758f..7ad893c03a 100644 --- a/examples/widgets/itemviews/chart/pieview.h +++ b/examples/widgets/itemviews/chart/pieview.h @@ -51,44 +51,44 @@ class PieView : public QAbstractItemView public: PieView(QWidget *parent = 0); - QRect visualRect(const QModelIndex &index) const; - void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); - QModelIndex indexAt(const QPoint &point) const; + QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE; + QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE; protected slots: void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector &roles = QVector()); - void rowsInserted(const QModelIndex &parent, int start, int end); - void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + const QVector &roles = QVector()) Q_DECL_OVERRIDE; + void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; + void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; protected: - bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event); + bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) Q_DECL_OVERRIDE; QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, - Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; - int horizontalOffset() const; - int verticalOffset() const; + int horizontalOffset() const Q_DECL_OVERRIDE; + int verticalOffset() const Q_DECL_OVERRIDE; - bool isIndexHidden(const QModelIndex &index) const; + bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE; - void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command); + void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - void scrollContentsBy(int dx, int dy); + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE; - QRegion visualRegionForSelection(const QItemSelection &selection) const; + QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE; private: QRect itemRect(const QModelIndex &item) const; QRegion itemRegion(const QModelIndex &index) const; int rows(const QModelIndex &index = QModelIndex()) const; - void updateGeometries(); + void updateGeometries() Q_DECL_OVERRIDE; int margin; int totalSize; diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h index c0c9aa3012..b251a54c3d 100644 --- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h +++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h @@ -59,8 +59,8 @@ public: void setFilterMaximumDate(const QDate &date); protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const; + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; + bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; private: bool dateInRange(const QDate &date) const; diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.h b/examples/widgets/itemviews/editabletreemodel/treemodel.h index 078e5e4077..0d0a9178d6 100644 --- a/examples/widgets/itemviews/editabletreemodel/treemodel.h +++ b/examples/widgets/itemviews/editabletreemodel/treemodel.h @@ -58,33 +58,33 @@ public: ~TreeModel(); //! [0] //! [1] - QVariant data(const QModelIndex &index, int role) const; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; + const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; //! [1] //! [2] - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole); + int role = Qt::EditRole) Q_DECL_OVERRIDE; bool setHeaderData(int section, Qt::Orientation orientation, - const QVariant &value, int role = Qt::EditRole); + const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; bool insertColumns(int position, int columns, - const QModelIndex &parent = QModelIndex()); + const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; bool removeColumns(int position, int columns, - const QModelIndex &parent = QModelIndex()); + const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; bool insertRows(int position, int rows, - const QModelIndex &parent = QModelIndex()); + const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; bool removeRows(int position, int rows, - const QModelIndex &parent = QModelIndex()); + const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; private: void setupModelData(const QStringList &lines, TreeItem *parent); diff --git a/examples/widgets/itemviews/fetchmore/filelistmodel.h b/examples/widgets/itemviews/fetchmore/filelistmodel.h index 5daef80a83..99c1490495 100644 --- a/examples/widgets/itemviews/fetchmore/filelistmodel.h +++ b/examples/widgets/itemviews/fetchmore/filelistmodel.h @@ -53,8 +53,8 @@ class FileListModel : public QAbstractListModel public: FileListModel(QObject *parent = 0); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; signals: void numberPopulated(int number); @@ -63,8 +63,8 @@ public slots: void setDirPath(const QString &path); protected: - bool canFetchMore(const QModelIndex &parent) const; - void fetchMore(const QModelIndex &parent); + bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; + void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; private: QStringList fileList; diff --git a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h index 53805316aa..ea3b0d4b6f 100644 --- a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h +++ b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h @@ -53,9 +53,9 @@ public: protected: - virtual void resizeEvent(QResizeEvent *event); - virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); - void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible); + virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; + void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE; private: QTableView *frozenTableView; diff --git a/examples/widgets/itemviews/interview/model.h b/examples/widgets/itemviews/interview/model.h index 02c267f69a..0dd722b855 100644 --- a/examples/widgets/itemviews/interview/model.h +++ b/examples/widgets/itemviews/interview/model.h @@ -55,17 +55,17 @@ public: Model(int rows, int columns, QObject *parent = 0); ~Model(); - QModelIndex index(int row, int column, const QModelIndex &parent) const; - QModelIndex parent(const QModelIndex &child) const; + QModelIndex index(int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; + int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent) const; - Qt::ItemFlags flags(const QModelIndex &index) const; + bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; private: diff --git a/examples/widgets/itemviews/pixelator/imagemodel.h b/examples/widgets/itemviews/pixelator/imagemodel.h index 3cb5d32b20..49c3b3269d 100644 --- a/examples/widgets/itemviews/pixelator/imagemodel.h +++ b/examples/widgets/itemviews/pixelator/imagemodel.h @@ -54,11 +54,11 @@ public: void setImage(const QImage &image); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; private: QImage modelImage; diff --git a/examples/widgets/itemviews/pixelator/pixeldelegate.h b/examples/widgets/itemviews/pixelator/pixeldelegate.h index b4426ea268..c7d27ba52d 100644 --- a/examples/widgets/itemviews/pixelator/pixeldelegate.h +++ b/examples/widgets/itemviews/pixelator/pixeldelegate.h @@ -62,10 +62,10 @@ public: PixelDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index ) const; + const QModelIndex &index ) const Q_DECL_OVERRIDE; public slots: void setPixelSize(int size); diff --git a/examples/widgets/itemviews/puzzle/piecesmodel.h b/examples/widgets/itemviews/puzzle/piecesmodel.h index 72df1cef92..a6e31f2107 100644 --- a/examples/widgets/itemviews/puzzle/piecesmodel.h +++ b/examples/widgets/itemviews/puzzle/piecesmodel.h @@ -58,16 +58,16 @@ class PiecesModel : public QAbstractListModel public: explicit PiecesModel(int pieceSize, QObject *parent = 0); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool removeRows(int row, int count, const QModelIndex &parent); + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + bool removeRows(int row, int count, const QModelIndex &parent) Q_DECL_OVERRIDE; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - QMimeData *mimeData(const QModelIndexList &indexes) const; - QStringList mimeTypes() const; - int rowCount(const QModelIndex &parent) const; - Qt::DropActions supportedDropActions() const; + int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; + QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE; + QStringList mimeTypes() const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; + Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; void addPiece(const QPixmap &pixmap, const QPoint &location); void addPieces(const QPixmap& pixmap); diff --git a/examples/widgets/itemviews/puzzle/puzzlewidget.h b/examples/widgets/itemviews/puzzle/puzzlewidget.h index 5da81b9c63..41dc141ee4 100644 --- a/examples/widgets/itemviews/puzzle/puzzlewidget.h +++ b/examples/widgets/itemviews/puzzle/puzzlewidget.h @@ -67,12 +67,12 @@ signals: void puzzleCompleted(); protected: - void dragEnterEvent(QDragEnterEvent *event); - void dragLeaveEvent(QDragLeaveEvent *event); - void dragMoveEvent(QDragMoveEvent *event); - void dropEvent(QDropEvent *event); - void mousePressEvent(QMouseEvent *event); - void paintEvent(QPaintEvent *event); + void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; + void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE; + void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; private: int findPiece(const QRect &pieceRect) const; diff --git a/examples/widgets/itemviews/simpledommodel/dommodel.h b/examples/widgets/itemviews/simpledommodel/dommodel.h index 7e56707198..27ece11b45 100644 --- a/examples/widgets/itemviews/simpledommodel/dommodel.h +++ b/examples/widgets/itemviews/simpledommodel/dommodel.h @@ -56,15 +56,15 @@ public: explicit DomModel(QDomDocument document, QObject *parent = 0); ~DomModel(); - QVariant data(const QModelIndex &index, int role) const; - Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &child) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; private: QDomDocument domDocument; diff --git a/examples/widgets/itemviews/simpletreemodel/treemodel.h b/examples/widgets/itemviews/simpletreemodel/treemodel.h index 3bd593bc3e..964f0077c1 100644 --- a/examples/widgets/itemviews/simpletreemodel/treemodel.h +++ b/examples/widgets/itemviews/simpletreemodel/treemodel.h @@ -56,15 +56,15 @@ public: explicit TreeModel(const QString &data, QObject *parent = 0); ~TreeModel(); - QVariant data(const QModelIndex &index, int role) const; - Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; private: void setupModelData(const QStringList &lines, TreeItem *parent); diff --git a/examples/widgets/itemviews/spinboxdelegate/delegate.h b/examples/widgets/itemviews/spinboxdelegate/delegate.h index 454471e155..9f5eb2b28b 100644 --- a/examples/widgets/itemviews/spinboxdelegate/delegate.h +++ b/examples/widgets/itemviews/spinboxdelegate/delegate.h @@ -52,14 +52,14 @@ public: SpinBoxDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; - void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; void updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &index) const; + const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; }; //! [0] diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h index 464c2c3170..b67a2b690a 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h +++ b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h @@ -53,10 +53,10 @@ class SpreadSheetDelegate : public QItemDelegate public: SpreadSheetDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, - const QModelIndex &index) const; - void setEditorData(QWidget *editor, const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; + void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; private slots: void commitAndCloseEditor(); diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h index 4f1c1e1e4c..5af1fd1656 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h +++ b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h @@ -52,10 +52,10 @@ public: SpreadSheetItem(); SpreadSheetItem(const QString &text); - QTableWidgetItem *clone() const; + QTableWidgetItem *clone() const Q_DECL_OVERRIDE; - QVariant data(int role) const; - void setData(int role, const QVariant &value); + QVariant data(int role) const Q_DECL_OVERRIDE; + void setData(int role, const QVariant &value) Q_DECL_OVERRIDE; QVariant display() const; inline QString formula() const diff --git a/examples/widgets/itemviews/stardelegate/stardelegate.h b/examples/widgets/itemviews/stardelegate/stardelegate.h index 334dfbf375..03cd5d7e9b 100644 --- a/examples/widgets/itemviews/stardelegate/stardelegate.h +++ b/examples/widgets/itemviews/stardelegate/stardelegate.h @@ -52,14 +52,14 @@ public: StarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - void setEditorData(QWidget *editor, const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; + void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; + const QModelIndex &index) const Q_DECL_OVERRIDE; private slots: void commitAndCloseEditor(); diff --git a/examples/widgets/itemviews/stardelegate/stareditor.h b/examples/widgets/itemviews/stardelegate/stareditor.h index a9a635b55b..c917d12b49 100644 --- a/examples/widgets/itemviews/stardelegate/stareditor.h +++ b/examples/widgets/itemviews/stardelegate/stareditor.h @@ -53,7 +53,7 @@ class StarEditor : public QWidget public: StarEditor(QWidget *parent = 0); - QSize sizeHint() const; + QSize sizeHint() const Q_DECL_OVERRIDE; void setStarRating(const StarRating &starRating) { myStarRating = starRating; } @@ -63,9 +63,9 @@ signals: void editingFinished(); protected: - void paintEvent(QPaintEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private: int starAtPosition(int x); -- cgit v1.2.3