Use QList instead of QVector in widgets tests

Task-number: QTBUG-84469
Change-Id: I490fdb237afad2d8a15954fe34d6b549a83fa4aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Jarek Kobus 2020-06-22 16:15:32 +02:00
parent 74dc89de3e
commit 5accfa1e68
28 changed files with 269 additions and 286 deletions

View File

@ -192,7 +192,7 @@ void tst_QFileDialog2::listRoot()
void tst_QFileDialog2::heapCorruption()
{
QVector<QFileDialog*> dialogs;
QList<QFileDialog *> dialogs;
for (int i=0; i < 10; i++) {
QFileDialog *f = new QFileDialog(NULL);
dialogs << f;

View File

@ -585,7 +585,7 @@ using SignalSignature = void(QDialog::*)();
Q_DECLARE_METATYPE(SignalSignature);
Q_DECLARE_METATYPE(QMessageBox::ButtonRole)
using ButtonsCreator = std::function<QVector<QPushButton*>(QMessageBox &)>;
using ButtonsCreator = std::function<QList<QPushButton *>(QMessageBox &)>;
Q_DECLARE_METATYPE(ButtonsCreator);
using RoleSet = QSet<QMessageBox::ButtonRole>;
@ -635,7 +635,7 @@ static void addRejectedRow(const char *title, ButtonsCreator bc)
static void addCustomButtonsData()
{
ButtonsCreator buttonsCreator = [](QMessageBox &messageBox) {
QVector<QPushButton*> buttons(QMessageBox::NRoles);
QList<QPushButton *> buttons(QMessageBox::NRoles);
for (int i = QMessageBox::AcceptRole; i < QMessageBox::NRoles; ++i) {
buttons[i] = messageBox.addButton(
QString("Button role: %1").arg(i), QMessageBox::ButtonRole(i));
@ -651,7 +651,7 @@ static void addCustomButtonsData()
static void addStandardButtonsData()
{
ButtonsCreator buttonsCreator = [](QMessageBox &messageBox) {
QVector<QPushButton*> buttons;
QList<QPushButton *> buttons;
for (int i = QMessageBox::FirstButton; i <= QMessageBox::LastButton; i <<= 1)
buttons << messageBox.addButton(QMessageBox::StandardButton(i));

View File

@ -1690,7 +1690,7 @@ QString SetOption::describe() const
+ QLatin1Char(on ? '1' : '0');
}
Q_DECLARE_METATYPE(QVector<QSharedPointer<Operation> >)
Q_DECLARE_METATYPE(QList<QSharedPointer<Operation>>)
class TestGroup
{
@ -1707,7 +1707,7 @@ public:
combinations.clear();
}
QVector<QSharedPointer<Operation> > &add()
QList<QSharedPointer<Operation>> &add()
{
combinations.resize(combinations.size() + 1);
return combinations.last();
@ -1728,7 +1728,7 @@ private:
QString name;
Type type;
int nRows_;
QVector<QVector<QSharedPointer<Operation> > > combinations;
QList<QList<QSharedPointer<Operation>>> combinations;
};
class IntroPage : public QWizardPage
@ -1812,7 +1812,7 @@ public:
}
}
void applyOperations(const QVector<QSharedPointer<Operation> > &operations)
void applyOperations(const QList<QSharedPointer<Operation>> &operations)
{
foreach (const QSharedPointer<Operation> &op, operations) {
if (op) {
@ -1834,15 +1834,16 @@ public:
class CombinationsTestData
{
TestGroup testGroup;
QVector<QSharedPointer<Operation> > pageOps;
QVector<QSharedPointer<Operation> > styleOps;
QMap<bool, QVector<QSharedPointer<Operation> > > setAllOptions;
QList<QSharedPointer<Operation>> pageOps;
QList<QSharedPointer<Operation>> styleOps;
QMap<bool, QList<QSharedPointer<Operation>>> setAllOptions;
public:
CombinationsTestData()
{
QTest::addColumn<bool>("ref");
QTest::addColumn<bool>("testEquality");
QTest::addColumn<QVector<QSharedPointer<Operation> > >("operations");
QTest::addColumn<QList<QSharedPointer<Operation>>>("operations");
pageOps << SetPage::create(0) << SetPage::create(1) << SetPage::create(2);
styleOps << SetStyle::create(QWizard::ClassicStyle) << SetStyle::create(QWizard::ModernStyle)
<< SetStyle::create(QWizard::MacStyle);
@ -1908,7 +1909,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
QVector<QSharedPointer<Operation> > setOptions = setAllOptions.value(i == 1);
QList<QSharedPointer<Operation>> setOptions = setAllOptions.value(i == 1);
testGroup.reset("testAll 3.1");
testGroup.add() << setOptions;
@ -1932,7 +1933,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
QVector<QSharedPointer<Operation> > optionOps = setAllOptions.value(i == 1);
QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 4.2");
testGroup.add() << optionOps << pageOp;
testGroup.add() << pageOp << optionOps;
@ -1955,7 +1956,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
QVector<QSharedPointer<Operation> > optionOps = setAllOptions.value(i == 1);
QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 5.2");
testGroup.add() << optionOps << styleOp;
testGroup.add() << styleOp << optionOps;
@ -1990,7 +1991,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
QVector<QSharedPointer<Operation> > optionOps = setAllOptions.value(i == 1);
QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 6.4");
testGroup.add() << optionOps << pageOp << styleOp;
testGroup.add() << pageOp << optionOps << styleOp;
@ -2063,7 +2064,7 @@ void tst_QWizard::combinations()
{
QFETCH(bool, ref);
QFETCH(bool, testEquality);
QFETCH(QVector<QSharedPointer<Operation> >, operations);
QFETCH(QList<QSharedPointer<Operation>>, operations);
TestWizard wizard;
#if !defined(QT_NO_STYLE_WINDOWSVISTA)

View File

@ -1358,7 +1358,7 @@ static inline QByteArray msgStability(const QRectF &actual, const QRectF &expect
void tst_QGraphicsAnchorLayout::stability()
{
QVector<QRectF> geometries;
QList<QRectF> geometries;
geometries.resize(7);
QGraphicsWidget p(0, Qt::Window);
// it usually fails after 3-4 iterations

View File

@ -61,7 +61,7 @@
#include <QPainterPath>
using AbstractGraphicsShapeItemPtr = QSharedPointer<QAbstractGraphicsShapeItem>;
using GraphicsItems = QVector<QGraphicsItem *>;
using GraphicsItems = QList<QGraphicsItem *>;
using GraphicsItemsList = QList<QGraphicsItem *>;
Q_DECLARE_METATYPE(AbstractGraphicsShapeItemPtr)
@ -251,7 +251,7 @@ public:
lastExposedRect = QRectF();
}
QVector<QEvent::Type> events;
QList<QEvent::Type> events;
QPainter::RenderHints hints;
int repaints = 0;
QRectF br = QRectF(-10, -10, 20, 20);
@ -1544,7 +1544,7 @@ class SelectChangeItem : public QGraphicsRectItem
{
public:
SelectChangeItem() : QGraphicsRectItem(-50, -50, 100, 100) { setBrush(Qt::blue); }
QVector<bool> values;
QList<bool> values;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
@ -4482,7 +4482,7 @@ public:
QVariant itemChangeReturnValue;
QGraphicsScene *itemSceneChangeTargetScene;
QVector<GraphicsItemChange> changes;
QList<GraphicsItemChange> changes;
QVariantList values;
QVariantList oldValues;
protected:
@ -4946,9 +4946,9 @@ void tst_QGraphicsItem::itemChange()
class EventFilterTesterItem : public QGraphicsLineItem
{
public:
QVector<QEvent::Type> filteredEvents;
QList<QEvent::Type> filteredEvents;
GraphicsItems filteredEventReceivers;
QVector<QEvent::Type> receivedEvents;
QList<QEvent::Type> receivedEvents;
bool handlesSceneEvents = false;
protected:
@ -8069,20 +8069,22 @@ void tst_QGraphicsItem::itemSendsGeometryChanges()
QCOMPARE(item.scale(), qreal(1.0));
QCOMPARE(item.transformOriginPoint(), QPointF(0.0, 0.0));
const QVector<QGraphicsItem::GraphicsItemChange> expected{QGraphicsItem::ItemOpacityChange,
QGraphicsItem::ItemOpacityHasChanged,
QGraphicsItem::ItemFlagsChange,
QGraphicsItem::ItemFlagsHaveChanged,
QGraphicsItem::ItemTransformChange,
QGraphicsItem::ItemTransformHasChanged,
QGraphicsItem::ItemPositionChange,
QGraphicsItem::ItemPositionHasChanged,
QGraphicsItem::ItemRotationChange,
QGraphicsItem::ItemRotationHasChanged,
QGraphicsItem::ItemScaleChange,
QGraphicsItem::ItemScaleHasChanged,
QGraphicsItem::ItemTransformOriginPointChange,
QGraphicsItem::ItemTransformOriginPointHasChanged};
const QList<QGraphicsItem::GraphicsItemChange> expected {
QGraphicsItem::ItemOpacityChange,
QGraphicsItem::ItemOpacityHasChanged,
QGraphicsItem::ItemFlagsChange,
QGraphicsItem::ItemFlagsHaveChanged,
QGraphicsItem::ItemTransformChange,
QGraphicsItem::ItemTransformHasChanged,
QGraphicsItem::ItemPositionChange,
QGraphicsItem::ItemPositionHasChanged,
QGraphicsItem::ItemRotationChange,
QGraphicsItem::ItemRotationHasChanged,
QGraphicsItem::ItemScaleChange,
QGraphicsItem::ItemScaleHasChanged,
QGraphicsItem::ItemTransformOriginPointChange,
QGraphicsItem::ItemTransformOriginPointHasChanged
};
QCOMPARE(item.changes, expected);
}
@ -10978,7 +10980,7 @@ void tst_QGraphicsItem::focusHandling()
class TouchEventTestee : public QGraphicsRectItem
{
public:
using TouchPoints = QVector<QTouchEvent::TouchPoint>;
using TouchPoints = QList<QTouchEvent::TouchPoint>;
TouchEventTestee(const QSizeF &size = QSizeF(100, 100)) :
QGraphicsRectItem(QRectF(QPointF(), size))

View File

@ -601,7 +601,7 @@ protected:
void tst_QGraphicsLayout::constructors()
{
// Strange test, but see the fix that was with this submit
QVector<Layout*> layouts;
QList<Layout *> layouts;
for (int pass = 0; pass < 5; ++pass) {
Layout *lay = new Layout();
layouts << lay;
@ -703,8 +703,8 @@ private slots:
}
private:
QTimeLine m_timeline;
QVector<QRectF> fromGeoms;
QVector<QRectF> toGeoms;
QList<QRectF> fromGeoms;
QList<QRectF> toGeoms;
};

View File

@ -1524,10 +1524,10 @@ protected:
}
};
// ### work around missing QVector ctor from iterator pair:
static QVector<QRect> rects(const QRegion &region)
// ### work around missing QList ctor from iterator pair:
static QList<QRect> rects(const QRegion &region)
{
QVector<QRect> result;
QList<QRect> result;
for (QRect r : region)
result.push_back(r);
return result;
@ -1555,10 +1555,10 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
// QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2),
// intersected with the above update.
QCOMPARE(rects(view.paintEventRegion),
QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
QList<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
QCOMPARE(widget->npaints, 2);
QCOMPARE(rects(widget->paintEventRegion),
QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
QList<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
}
void tst_QGraphicsProxyWidget::setWidget_simple()

View File

@ -1836,7 +1836,7 @@ public:
{ }
bool ignoreMouse = false;
QVector<QEvent::Type> eventTypes;
QList<QEvent::Type> eventTypes;
protected:
bool sceneEvent(QEvent *event) override
@ -2150,7 +2150,7 @@ void tst_QGraphicsScene::mouseEventPropagation_doubleclick()
class Scene : public QGraphicsScene
{
public:
QVector<QPointF> mouseMovePoints;
QList<QPointF> mouseMovePoints;
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
@ -3897,20 +3897,16 @@ void tst_QGraphicsScene::dispatchHoverOnPress()
me2.setButton(Qt::LeftButton);
QCoreApplication::sendEvent(&scene, &me);
QCoreApplication::sendEvent(&scene, &me2);
QCOMPARE(tester1->eventTypes, QVector<QEvent::Type>()
<< QEvent::GraphicsSceneHoverEnter
<< QEvent::GraphicsSceneHoverMove
<< QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress
<< QEvent::UngrabMouse);
QCOMPARE(tester1->eventTypes,
QList<QEvent::Type>() << QEvent::GraphicsSceneHoverEnter
<< QEvent::GraphicsSceneHoverMove << QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress << QEvent::UngrabMouse);
tester1->eventTypes.clear();
QCoreApplication::sendEvent(&scene, &me);
QCoreApplication::sendEvent(&scene, &me2);
QCOMPARE(tester1->eventTypes, QVector<QEvent::Type>()
<< QEvent::GraphicsSceneHoverMove
<< QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress
<< QEvent::UngrabMouse);
QCOMPARE(tester1->eventTypes,
QList<QEvent::Type>() << QEvent::GraphicsSceneHoverMove << QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress << QEvent::UngrabMouse);
}
{
QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
@ -3924,22 +3920,17 @@ void tst_QGraphicsScene::dispatchHoverOnPress()
QCoreApplication::sendEvent(&scene, &me);
QCoreApplication::sendEvent(&scene, &me2);
qCDebug(lcTests) << tester1->eventTypes;
QCOMPARE(tester1->eventTypes, QVector<QEvent::Type>()
<< QEvent::GraphicsSceneHoverLeave);
QCOMPARE(tester2->eventTypes, QVector<QEvent::Type>()
<< QEvent::GraphicsSceneHoverEnter
<< QEvent::GraphicsSceneHoverMove
<< QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress
<< QEvent::UngrabMouse);
QCOMPARE(tester1->eventTypes, QList<QEvent::Type>() << QEvent::GraphicsSceneHoverLeave);
QCOMPARE(tester2->eventTypes,
QList<QEvent::Type>() << QEvent::GraphicsSceneHoverEnter
<< QEvent::GraphicsSceneHoverMove << QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress << QEvent::UngrabMouse);
tester2->eventTypes.clear();
QCoreApplication::sendEvent(&scene, &me);
QCoreApplication::sendEvent(&scene, &me2);
QCOMPARE(tester2->eventTypes, QVector<QEvent::Type>()
<< QEvent::GraphicsSceneHoverMove
<< QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress
<< QEvent::UngrabMouse);
QCOMPARE(tester2->eventTypes,
QList<QEvent::Type>() << QEvent::GraphicsSceneHoverMove << QEvent::GrabMouse
<< QEvent::GraphicsSceneMousePress << QEvent::UngrabMouse);
}
}

View File

@ -1873,51 +1873,58 @@ Q_DECLARE_METATYPE(Inst)
void tst_QGraphicsWidget::setSizes_data()
{
QTest::addColumn<QVector<Inst> >("inputInstructions");
QTest::addColumn<QVector<Inst> >("compareInstructions");
QTest::newRow("minSize1") << (QVector<Inst>() << Inst(Size, QSize(25, 25)) << Inst(MinimumSize, QSize(10, 10)))
<< (QVector<Inst>() << Inst(Size, QSize(25,25)));
QTest::newRow("minSize2") << (QVector<Inst>() << Inst(Size, QSizeF(20, 20)) << Inst(MinimumSize, QSizeF(25, 25)))
<< (QVector<Inst>() << Inst(Size, QSizeF(25, 25)));
QTest::newRow("minWidth1") << (QVector<Inst>() << Inst(Size, QSizeF(20, 20)) << Inst(MinimumWidth, 5.0))
<< (QVector<Inst>() << Inst(Size, QSizeF(20, 20)));
QTest::newRow("minWidth2") << (QVector<Inst>() << Inst(Size, QSizeF(20, 20)) << Inst(MinimumWidth, 25.0))
<< (QVector<Inst>() << Inst(Size, QSizeF(25, 20)));
QTest::newRow("minHeight1") << (QVector<Inst>() << Inst(Size, QSizeF(20, 20)) << Inst(MinimumHeight, 5.0))
<< (QVector<Inst>() << Inst(Size, QSizeF(20, 20)));
QTest::newRow("minHeight2") << (QVector<Inst>() << Inst(Size, QSizeF(20, 20)) << Inst(MinimumHeight, 25.0))
<< (QVector<Inst>() << Inst(Size, QSizeF(20, 25)));
QTest::newRow("maxSize1") << (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumSize, QSizeF(30, 30)))
<< (QVector<Inst>() << Inst(Size, QSizeF(30, 30)));
QTest::newRow("maxSize2") << (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumSize, QSizeF(30, -1)))
<< (QVector<Inst>() << Inst(Size, QSizeF(30, 40)));
QTest::newRow("maxSize3") << (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumSize, QSizeF(-1, 30)))
<< (QVector<Inst>() << Inst(Size, QSizeF(40, 30)));
QTest::newRow("maxWidth1")<< (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumWidth, 30))
<< (QVector<Inst>() << Inst(Size, QSizeF(30, 40)));
QTest::newRow("maxHeight")<< (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumHeight, 20))
<< (QVector<Inst>() << Inst(Size, QSizeF(40, 20)));
QTest::newRow("unsetMinSize")<< (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MinimumSize, QSizeF(-1, -1)))
<< (QVector<Inst>() << Inst(MinimumSize, QSizeF(5, 5)));
QTest::newRow("unsetMaxSize")<< (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumSize, QSizeF(-1, -1)))
<< (QVector<Inst>() << Inst(MaximumSize, QSizeF(500, 500)));
QTest::newRow("unsetMinSize, expand size to minimumSizeHint") << (QVector<Inst>()
<< Inst(MinimumSize, QSize(0, 0))
<< Inst(Size, QSize(1,1))
<< Inst(MinimumSize, QSize(-1.0, -1.0))
)
<< (QVector<Inst>()
<< Inst(Size, QSize(5,5))
<< Inst(MinimumSize, QSize(5,5))
);
QTest::addColumn<QList<Inst>>("inputInstructions");
QTest::addColumn<QList<Inst>>("compareInstructions");
QTest::newRow("minSize1") << (QList<Inst>()
<< Inst(Size, QSize(25, 25)) << Inst(MinimumSize, QSize(10, 10)))
<< (QList<Inst>() << Inst(Size, QSize(25, 25)));
QTest::newRow("minSize2") << (QList<Inst>() << Inst(Size, QSizeF(20, 20))
<< Inst(MinimumSize, QSizeF(25, 25)))
<< (QList<Inst>() << Inst(Size, QSizeF(25, 25)));
QTest::newRow("minWidth1") << (QList<Inst>()
<< Inst(Size, QSizeF(20, 20)) << Inst(MinimumWidth, 5.0))
<< (QList<Inst>() << Inst(Size, QSizeF(20, 20)));
QTest::newRow("minWidth2") << (QList<Inst>()
<< Inst(Size, QSizeF(20, 20)) << Inst(MinimumWidth, 25.0))
<< (QList<Inst>() << Inst(Size, QSizeF(25, 20)));
QTest::newRow("minHeight1") << (QList<Inst>()
<< Inst(Size, QSizeF(20, 20)) << Inst(MinimumHeight, 5.0))
<< (QList<Inst>() << Inst(Size, QSizeF(20, 20)));
QTest::newRow("minHeight2") << (QList<Inst>()
<< Inst(Size, QSizeF(20, 20)) << Inst(MinimumHeight, 25.0))
<< (QList<Inst>() << Inst(Size, QSizeF(20, 25)));
QTest::newRow("maxSize1") << (QList<Inst>() << Inst(Size, QSizeF(40, 40))
<< Inst(MaximumSize, QSizeF(30, 30)))
<< (QList<Inst>() << Inst(Size, QSizeF(30, 30)));
QTest::newRow("maxSize2") << (QList<Inst>() << Inst(Size, QSizeF(40, 40))
<< Inst(MaximumSize, QSizeF(30, -1)))
<< (QList<Inst>() << Inst(Size, QSizeF(30, 40)));
QTest::newRow("maxSize3") << (QList<Inst>() << Inst(Size, QSizeF(40, 40))
<< Inst(MaximumSize, QSizeF(-1, 30)))
<< (QList<Inst>() << Inst(Size, QSizeF(40, 30)));
QTest::newRow("maxWidth1") << (QList<Inst>()
<< Inst(Size, QSizeF(40, 40)) << Inst(MaximumWidth, 30))
<< (QList<Inst>() << Inst(Size, QSizeF(30, 40)));
QTest::newRow("maxHeight") << (QList<Inst>()
<< Inst(Size, QSizeF(40, 40)) << Inst(MaximumHeight, 20))
<< (QList<Inst>() << Inst(Size, QSizeF(40, 20)));
QTest::newRow("unsetMinSize") << (QList<Inst>() << Inst(Size, QSizeF(40, 40))
<< Inst(MinimumSize, QSizeF(-1, -1)))
<< (QList<Inst>() << Inst(MinimumSize, QSizeF(5, 5)));
QTest::newRow("unsetMaxSize") << (QList<Inst>() << Inst(Size, QSizeF(40, 40))
<< Inst(MaximumSize, QSizeF(-1, -1)))
<< (QList<Inst>() << Inst(MaximumSize, QSizeF(500, 500)));
QTest::newRow("unsetMinSize, expand size to minimumSizeHint")
<< (QList<Inst>() << Inst(MinimumSize, QSize(0, 0)) << Inst(Size, QSize(1, 1))
<< Inst(MinimumSize, QSize(-1.0, -1.0)))
<< (QList<Inst>() << Inst(Size, QSize(5, 5)) << Inst(MinimumSize, QSize(5, 5)));
}
void tst_QGraphicsWidget::setSizes()
{
QFETCH(QVector<Inst>, inputInstructions);
QFETCH(QVector<Inst>, compareInstructions);
QFETCH(QList<Inst>, inputInstructions);
QFETCH(QList<Inst>, compareInstructions);
QGraphicsScene scene;
QGraphicsView view(&scene);

View File

@ -56,7 +56,7 @@
Q_DECLARE_METATYPE(Qt::ItemFlags);
using namespace QTestPrivate;
using IntList = QVector<int>;
using IntList = QList<int>;
// Move cursor out of widget area to avoid undesired interaction on Mac.
static inline void moveCursorAway(const QWidget *topLevel)
@ -305,7 +305,7 @@ void tst_QAbstractItemView::emptyModels_data()
{
QTest::addColumn<QByteArray>("viewType");
const QVector<QByteArray> widgets{ "QListView", "QTreeView", "QTableView", "QHeaderView" };
const QList<QByteArray> widgets { "QListView", "QTreeView", "QTableView", "QHeaderView" };
for (const QByteArray &widget : widgets)
QTest::newRow(widget) << widget;
}
@ -1059,7 +1059,7 @@ void tst_QAbstractItemView::setCurrentIndex_data()
QTest::addColumn<Qt::ItemFlags>("itemFlags");
QTest::addColumn<bool>("result");
const QVector<QByteArray> widgets{ "QListView", "QTreeView", "QTableView", "QHeaderView" };
const QList<QByteArray> widgets { "QListView", "QTreeView", "QTableView", "QHeaderView" };
for (const QByteArray &widget : widgets) {
QTest::newRow(widget + ": no flags")
<< widget << Qt::ItemFlags(Qt::NoItemFlags) << false;
@ -1117,49 +1117,45 @@ void tst_QAbstractItemView::checkIntersectedRect_data()
return model;
};
QTest::addColumn<QStandardItemModel *>("model");
QTest::addColumn<QVector<QModelIndex>>("changedIndexes");
QTest::addColumn<QList<QModelIndex>>("changedIndexes");
QTest::addColumn<bool>("isEmpty");
{
auto model = createModel(5);
QTest::newRow("multiple columns") << model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(0, 1)})
<< false;
QTest::newRow("multiple columns")
<< model << QList<QModelIndex>({ model->index(0, 0), model->index(0, 1) }) << false;
}
{
auto model = createModel(5);
QTest::newRow("multiple rows") << model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(1, 0),
model->index(2, 0)})
<< false;
QTest::newRow("multiple rows")
<< model
<< QList<QModelIndex>(
{ model->index(0, 0), model->index(1, 0), model->index(2, 0) })
<< false;
}
{
auto model = createModel(5);
QTest::newRow("hidden rows") << model
<< QVector<QModelIndex>({model->index(3, 0),
model->index(4, 0)})
<< true;
QTest::newRow("hidden rows")
<< model << QList<QModelIndex>({ model->index(3, 0), model->index(4, 0) }) << true;
}
{
auto model = createModel(500);
QTest::newRow("rows outside viewport") << model
<< QVector<QModelIndex>({model->index(498, 0),
model->index(499, 0)})
<< true;
QTest::newRow("rows outside viewport")
<< model << QList<QModelIndex>({ model->index(498, 0), model->index(499, 0) })
<< true;
}
}
void tst_QAbstractItemView::checkIntersectedRect()
{
QFETCH(QStandardItemModel *, model);
QFETCH(const QVector<QModelIndex>, changedIndexes);
QFETCH(const QList<QModelIndex>, changedIndexes);
QFETCH(bool, isEmpty);
class TableView : public QTableView
{
public:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles = QList<int>()) override
{
QTableView::dataChanged(topLeft, bottomRight, roles);
// we want to check the base class implementation here!
@ -2337,7 +2333,7 @@ void tst_QAbstractItemView::inputMethodEnabled_data()
QTest::addColumn<Qt::ItemFlags>("itemFlags");
QTest::addColumn<bool>("result");
const QVector<QByteArray> widgets{ "QListView", "QTreeView", "QTableView" };
const QList<QByteArray> widgets { "QListView", "QTreeView", "QTableView" };
for (const QByteArray &widget : widgets) {
QTest::newRow(widget + ": no flags")
<< widget << Qt::ItemFlags(Qt::NoItemFlags) << false;
@ -2434,7 +2430,7 @@ void tst_QAbstractItemView::currentFollowsIndexWidget_data()
{
QTest::addColumn<QByteArray>("viewType");
const QVector<QByteArray> widgets{ "QListView", "QTreeView", "QTableView" };
const QList<QByteArray> widgets { "QListView", "QTreeView", "QTableView" };
for (const QByteArray &widget : widgets)
QTest::newRow(widget) << widget;
}

View File

@ -134,7 +134,7 @@ public:
friend class tst_QColumnView;
QVector<QPointer<QAbstractItemView>> createdColumns;
QList<QPointer<QAbstractItemView>> createdColumns;
protected:
QAbstractItemView *createColumn(const QModelIndex &index) override

View File

@ -38,9 +38,9 @@
#include <QTreeWidget>
#include <QtWidgets/private/qheaderview_p.h>
using BoolList = QVector<bool>;
using IntList = QVector<int>;
using ResizeVec = QVector<QHeaderView::ResizeMode>;
using BoolList = QList<bool>;
using IntList = QList<int>;
using ResizeVec = QList<QHeaderView::ResizeMode>;
class TestStyle : public QProxyStyle
{

View File

@ -569,8 +569,10 @@ void walkIndex(const QModelIndex &index, const QAbstractItemView *view)
if (width == 0 || height == 0)
return;
const auto widths = (width < 2) ? QVector<int>({ 0, 1 }) : QVector<int>({ 0, 1, width / 2, width - 2, width - 1 });
const auto heights = (height < 2) ? QVector<int>({ 0, 1 }) : QVector<int>({ 0, 1, height / 2, height - 2, height - 1 });
const auto widths = (width < 2) ? QList<int>({ 0, 1 })
: QList<int>({ 0, 1, width / 2, width - 2, width - 1 });
const auto heights = (height < 2) ? QList<int>({ 0, 1 })
: QList<int>({ 0, 1, height / 2, height - 2, height - 1 });
for (int w : widths)
{
for (int h : heights)

View File

@ -62,7 +62,7 @@ static inline HWND getHWNDForWidget(const QWidget *widget)
Q_DECLARE_METATYPE(QAbstractItemView::ScrollMode)
Q_DECLARE_METATYPE(QMargins)
Q_DECLARE_METATYPE(QSize)
using IntList = QVector<int>;
using IntList = QList<int>;
static QStringList generateList(const QString &prefix, int size)
{

View File

@ -35,7 +35,7 @@
#include <QTest>
#include <private/qlistwidget_p.h>
using IntList = QVector<int>;
using IntList = QList<int>;
class tst_QListWidget : public QObject
{
@ -154,9 +154,9 @@ protected slots:
private:
QListWidget *testWidget = nullptr;
QVector<QModelIndex> rcParent{8};
QVector<int> rcFirst = QVector<int>(8, 0);
QVector<int> rcLast = QVector<int>(8, 0);
QList<QModelIndex> rcParent { 8 };
QList<int> rcFirst = QList<int>(8, 0);
QList<int> rcLast = QList<int>(8, 0);
void populate();
void checkDefaultValues();
@ -1062,7 +1062,7 @@ void tst_QListWidget::sortItems()
}
QAbstractItemModel *model = testWidget->model();
QVector<QPersistentModelIndex> persistent;
QList<QPersistentModelIndex> persistent;
for (int j = 0; j < model->rowCount(QModelIndex()); ++j)
persistent << model->index(j, 0, QModelIndex());
@ -1129,7 +1129,7 @@ void tst_QListWidget::sortHiddenItems()
tw->addItems(initialList);
QAbstractItemModel *model = tw->model();
QVector<QPersistentModelIndex> persistent;
QList<QPersistentModelIndex> persistent;
for (int j = 0; j < model->rowCount(QModelIndex()); ++j) {
persistent << model->index(j, 0, QModelIndex());
tw->setRowHidden(j, j & 1); // every odd is hidden
@ -1479,12 +1479,13 @@ class QListWidgetDataChanged : public QListWidget
public:
using QListWidget::QListWidget;
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles) override
{
QListWidget::dataChanged(topLeft, bottomRight, roles);
currentRoles = roles;
}
QVector<int> currentRoles;
QList<int> currentRoles;
};
void tst_QListWidget::itemData()
@ -1493,13 +1494,13 @@ void tst_QListWidget::itemData()
QListWidgetItem item(&widget);
item.setFlags(item.flags() | Qt::ItemIsEditable);
item.setData(Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
QCOMPARE(widget.currentRoles, QList<int>({ Qt::DisplayRole, Qt::EditRole }));
item.setData(Qt::CheckStateRole, Qt::PartiallyChecked);
QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
QCOMPARE(widget.currentRoles, QList<int> { Qt::CheckStateRole });
for (int i = 0; i < 4; ++i)
{
item.setData(Qt::UserRole + i, QString::number(i + 1));
QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
QCOMPARE(widget.currentRoles, QList<int> { Qt::UserRole + i });
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
@ -1537,7 +1538,7 @@ void tst_QListWidget::changeDataWithSorting()
w.addItems(initialItems);
QAbstractItemModel *model = w.model();
QVector<QPersistentModelIndex> persistent;
QList<QPersistentModelIndex> persistent;
for (int j = 0; j < model->rowCount(QModelIndex()); ++j)
persistent << model->index(j, 0, QModelIndex());
@ -1859,7 +1860,7 @@ void tst_QListWidget::clearItemData()
const QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst();
QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), list.model()->index(0, 0));
QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), list.model()->index(0, 0));
QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty());
QVERIFY(dataChangeArgs.at(2).value<QList<int>>().isEmpty());
QVERIFY(list.model()->clearItemData(list.model()->index(0, 0)));
QCOMPARE(dataChangeSpy.size(), 0);
}

View File

@ -57,10 +57,10 @@ using namespace QTestPrivate;
Q_DECLARE_METATYPE(Qt::Key);
Q_DECLARE_METATYPE(Qt::KeyboardModifier);
Q_DECLARE_METATYPE(QItemSelectionModel::SelectionFlag);
using BoolList = QVector<bool>;
using IntList = QVector<int>;
using KeyList = QVector<Qt::Key>;
using SpanList = QVector<QRect>;
using BoolList = QList<bool>;
using IntList = QList<int>;
using KeyList = QList<Qt::Key>;
using SpanList = QList<QRect>;
class QtTestTableModel: public QAbstractTableModel
{
@ -243,7 +243,8 @@ public:
verticalHeader()->setMinimumSectionSize(0);
}
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles = QList<int>()) override
{
QTableView::dataChanged(topLeft, bottomRight, roles);
QTableViewPrivate *av = static_cast<QTableViewPrivate*>(qt_widget_private(this));
@ -296,7 +297,7 @@ class tst_QTableView : public QObject
Q_OBJECT
private:
using CursorActionList = QVector<QtTestTableView::CursorAction>;
using CursorActionList = QList<QtTestTableView::CursorAction>;
private slots:
void getSetCheck();
@ -3841,7 +3842,7 @@ void tst_QTableView::setCurrentIndex()
void tst_QTableView::checkIntersectedRect_data()
{
QTest::addColumn<QtTestTableModel *>("model");
QTest::addColumn<QVector<QModelIndex>>("changedIndexes");
QTest::addColumn<QList<QModelIndex>>("changedIndexes");
QTest::addColumn<bool>("isEmpty");
QTest::addColumn<bool>("swapFirstAndLastIndexRow"); // for QHeaderView::sectionsMoved()
QTest::addColumn<bool>("swapFirstAndLastIndexColumn"); // for QHeaderView::sectionsMoved()
@ -3863,35 +3864,28 @@ void tst_QTableView::checkIntersectedRect_data()
{
QtTestTableModel *model = new QtTestTableModel(10, 3);
QTest::newRow(testName("multiple columns", dir, swapRow, swapColumn).data())
<< model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(0, 1)})
<< false << swapRow << swapColumn << dir << -1 << -1;
<< model << QList<QModelIndex>({ model->index(0, 0), model->index(0, 1) })
<< false << swapRow << swapColumn << dir << -1 << -1;
}
{
QtTestTableModel *model = new QtTestTableModel(10, 3);
QTest::newRow(testName("multiple rows", dir, swapRow, swapColumn).data())
<< model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(1, 0),
model->index(2, 0)})
<< false << swapRow << swapColumn << dir << -1 << -1;
<< model
<< QList<QModelIndex>(
{ model->index(0, 0), model->index(1, 0), model->index(2, 0) })
<< false << swapRow << swapColumn << dir << -1 << -1;
}
{
QtTestTableModel *model = new QtTestTableModel(10, 3);
QTest::newRow(testName("hidden row", dir, swapRow, swapColumn).data())
<< model
<< QVector<QModelIndex>({model->index(3, 0),
model->index(3, 1)})
<< true << swapRow << swapColumn << dir << 3 << -1;
<< model << QList<QModelIndex>({ model->index(3, 0), model->index(3, 1) })
<< true << swapRow << swapColumn << dir << 3 << -1;
}
{
QtTestTableModel *model = new QtTestTableModel(50, 2);
QTest::newRow(testName("row outside viewport", dir, swapRow, swapColumn).data())
<< model
<< QVector<QModelIndex>({model->index(49, 0),
model->index(49, 1)})
<< true << swapRow << swapColumn << dir << -1 << -1;
<< model << QList<QModelIndex>({ model->index(49, 0), model->index(49, 1) })
<< true << swapRow << swapColumn << dir << -1 << -1;
}
}
}
@ -3900,7 +3894,7 @@ void tst_QTableView::checkIntersectedRect_data()
void tst_QTableView::checkIntersectedRect()
{
QFETCH(QtTestTableModel *, model);
QFETCH(const QVector<QModelIndex>, changedIndexes);
QFETCH(const QList<QModelIndex>, changedIndexes);
QFETCH(bool, isEmpty);
QFETCH(bool, swapFirstAndLastIndexRow);
QFETCH(bool, swapFirstAndLastIndexColumn);

View File

@ -97,8 +97,8 @@ private:
};
using IntPair = QPair<int, int>;
using IntList = QVector<int>;
using IntIntList = QVector<IntPair>;
using IntList = QList<int>;
using IntIntList = QList<IntPair>;
Q_DECLARE_METATYPE(QTableWidgetSelectionRange)
@ -1118,7 +1118,7 @@ void tst_QTableWidget::sortItems()
testWidget->setColumnCount(columnCount);
QAbstractItemModel *model = testWidget->model();
QVector<QPersistentModelIndex> persistent;
QList<QPersistentModelIndex> persistent;
int ti = 0;
for (int r = 0; r < rowCount; ++r) {
@ -1300,7 +1300,7 @@ void tst_QTableWidget::setItemWithSorting()
QTableWidget w(rowCount, columnCount);
QAbstractItemModel *model = w.model();
QVector<QPersistentModelIndex> persistent;
QList<QPersistentModelIndex> persistent;
int ti = 0;
for (int r = 0; r < rowCount; ++r) {
@ -1356,12 +1356,13 @@ class QTableWidgetDataChanged : public QTableWidget
public:
using QTableWidget::QTableWidget;
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles) override
{
QTableWidget::dataChanged(topLeft, bottomRight, roles);
currentRoles = roles;
}
QVector<int> currentRoles;
QList<int> currentRoles;
};
void tst_QTableWidget::itemData()
@ -1372,13 +1373,13 @@ void tst_QTableWidget::itemData()
QVERIFY(item);
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setData(Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
QCOMPARE(widget.currentRoles, QList<int>({ Qt::DisplayRole, Qt::EditRole }));
item->setData(Qt::CheckStateRole, Qt::PartiallyChecked);
QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
QCOMPARE(widget.currentRoles, QList<int> { Qt::CheckStateRole });
for (int i = 0; i < 4; ++i)
{
item->setData(Qt::UserRole + i, QString::number(i + 1));
QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
QCOMPARE(widget.currentRoles, QList<int> { Qt::UserRole + i });
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
@ -1401,7 +1402,7 @@ void tst_QTableWidget::setItemData()
data.insert(Qt::DisplayRole, QLatin1String("Display"));
data.insert(Qt::ToolTipRole, QLatin1String("ToolTip"));
table.model()->setItemData(idx, data);
QCOMPARE(table.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole, Qt::ToolTipRole}));
QCOMPARE(table.currentRoles, QList<int>({ Qt::DisplayRole, Qt::EditRole, Qt::ToolTipRole }));
QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("Display"));
QCOMPARE(table.model()->data(idx, Qt::EditRole).toString(), QLatin1String("Display"));
@ -1409,7 +1410,7 @@ void tst_QTableWidget::setItemData()
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(idx, qvariant_cast<QModelIndex>(dataChangedSpy.first().at(0)));
QCOMPARE(idx, qvariant_cast<QModelIndex>(dataChangedSpy.first().at(1)));
const auto roles = qvariant_cast<QVector<int>>(dataChangedSpy.first().at(2));
const auto roles = qvariant_cast<QList<int>>(dataChangedSpy.first().at(2));
QCOMPARE(roles.size(), 3);
QVERIFY(roles.contains(Qt::DisplayRole));
QVERIFY(roles.contains(Qt::EditRole));
@ -1424,7 +1425,8 @@ void tst_QTableWidget::setItemData()
table.model()->setItemData(idx, data);
QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("dizplaye"));
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(QVector<int>({Qt::DisplayRole, Qt::EditRole}), qvariant_cast<QVector<int>>(dataChangedSpy.first().at(2)));
QCOMPARE(QList<int>({ Qt::DisplayRole, Qt::EditRole }),
qvariant_cast<QList<int>>(dataChangedSpy.first().at(2)));
item->setBackground(QBrush(Qt::red));
item->setForeground(QBrush(Qt::green));
@ -1697,8 +1699,7 @@ void tst_QTableWidget::search()
return item;
};
auto checkSeries = [](TestTableWidget &tw, const QVector<QPair<QKeyEvent, int>> &series)
{
auto checkSeries = [](TestTableWidget &tw, const QList<QPair<QKeyEvent, int>> &series) {
for (const auto &p : series) {
QKeyEvent e = p.first;
tw.keyPressEvent(&e);
@ -1745,7 +1746,7 @@ void tst_QTableWidget::clearItemData()
const QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst();
QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), table.model()->index(0, 0));
QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), table.model()->index(0, 0));
QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty());
QVERIFY(dataChangeArgs.at(2).value<QList<int>>().isEmpty());
QVERIFY(table.model()->clearItemData(table.model()->index(0, 0)));
QCOMPARE(dataChangeSpy.size(), 0);
}

View File

@ -88,7 +88,8 @@ public:
QTreeView::paintEvent(event);
wasPainted = true;
}
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles = QList<int>()) override
{
QTreeView::dataChanged(topLeft, bottomRight, roles);
QTreeViewPrivate *av = static_cast<QTreeViewPrivate*>(qt_widget_private(this));
@ -1998,7 +1999,7 @@ public:
{ return QSize(200, 50); }
};
typedef QVector<QPoint> PointList;
typedef QList<QPoint> PointList;
void tst_QTreeView::setSelection_data()
{
@ -2898,8 +2899,8 @@ public:
}
}
QVector<Node *> children;
QVector<Node *> deadChildren;
QList<Node *> children;
QList<Node *> deadChildren;
Node *parent;
bool isDead = false;
};
@ -2923,7 +2924,7 @@ public:
{
emit layoutAboutToBeChanged();
QModelIndexList oldList = persistentIndexList();
QVector<QStack<int>> oldListPath;
QList<QStack<int>> oldListPath;
for (int i = 0; i < oldList.count(); ++i) {
QModelIndex idx = oldList.at(i);
QStack<int> path;
@ -4861,59 +4862,54 @@ void tst_QTreeView::checkIntersectedRect_data()
return model;
};
QTest::addColumn<QStandardItemModel *>("model");
QTest::addColumn<QVector<QModelIndex>>("changedIndexes");
QTest::addColumn<QList<QModelIndex>>("changedIndexes");
QTest::addColumn<bool>("isEmpty");
{
auto model = createModel(5);
QTest::newRow("multiple columns") << model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(0, 1)})
<< false;
QTest::newRow("multiple columns")
<< model << QList<QModelIndex>({ model->index(0, 0), model->index(0, 1) }) << false;
}
{
auto model = createModel(5);
QTest::newRow("multiple rows") << model
<< QVector<QModelIndex>({model->index(0, 0),
model->index(1, 0),
model->index(2, 0)})
<< false;
QTest::newRow("multiple rows")
<< model
<< QList<QModelIndex>(
{ model->index(0, 0), model->index(1, 0), model->index(2, 0) })
<< false;
}
{
auto model = createModel(5);
const QModelIndex idxRow2(model->indexFromItem(model->item(2)));
QTest::newRow("child row") << model
<< QVector<QModelIndex>({model->index(0, 0, idxRow2),
model->index(0, 1, idxRow2)})
<< false;
QTest::newRow("child row")
<< model
<< QList<QModelIndex>({ model->index(0, 0, idxRow2), model->index(0, 1, idxRow2) })
<< false;
}
{
auto model = createModel(5);
QTest::newRow("hidden row") << model
<< QVector<QModelIndex>({model->index(3, 0),
model->index(3, 1)})
<< true;
QTest::newRow("hidden row")
<< model << QList<QModelIndex>({ model->index(3, 0), model->index(3, 1) }) << true;
}
{
auto model = createModel(5);
const QModelIndex idxRow3(model->indexFromItem(model->item(3)));
QTest::newRow("hidden child row") << model
<< QVector<QModelIndex>({model->index(0, 0, idxRow3),
model->index(0, 1, idxRow3)})
<< true;
QTest::newRow("hidden child row")
<< model
<< QList<QModelIndex>({ model->index(0, 0, idxRow3), model->index(0, 1, idxRow3) })
<< true;
}
{
auto model = createModel(50);
QTest::newRow("row outside viewport") << model
<< QVector<QModelIndex>({model->index(49, 0),
model->index(49, 1)})
<< true;
QTest::newRow("row outside viewport")
<< model << QList<QModelIndex>({ model->index(49, 0), model->index(49, 1) })
<< true;
}
}
void tst_QTreeView::checkIntersectedRect()
{
QFETCH(QStandardItemModel *, model);
QFETCH(const QVector<QModelIndex>, changedIndexes);
QFETCH(const QList<QModelIndex>, changedIndexes);
QFETCH(bool, isEmpty);
TreeView view;

View File

@ -218,11 +218,11 @@ void tst_QTreeWidget::getSetCheck()
QCOMPARE(obj1.currentItem(), nullptr);
}
using IntList = QVector<int>;
using ListIntList = QVector<IntList>;
using PersistentModelIndexVec = QVector<QPersistentModelIndex>;
using IntList = QList<int>;
using ListIntList = QList<IntList>;
using PersistentModelIndexVec = QList<QPersistentModelIndex>;
using TreeItem = QTreeWidgetItem;
using TreeItemList = QVector<TreeItem*>;
using TreeItemList = QList<TreeItem *>;
Q_DECLARE_METATYPE(Qt::Orientation)
Q_DECLARE_METATYPE(QTreeWidgetItem*)
@ -1466,19 +1466,15 @@ void tst_QTreeWidget::keyboardNavigation()
fillTreeWidget(testWidget, rows);
const QVector<Qt::Key> keymoves {
Qt::Key_Down, Qt::Key_Right, Qt::Key_Left,
Qt::Key_Down, Qt::Key_Down, Qt::Key_Down, Qt::Key_Down,
Qt::Key_Right,
Qt::Key_Up, Qt::Key_Left, Qt::Key_Left,
Qt::Key_Up, Qt::Key_Down, Qt::Key_Up, Qt::Key_Up,
Qt::Key_Up, Qt::Key_Up, Qt::Key_Up, Qt::Key_Up,
Qt::Key_Down, Qt::Key_Right, Qt::Key_Down, Qt::Key_Down,
Qt::Key_Down, Qt::Key_Right, Qt::Key_Down, Qt::Key_Down,
Qt::Key_Left, Qt::Key_Left, Qt::Key_Up, Qt::Key_Down,
Qt::Key_Up, Qt::Key_Up, Qt::Key_Up, Qt::Key_Left,
Qt::Key_Down, Qt::Key_Right, Qt::Key_Right, Qt::Key_Right,
Qt::Key_Left, Qt::Key_Left, Qt::Key_Right, Qt::Key_Left
const QList<Qt::Key> keymoves {
Qt::Key_Down, Qt::Key_Right, Qt::Key_Left, Qt::Key_Down, Qt::Key_Down, Qt::Key_Down,
Qt::Key_Down, Qt::Key_Right, Qt::Key_Up, Qt::Key_Left, Qt::Key_Left, Qt::Key_Up,
Qt::Key_Down, Qt::Key_Up, Qt::Key_Up, Qt::Key_Up, Qt::Key_Up, Qt::Key_Up,
Qt::Key_Up, Qt::Key_Down, Qt::Key_Right, Qt::Key_Down, Qt::Key_Down, Qt::Key_Down,
Qt::Key_Right, Qt::Key_Down, Qt::Key_Down, Qt::Key_Left, Qt::Key_Left, Qt::Key_Up,
Qt::Key_Down, Qt::Key_Up, Qt::Key_Up, Qt::Key_Up, Qt::Key_Left, Qt::Key_Down,
Qt::Key_Right, Qt::Key_Right, Qt::Key_Right, Qt::Key_Left, Qt::Key_Left, Qt::Key_Right,
Qt::Key_Left
};
int row = 0;
@ -1957,12 +1953,13 @@ class QTreeWidgetDataChanged : public QTreeWidget
public:
using QTreeWidget::QTreeWidget;
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles) override
{
QTreeWidget::dataChanged(topLeft, bottomRight, roles);
currentRoles = roles;
}
QVector<int> currentRoles;
QList<int> currentRoles;
};
void tst_QTreeWidget::itemData()
@ -1972,12 +1969,12 @@ void tst_QTreeWidget::itemData()
widget.setColumnCount(2);
item.setFlags(item.flags() | Qt::ItemIsEditable);
item.setData(0, Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
QCOMPARE(widget.currentRoles, QList<int>({ Qt::DisplayRole, Qt::EditRole }));
item.setData(0, Qt::CheckStateRole, Qt::PartiallyChecked);
QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
QCOMPARE(widget.currentRoles, QList<int> { Qt::CheckStateRole });
for (int i = 0; i < 4; ++i) {
item.setData(0, Qt::UserRole + i, QString::number(i + 1));
QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
QCOMPARE(widget.currentRoles, QList<int> { Qt::UserRole + i });
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
@ -2318,7 +2315,7 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting()
tree.setSortingEnabled(true);
// insert expanded items in unsorted order
QVector<QTreeWidgetItem *> items;
QList<QTreeWidgetItem *> items;
for (const QString &text : parentTexts) {
QTreeWidgetItem *parent = new QTreeWidgetItem(&tree, {text});
parent->setExpanded(true);
@ -2725,7 +2722,7 @@ void tst_QTreeWidget::sortedIndexOfChild()
QFETCH(const IntList, expectedIndexes);
QTreeWidget tw;
QVector<QTreeWidgetItem *> itms;
QList<QTreeWidgetItem *> itms;
auto *top = new QTreeWidgetItem(&tw, {"top"});
for (const QString &str : itemTexts)
@ -2998,7 +2995,7 @@ protected:
}
private:
int timerId;
QVector<QTreeWidgetItem*> m_list;
QList<QTreeWidgetItem *> m_list;
};
void tst_QTreeWidget::sortAndSelect()
@ -3612,7 +3609,7 @@ void tst_QTreeWidget::clearItemData()
QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst();
QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), parentIdx);
QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), parentIdx);
QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty());
QVERIFY(dataChangeArgs.at(2).value<QList<int>>().isEmpty());
QVERIFY(model->clearItemData(parentIdx));
QCOMPARE(dataChangeSpy.size(), 0);
QVERIFY(model->clearItemData(childIdx));
@ -3621,7 +3618,7 @@ void tst_QTreeWidget::clearItemData()
dataChangeArgs = dataChangeSpy.takeFirst();
QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), childIdx);
QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), childIdx);
QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty());
QVERIFY(dataChangeArgs.at(2).value<QList<int>>().isEmpty());
}
#endif

View File

@ -33,7 +33,7 @@
#include <QtWidgets/QGestureEvent>
#include <QtGui/QScreen>
#include <QtGui/QPointingDevice>
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QHash>
#include <QtCore/QDebug>
@ -73,7 +73,7 @@ void tst_QGestureRecognizer::initTestCase()
#ifndef QT_NO_GESTURES
typedef QVector<Qt::GestureType> GestureTypeVector;
typedef QList<Qt::GestureType> GestureTypeVector;
class TestWidget : public QWidget
{
@ -126,8 +126,7 @@ bool TestWidget::event(QEvent * event)
return QWidget::event(event);
}
static void pressSequence(QTest::QTouchEventSequence &sequence,
QVector<QPoint> &points,
static void pressSequence(QTest::QTouchEventSequence &sequence, QList<QPoint> &points,
QWidget *widget)
{
const int pointCount = points.size();
@ -136,10 +135,8 @@ static void pressSequence(QTest::QTouchEventSequence &sequence,
sequence.commit();
}
static void linearSequence(int n, const QPoint &delta,
QTest::QTouchEventSequence &sequence,
QVector<QPoint> &points,
QWidget *widget)
static void linearSequence(int n, const QPoint &delta, QTest::QTouchEventSequence &sequence,
QList<QPoint> &points, QWidget *widget)
{
const int pointCount = points.size();
for (int s = 0; s < n; ++s) {
@ -151,8 +148,7 @@ static void linearSequence(int n, const QPoint &delta,
}
}
static void releaseSequence(QTest::QTouchEventSequence &sequence,
QVector<QPoint> &points,
static void releaseSequence(QTest::QTouchEventSequence &sequence, QList<QPoint> &points,
QWidget *widget)
{
const int pointCount = points.size();
@ -188,7 +184,7 @@ void tst_QGestureRecognizer::panGesture()
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVector<QPoint> points;
QList<QPoint> points;
for (int i = 0; i < panPoints; ++i)
points.append(QPoint(10 + i *20, 10 + i *20));
@ -231,7 +227,7 @@ void tst_QGestureRecognizer::pinchGesture()
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVector<QPoint> points;
QList<QPoint> points;
points.append(widget.rect().center());
points.append(points.front() + QPoint(0, 20));
@ -288,7 +284,7 @@ void tst_QGestureRecognizer::swipeGesture()
// Start a swipe sequence with 2 points (QTBUG-15768)
const QPoint fingerDistance(m_fingerDistance, m_fingerDistance);
QVector<QPoint> points;
QList<QPoint> points;
for (int i = 0; i < swipePoints - 1; ++i)
points.append(fingerDistance + i * fingerDistance);

View File

@ -140,7 +140,7 @@ void tst_QLayout::geometry()
void tst_QLayout::smartMaxSize()
{
QVector<int> expectedWidths;
QList<int> expectedWidths;
QFile f(QFINDTESTDATA("baseline/smartmaxsize"));

View File

@ -2095,9 +2095,9 @@ void tst_QWidget::tabOrderWithCompoundWidgets()
QVERIFY(lastEdit->hasFocus());
}
static QVector<QWidget*> getFocusChain(QWidget *start, bool bForward)
static QList<QWidget *> getFocusChain(QWidget *start, bool bForward)
{
QVector<QWidget*> ret;
QList<QWidget *> ret;
QWidget *cur = start;
do {
ret += cur;
@ -5130,14 +5130,14 @@ void tst_QWidget::qobject_castInDestroyedSlot()
// Since X11 WindowManager operations are all async, and we have no way to know if the window
// manager has finished playing with the window geometry, this test can't be reliable on X11.
using Rects = QVector<QRect>;
using Rects = QList<QRect>;
void tst_QWidget::setWindowGeometry_data()
{
QTest::addColumn<Rects>("rects");
QTest::addColumn<int>("windowFlags");
QVector<Rects> rects;
QList<Rects> rects;
const int width = m_testWidgetSize.width();
const int height = m_testWidgetSize.height();
const QRect availableAdjusted = QGuiApplication::primaryScreen()->availableGeometry().adjusted(100, 100, -100, -100);
@ -8344,7 +8344,7 @@ void tst_QWidget::alienWidgets()
}
}
using WidgetAttributes = QVector<Qt::WidgetAttribute>;
using WidgetAttributes = QList<Qt::WidgetAttribute>;
void tst_QWidget::nativeWindowPosition_data()
{

View File

@ -544,7 +544,7 @@ void tst_QStyle::testProxyCalled()
QPainter painter(&surface);
const QStringList keys = QStyleFactory::keys();
QVector<QStyle*> styles;
QList<QStyle *> styles;
styles.reserve(keys.size() + 1);
styles << new QCommonStyle();

View File

@ -1086,7 +1086,7 @@ void tst_QStyleSheetStyle::background()
typedef QSharedPointer<QWidget> WidgetPtr;
const QString styleSheet = QStringLiteral("* { background-color: #e8ff66; }");
QVector<WidgetPtr> widgets;
QList<WidgetPtr> widgets;
const QPoint topLeft = m_availableGeometry.topLeft();
// Testing inheritance styling of QDialog.
WidgetPtr toplevel(new SingleInheritanceDialog);
@ -1602,8 +1602,8 @@ void tst_QStyleSheetStyle::toolTip()
// including one without stylesheet (the tooltip will be reused,
// but its color must change)
const QWidgetList widgets{wid4, wid1, wid2, wid3, wid4};
const QVector<QColor> colors{normalToolTip, QColor("#ae2"), QColor("#f81"),
QColor("#0b8"), normalToolTip};
const QList<QColor> colors { normalToolTip, QColor("#ae2"), QColor("#f81"), QColor("#0b8"),
normalToolTip };
QWidgetList topLevels;
for (int i = 0; i < widgets.count() ; ++i) {

View File

@ -1371,7 +1371,7 @@ void tst_QMainWindow::restoreStateFromPreviousVersion()
QMainWindow win;
win.setCentralWidget(new QTextEdit);
QVector<QDockWidget*> docks;
QList<QDockWidget *> docks;
for(int i = 0; i < 16; ++i) {
const QString name = QStringLiteral("dock ") + QString::number(i);

View File

@ -1409,7 +1409,7 @@ void tst_QMdiArea::subWindowList()
QVERIFY(QTest::qWaitForWindowActive(&workspace));
QList<QMdiSubWindow *> activationOrder;
QVector<QMdiSubWindow *> windows;
QList<QMdiSubWindow *> windows;
for (int i = 0; i < windowCount; ++i) {
windows.append(qobject_cast<QMdiSubWindow *>(workspace.addSubWindow(new QWidget)));
windows[i]->show();

View File

@ -49,7 +49,7 @@
#include <QScreen>
#include <QSizeGrip>
#include <QVector>
#include <QList>
QT_BEGIN_NAMESPACE
extern bool qt_tab_all_widgets();
@ -401,7 +401,7 @@ void tst_QMdiSubWindow::setWindowState()
void tst_QMdiSubWindow::mainWindowSupport()
{
QVector<QMdiSubWindow *> windows;
QList<QMdiSubWindow *> windows;
QMdiArea *workspace = new QMdiArea;
QMainWindow mainWindow;
mainWindow.setCentralWidget(workspace);

View File

@ -291,8 +291,7 @@ public:
void tst_QTabBar::hideAllTabs()
{
TabBar tabbar;
auto checkPositions = [&tabbar](const QVector<int> &positions)
{
auto checkPositions = [&tabbar](const QList<int> &positions) {
QStyleOptionTab option;
int iPos = 0;
for (int i = 0; i < tabbar.count(); ++i) {