forked from qt-creator/qt-creator
Wizards: sprinkle some overrides
Change-Id: I52bd759f9c91f36192b147a1e6579be2b4b54a82 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
|
||||
{
|
||||
if (!sourceParent.isValid())
|
||||
return true;
|
||||
@@ -101,18 +101,18 @@ class TwoLevelProxyModel : public QAbstractProxyModel
|
||||
public:
|
||||
TwoLevelProxyModel(QObject *parent = 0): QAbstractProxyModel(parent) {}
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override
|
||||
{
|
||||
QModelIndex ourModelIndex = sourceModel()->index(row, column, mapToSource(parent));
|
||||
return createIndex(row, column, ourModelIndex.internalPointer());
|
||||
}
|
||||
|
||||
QModelIndex parent(const QModelIndex &index) const
|
||||
QModelIndex parent(const QModelIndex &index) const override
|
||||
{
|
||||
return mapFromSource(mapToSource(index).parent());
|
||||
}
|
||||
|
||||
int rowCount(const QModelIndex &index) const
|
||||
int rowCount(const QModelIndex &index) const override
|
||||
{
|
||||
if (index.isValid() && index.parent().isValid() && !index.parent().parent().isValid())
|
||||
return 0;
|
||||
@@ -120,19 +120,19 @@ public:
|
||||
return sourceModel()->rowCount(mapToSource(index));
|
||||
}
|
||||
|
||||
int columnCount(const QModelIndex &index) const
|
||||
int columnCount(const QModelIndex &index) const override
|
||||
{
|
||||
return sourceModel()->columnCount(mapToSource(index));
|
||||
}
|
||||
|
||||
QModelIndex mapFromSource (const QModelIndex &index) const
|
||||
QModelIndex mapFromSource (const QModelIndex &index) const override
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
return createIndex(index.row(), index.column(), index.internalPointer());
|
||||
}
|
||||
|
||||
QModelIndex mapToSource (const QModelIndex &index) const
|
||||
QModelIndex mapToSource (const QModelIndex &index) const override
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
FancyTopLevelDelegate(QObject *parent = 0)
|
||||
: QItemDelegate(parent) {}
|
||||
|
||||
void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
|
||||
void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const override
|
||||
{
|
||||
QStyleOptionViewItem newoption = option;
|
||||
if (!(option.state & QStyle::State_Enabled)) {
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
QItemDelegate::drawDisplay(painter, newoption, rect, text);
|
||||
}
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||
{
|
||||
QSize size = QItemDelegate::sizeHint(option, index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user