tst_QComboBox: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const local variables. Task-number: QTBUG-115803 Change-Id: Idd6e65065ee27c2d29ce1b49607aadb2eaf5e15d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit b8881ff2806f58f6da0027470663aac790bfae73) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f10c8d3069
commit
067adfbb11
@ -2030,8 +2030,8 @@ void tst_QComboBox::flaggedItems()
|
||||
QSKIP("Wayland: This fails. Figure out why.");
|
||||
|
||||
QFETCH(QStringList, itemList);
|
||||
QFETCH(IntList, deselectFlagList);
|
||||
QFETCH(IntList, disableFlagList);
|
||||
QFETCH(const IntList, deselectFlagList);
|
||||
QFETCH(const IntList, disableFlagList);
|
||||
QFETCH(KeyList, keyMovementList);
|
||||
QFETCH(bool, editable);
|
||||
QFETCH(int, expectedIndex);
|
||||
@ -2042,10 +2042,10 @@ void tst_QComboBox::flaggedItems()
|
||||
listWidget.addItems(itemList);
|
||||
|
||||
comboBox.setEditable(editable);
|
||||
foreach (int index, deselectFlagList)
|
||||
for (int index : deselectFlagList)
|
||||
listWidget.item(index)->setFlags(listWidget.item(index)->flags() & ~Qt::ItemIsSelectable);
|
||||
|
||||
foreach (int index, disableFlagList)
|
||||
for (int index : disableFlagList)
|
||||
listWidget.item(index)->setFlags(listWidget.item(index)->flags() & ~Qt::ItemIsEnabled);
|
||||
|
||||
comboBox.setModel(listWidget.model());
|
||||
@ -2128,7 +2128,7 @@ void tst_QComboBox::mouseWheel_data()
|
||||
|
||||
void tst_QComboBox::mouseWheel()
|
||||
{
|
||||
QFETCH(IntList, disabledItems);
|
||||
QFETCH(const IntList, disabledItems);
|
||||
QFETCH(int, startIndex);
|
||||
QFETCH(int, wheelDirection);
|
||||
QFETCH(int, expectedIndex);
|
||||
@ -2143,7 +2143,7 @@ void tst_QComboBox::mouseWheel()
|
||||
QListWidget listWidget;
|
||||
listWidget.addItems(list);
|
||||
|
||||
foreach (int index, disabledItems)
|
||||
for (int index : disabledItems)
|
||||
listWidget.item(index)->setFlags(listWidget.item(index)->flags() & ~Qt::ItemIsEnabled);
|
||||
|
||||
box.setModel(listWidget.model());
|
||||
@ -2277,11 +2277,11 @@ void tst_QComboBox::separatorItem_data()
|
||||
void tst_QComboBox::separatorItem()
|
||||
{
|
||||
QFETCH(QStringList, items);
|
||||
QFETCH(IntList, separators);
|
||||
QFETCH(const IntList, separators);
|
||||
|
||||
QComboBox box;
|
||||
box.addItems(items);
|
||||
foreach(int index, separators)
|
||||
for (int index : separators)
|
||||
box.insertSeparator(index);
|
||||
QCOMPARE(box.count(), (items.size() + separators.size()));
|
||||
for (int i = 0, s = 0; i < box.count(); ++i) {
|
||||
@ -2402,7 +2402,8 @@ void tst_QComboBox::task191329_size()
|
||||
QFrame *container = tableCombo.findChild<QComboBoxPrivateContainer *>();
|
||||
QVERIFY(container);
|
||||
QCOMPARE(static_cast<QAbstractItemView *>(table), container->findChild<QAbstractItemView *>());
|
||||
foreach (QWidget *button, container->findChildren<QComboBoxPrivateScroller *>()) {
|
||||
const auto buttons = container->findChildren<QComboBoxPrivateScroller *>();
|
||||
for (QWidget *button : buttons) {
|
||||
//the popup should be large enough to contains everithing so the top and left button are hidden
|
||||
QVERIFY(!button->isVisible());
|
||||
}
|
||||
@ -3302,10 +3303,10 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated()
|
||||
QVERIFY(container);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(container));
|
||||
|
||||
QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>();
|
||||
const QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>();
|
||||
// Not all styles support scrollers. We rely only on those platforms that do to catch any regression.
|
||||
if (!scrollers.isEmpty()) {
|
||||
Q_FOREACH (QComboBoxPrivateScroller *scroller, scrollers) {
|
||||
for (QComboBoxPrivateScroller *scroller : scrollers) {
|
||||
if (scroller->isVisible()) {
|
||||
QSignalSpy doScrollSpy(scroller, SIGNAL(doScroll(int)));
|
||||
QTest::mouseMove(scroller, QPoint(5, 5), 500);
|
||||
|
Loading…
x
Reference in New Issue
Block a user