From 7adbdddbb6b6977e8b86ea0bf6262721d0c6ef6e Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 24 Nov 2016 02:28:39 +0300 Subject: QtWidgets: Add missing override Change-Id: I991659db5510acbbb44d0f5987edc213acf62a74 Reviewed-by: Marc Mutz --- src/widgets/itemviews/qabstractitemview_p.h | 14 +++--- src/widgets/itemviews/qheaderview_p.h | 2 +- src/widgets/itemviews/qitemeditorfactory.h | 4 +- src/widgets/itemviews/qlistview_p.h | 72 ++++++++++++++--------------- src/widgets/itemviews/qlistwidget_p.h | 26 +++++------ src/widgets/itemviews/qtablewidget_p.h | 38 +++++++-------- src/widgets/itemviews/qtreeview_p.h | 14 +++--- 7 files changed, 85 insertions(+), 85 deletions(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h index f8ada6df08..d21ae573cd 100644 --- a/src/widgets/itemviews/qabstractitemview_p.h +++ b/src/widgets/itemviews/qabstractitemview_p.h @@ -93,12 +93,12 @@ class QEmptyModel : public QAbstractItemModel { public: explicit QEmptyModel(QObject *parent = 0) : QAbstractItemModel(parent) {} - QModelIndex index(int, int, const QModelIndex &) const { return QModelIndex(); } - QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } - int rowCount(const QModelIndex &) const { return 0; } - int columnCount(const QModelIndex &) const { return 0; } - bool hasChildren(const QModelIndex &) const { return false; } - QVariant data(const QModelIndex &, int) const { return QVariant(); } + QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); } + QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } + int rowCount(const QModelIndex &) const override { return 0; } + int columnCount(const QModelIndex &) const override { return 0; } + bool hasChildren(const QModelIndex &) const override { return false; } + QVariant data(const QModelIndex &, int) const override { return QVariant(); } }; class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate @@ -323,7 +323,7 @@ public: } // reimplemented from QAbstractScrollAreaPrivate - virtual QPoint contentsOffset() const { + QPoint contentsOffset() const override { Q_Q(const QAbstractItemView); return QPoint(q->horizontalOffset(), q->verticalOffset()); } diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 0356d79ff7..6affe7af95 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -117,7 +117,7 @@ public: void resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode = false); void _q_sectionsRemoved(const QModelIndex &,int,int); void _q_layoutAboutToBeChanged(); - void _q_layoutChanged(); + void _q_layoutChanged() override; bool isSectionSelected(int section) const; bool isFirstVisibleSection(int section) const; diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h index 785d4d84ea..dea9bce794 100644 --- a/src/widgets/itemviews/qitemeditorfactory.h +++ b/src/widgets/itemviews/qitemeditorfactory.h @@ -81,8 +81,8 @@ public: inline QStandardItemEditorCreator() : propertyName(T::staticMetaObject.userProperty().name()) {} - inline QWidget *createWidget(QWidget *parent) const { return new T(parent); } - inline QByteArray valuePropertyName() const { return propertyName; } + inline QWidget *createWidget(QWidget *parent) const override { return new T(parent); } + inline QByteArray valuePropertyName() const override { return propertyName; } private: QByteArray propertyName; diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 42cb6b4eef..07cbd4036c 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -209,24 +209,24 @@ public: int batchSavedPosition; //reimplementations - int itemIndex(const QListViewItem &item) const { return item.indexHint; } - QListViewItem indexToListViewItem(const QModelIndex &index) const; - bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); - void clear(); - void setRowCount(int rowCount) { flowPositions.resize(rowCount); } - QVector intersectingSet(const QRect &area) const; - void dataChanged(const QModelIndex &, const QModelIndex &); + int itemIndex(const QListViewItem &item) const override { return item.indexHint; } + QListViewItem indexToListViewItem(const QModelIndex &index) const override; + bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override; + void clear() override; + void setRowCount(int rowCount) override { flowPositions.resize(rowCount); } + QVector intersectingSet(const QRect &area) const override; + void dataChanged(const QModelIndex &, const QModelIndex &) override; int horizontalScrollToValue(int index, QListView::ScrollHint hint, - bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const; + bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const override; int verticalScrollToValue(int index, QListView::ScrollHint hint, - bool above, bool below, const QRect &area, const QRect &rect) const; - void scrollContentsBy(int dx, int dy, bool scrollElasticBand); - QRect mapToViewport(const QRect &rect) const; - int horizontalOffset() const; - int verticalOffset() const; - void updateHorizontalScrollBar(const QSize &step); - void updateVerticalScrollBar(const QSize &step); + bool above, bool below, const QRect &area, const QRect &rect) const override; + void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override; + QRect mapToViewport(const QRect &rect) const override; + int horizontalOffset() const override; + int verticalOffset() const override; + void updateHorizontalScrollBar(const QSize &step) override; + void updateVerticalScrollBar(const QSize &step) override; #ifndef QT_NO_DRAGANDDROP // The next two methods are to be used on LefToRight flow only. @@ -261,24 +261,24 @@ public: QVector *interSectingVector; //used from within intersectingSet //reimplementations - int itemIndex(const QListViewItem &item) const; - QListViewItem indexToListViewItem(const QModelIndex &index) const; - bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); - void clear(); - void setRowCount(int rowCount); - QVector intersectingSet(const QRect &area) const; - - void scrollContentsBy(int dx, int dy, bool scrollElasticBand); - void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - void appendHiddenRow(int row); - void removeHiddenRow(int row); - void setPositionForIndex(const QPoint &position, const QModelIndex &index); + int itemIndex(const QListViewItem &item) const override; + QListViewItem indexToListViewItem(const QModelIndex &index) const override; + bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override; + void clear() override; + void setRowCount(int rowCount) override; + QVector intersectingSet(const QRect &area) const override; + + void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override; + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void appendHiddenRow(int row) override; + void removeHiddenRow(int row) override; + void setPositionForIndex(const QPoint &position, const QModelIndex &index) override; #ifndef QT_NO_DRAGANDDROP - bool filterDragMoveEvent(QDragMoveEvent *); - bool filterDragLeaveEvent(QDragLeaveEvent *); - bool filterDropEvent(QDropEvent *e); - bool filterStartDrag(Qt::DropActions); + bool filterDragMoveEvent(QDragMoveEvent *) override; + bool filterDragLeaveEvent(QDragLeaveEvent *) override; + bool filterDropEvent(QDropEvent *e) override; + bool filterStartDrag(Qt::DropActions) override; #endif private: @@ -349,18 +349,18 @@ public: QModelIndex closestIndex(const QRect &target, const QVector &candidates) const; QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const; - bool selectionAllowed(const QModelIndex &index) const + bool selectionAllowed(const QModelIndex &index) const override { if (viewMode == QListView::ListMode && !showElasticBand) return index.isValid(); return true; } int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; QItemSelection selection(const QRect &rect) const; - void selectAll(QItemSelectionModel::SelectionFlags command); + void selectAll(QItemSelectionModel::SelectionFlags command) override; #ifndef QT_NO_DRAGANDDROP - virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; - bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index); + QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const override; + bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override; #endif inline void setGridSize(const QSize &size) { grid = size; } @@ -383,7 +383,7 @@ public: void scrollElasticBandBy(int dx, int dy); - QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override; void emitIndexesMoved(const QModelIndexList &indexes) { emit q_func()->indexesMoved(indexes); } diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index eaddfc6e6e..0594fd511e 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -93,22 +93,22 @@ public: QListWidgetItem *take(int row); void move(int srcRow, int dstRow); - int rowCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; QModelIndex index(QListWidgetItem *item) const; - QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; - QMap itemData(const QModelIndex &index) const; + QMap itemData(const QModelIndex &index) const override; - bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; - void sort(int column, Qt::SortOrder order); + void sort(int column, Qt::SortOrder order) override; void ensureSorted(int column, Qt::SortOrder order, int start, int end); static bool itemLessThan(const QPair &left, const QPair &right); @@ -122,12 +122,12 @@ public: void itemChanged(QListWidgetItem *item); // dnd - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; #ifndef QT_NO_DRAGANDDROP bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - Qt::DropActions supportedDropActions() const; + int row, int column, const QModelIndex &parent) override; + Qt::DropActions supportedDropActions() const override; #endif QMimeData *internalMimeData() const; diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index 313577befe..2db7337cd6 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -99,11 +99,11 @@ public: QTableModel(int rows, int columns, QTableWidget *parent); ~QTableModel(); - bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override; - bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override; void setItem(int row, int column, QTableWidgetItem *item); QTableWidgetItem *takeItem(int row, int column); @@ -118,7 +118,7 @@ public: QTableWidgetItem *horizontalHeaderItem(int section); QTableWidgetItem *verticalHeaderItem(int section); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override { return QAbstractTableModel::index(row, column, parent); } QModelIndex index(const QTableWidgetItem *item) const; @@ -126,21 +126,21 @@ public: void setRowCount(int rows); void setColumnCount(int columns); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - bool setItemData(const QModelIndex &index, const QMap &roles); + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; + bool setItemData(const QModelIndex &index, const QMap &roles) override; - QMap itemData(const QModelIndex &index) const; + QMap itemData(const QModelIndex &index) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role); + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override; - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; - void sort(int column, Qt::SortOrder order); + void sort(int column, Qt::SortOrder order) override; static bool itemLessThan(const QPair &left, const QPair &right); static bool itemGreaterThan(const QPair &left, @@ -167,11 +167,11 @@ public: void setItemPrototype(const QTableWidgetItem *item); // dnd - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - Qt::DropActions supportedDropActions() const; + int row, int column, const QModelIndex &parent) override; + Qt::DropActions supportedDropActions() const override; QMimeData *internalMimeData() const; diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h index 56f3340966..63af41292b 100644 --- a/src/widgets/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -102,8 +102,8 @@ public: return logicalIndex == logicalIndexForTree(); } - QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; - void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex ¤t) const; + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override; + void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex ¤t) const override; #ifndef QT_NO_ANIMATION struct AnimatedOperation : public QVariantAnimation @@ -115,8 +115,8 @@ public: AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); } int top() const { return startValue().toInt(); } QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; } - void updateCurrentValue(const QVariant &) { viewport->update(rect()); } - void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); } + void updateCurrentValue(const QVariant &) override { viewport->update(rect()); } + void updateState(State state, State) override { if (state == Stopped) before = after = QPixmap(); } } animatedOperation; void prepareAnimatedOperation(int item, QVariantAnimation::Direction d); void beginAnimatedOperation(); @@ -128,11 +128,11 @@ public: void expand(int item, bool emitSignal); void collapse(int item, bool emitSignal); - void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int); - void _q_columnsRemoved(const QModelIndex &, int, int); + void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int) override; + void _q_columnsRemoved(const QModelIndex &, int, int) override; void _q_modelAboutToBeReset(); void _q_sortIndicatorChanged(int column, Qt::SortOrder order); - void _q_modelDestroyed(); + void _q_modelDestroyed() override; void layout(int item, bool recusiveExpanding = false, bool afterIsUninitialized = false); -- cgit v1.2.3