Mark some methods in test code as overrides
CustomTextWidgetIface marked its text() method as an override; DropOnOddRows marked its canDropMimeData() as an override; each neglected some other methods that are overrides. Convert Q_DECL_OVERRIDE to the keyword in affected classes, to match. Change-Id: I78b38e20a81e3e6aab282a1cb3d70cdf8a5f4135 Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
ee84af00d1
commit
c587036dc6
@ -3994,21 +3994,21 @@ class DropOnOddRows : public QAbstractListModel
|
|||||||
public:
|
public:
|
||||||
DropOnOddRows(QObject *parent = 0) : QAbstractListModel(parent) {}
|
DropOnOddRows(QObject *parent = 0) : QAbstractListModel(parent) {}
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
return (index.row() % 2 == 0) ? "A" : "B";
|
return (index.row() % 2 == 0) ? "A" : "B";
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canDropMimeData(const QMimeData *, Qt::DropAction,
|
bool canDropMimeData(const QMimeData *, Qt::DropAction,
|
||||||
int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE
|
int row, int column, const QModelIndex &parent) const override
|
||||||
{
|
{
|
||||||
Q_UNUSED(row);
|
Q_UNUSED(row);
|
||||||
Q_UNUSED(column);
|
Q_UNUSED(column);
|
||||||
|
@ -98,53 +98,54 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CustomTextWidgetIface(CustomTextWidget *w): QAccessibleWidget(w) {}
|
CustomTextWidgetIface(CustomTextWidget *w): QAccessibleWidget(w) {}
|
||||||
void *interface_cast(QAccessible::InterfaceType t) {
|
void *interface_cast(QAccessible::InterfaceType t) override
|
||||||
|
{
|
||||||
if (t == QAccessible::TextInterface)
|
if (t == QAccessible::TextInterface)
|
||||||
return static_cast<QAccessibleTextInterface*>(this);
|
return static_cast<QAccessibleTextInterface*>(this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is mostly to test the base implementation for textBefore/At/After
|
// this is mostly to test the base implementation for textBefore/At/After
|
||||||
QString text(QAccessible::Text t) const Q_DECL_OVERRIDE
|
QString text(QAccessible::Text t) const override
|
||||||
{
|
{
|
||||||
if (t == QAccessible::Value)
|
if (t == QAccessible::Value)
|
||||||
return textWidget()->text;
|
return textWidget()->text;
|
||||||
return QAccessibleWidget::text(t);
|
return QAccessibleWidget::text(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
|
QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
|
||||||
{
|
{
|
||||||
if (offset == -2)
|
if (offset == -2)
|
||||||
offset = textWidget()->cursorPosition;
|
offset = textWidget()->cursorPosition;
|
||||||
return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
|
return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
|
||||||
}
|
}
|
||||||
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
|
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
|
||||||
{
|
{
|
||||||
if (offset == -2)
|
if (offset == -2)
|
||||||
offset = textWidget()->cursorPosition;
|
offset = textWidget()->cursorPosition;
|
||||||
return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
|
return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
|
||||||
}
|
}
|
||||||
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
|
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
|
||||||
{
|
{
|
||||||
if (offset == -2)
|
if (offset == -2)
|
||||||
offset = textWidget()->cursorPosition;
|
offset = textWidget()->cursorPosition;
|
||||||
return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
|
return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void selection(int, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE
|
void selection(int, int *startOffset, int *endOffset) const override
|
||||||
{ *startOffset = *endOffset = -1; }
|
{ *startOffset = *endOffset = -1; }
|
||||||
int selectionCount() const Q_DECL_OVERRIDE { return 0; }
|
int selectionCount() const override { return 0; }
|
||||||
void addSelection(int, int) Q_DECL_OVERRIDE {}
|
void addSelection(int, int) override {}
|
||||||
void removeSelection(int) Q_DECL_OVERRIDE {}
|
void removeSelection(int) override {}
|
||||||
void setSelection(int, int, int) Q_DECL_OVERRIDE {}
|
void setSelection(int, int, int) override {}
|
||||||
int cursorPosition() const Q_DECL_OVERRIDE { return textWidget()->cursorPosition; }
|
int cursorPosition() const override { return textWidget()->cursorPosition; }
|
||||||
void setCursorPosition(int position) Q_DECL_OVERRIDE { textWidget()->cursorPosition = position; }
|
void setCursorPosition(int position) override { textWidget()->cursorPosition = position; }
|
||||||
QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE { return textWidget()->text.mid(startOffset, endOffset); }
|
QString text(int startOffset, int endOffset) const override { return textWidget()->text.mid(startOffset, endOffset); }
|
||||||
int characterCount() const Q_DECL_OVERRIDE { return textWidget()->text.length(); }
|
int characterCount() const override { return textWidget()->text.length(); }
|
||||||
QRect characterRect(int) const Q_DECL_OVERRIDE { return QRect(); }
|
QRect characterRect(int) const override { return QRect(); }
|
||||||
int offsetAtPoint(const QPoint &) const Q_DECL_OVERRIDE { return 0; }
|
int offsetAtPoint(const QPoint &) const override { return 0; }
|
||||||
void scrollToSubstring(int, int) Q_DECL_OVERRIDE {}
|
void scrollToSubstring(int, int) override {}
|
||||||
QString attributes(int, int *, int *) const Q_DECL_OVERRIDE
|
QString attributes(int, int *, int *) const override
|
||||||
{ return QString(); }
|
{ return QString(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user