tests: Fix warnings about inconsistent override

tst_noqteventloop.cpp   'event' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'canFetchMore' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'fetchMore' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'hasChildren' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'rowCount' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'columnCount' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'index' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'parent' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtreeview.cpp 'data' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtextedit.cpp 'begin' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtextedit.cpp 'end' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtextedit.cpp 'updateState' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtextedit.cpp 'drawPixmap' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
tst_qtextedit.cpp 'type' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

Change-Id: I2a0c5da15994619383c1f90fee311927e58d7af0
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This commit is contained in:
Friedemann Kleint 2017-10-27 08:51:05 +02:00
parent cf22203855
commit ed31393e06
3 changed files with 18 additions and 29 deletions

View File

@ -64,7 +64,7 @@ public:
m_received.clear();
}
bool event(QEvent *event)
bool event(QEvent *event) override
{
m_received[event->type()]++;
return QWindow::event(event);

View File

@ -223,15 +223,12 @@ public:
return index.isValid() ? qint32(index.internalId()) : qint32(-1);
}
bool canFetchMore(const QModelIndex &) const {
return !fetched;
}
bool canFetchMore(const QModelIndex &) const override { return !fetched; }
void fetchMore(const QModelIndex &) {
fetched = true;
}
void fetchMore(const QModelIndex &) override { fetched = true; }
bool hasChildren(const QModelIndex &parent = QModelIndex()) const {
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override
{
bool hasFetched = fetched;
fetched = true;
bool r = QAbstractItemModel::hasChildren(parent);
@ -239,14 +236,16 @@ public:
return r;
}
int rowCount(const QModelIndex& parent = QModelIndex()) const {
int rowCount(const QModelIndex& parent = QModelIndex()) const override
{
if (!fetched)
qFatal("%s: rowCount should not be called before fetching", Q_FUNC_INFO);
if ((parent.column() > 0) || (level(parent) > levels))
return 0;
return rows;
}
int columnCount(const QModelIndex& parent = QModelIndex()) const {
int columnCount(const QModelIndex& parent = QModelIndex()) const override
{
if ((parent.column() > 0) || (level(parent) > levels))
return 0;
return cols;
@ -258,7 +257,7 @@ public:
return false;
}
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
{
if (row < 0 || column < 0 || (level(parent) > levels) || column >= cols || row >= rows) {
return QModelIndex();
@ -268,14 +267,14 @@ public:
return i;
}
QModelIndex parent(const QModelIndex &index) const
QModelIndex parent(const QModelIndex &index) const override
{
if (!parentHash.contains(index))
return QModelIndex();
return parentHash[index];
}
QVariant data(const QModelIndex &idx, int role) const
QVariant data(const QModelIndex &idx, int role) const override
{
if (!idx.isValid())
return QVariant();

View File

@ -2604,30 +2604,20 @@ namespace {
class MyPaintEngine : public QPaintEngine
{
public:
bool begin(QPaintDevice *)
{
return true;
}
bool begin(QPaintDevice *) override { return true; }
bool end()
{
return true;
}
bool end() override { return true; }
void updateState(const QPaintEngineState &)
{
}
void updateState(const QPaintEngineState &) override { }
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &)
{
}
void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override { }
void drawTextItem(const QPointF &, const QTextItem &textItem) Q_DECL_OVERRIDE
void drawTextItem(const QPointF &, const QTextItem &textItem) override
{
itemFonts.append(qMakePair(textItem.text(), textItem.font()));
}
Type type() const { return User; }
Type type() const override { return User; }
QList<QPair<QString, QFont> > itemFonts;