tst_QWidget::realFocusChain: don't remove from iterated QList
The method removed from QWidgetList widgets in a ranged for loop. That caused items being skipped. Create a new list by adding positives, instead of removing negatives from the original. This amends b1802a164b8682ed9e8956a5a19a90ade65c25d0. Pick-to: 6.6 Change-Id: I3f329290187ddc76169ababe8ffa6059d953212d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 086897a1ae8e8d5bb1c1c1c18375eacba9ec97a4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6d809221f2
commit
dfa4ebc150
@ -2171,13 +2171,14 @@ QWidgetList expectedFocusChain(const QList<QComboBox *> &boxes, const QList<int>
|
|||||||
|
|
||||||
QWidgetList realFocusChain(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
QWidgetList realFocusChain(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
||||||
{
|
{
|
||||||
QWidgetList widgets = getFocusChain(boxes.at(sequence.at(0)), true);
|
const QWidgetList all = getFocusChain(boxes.at(sequence.at(0)), true);
|
||||||
|
QWidgetList chain;
|
||||||
// Filter everything with NoFocus
|
// Filter everything with NoFocus
|
||||||
for (auto *widget : widgets) {
|
for (auto *widget : all) {
|
||||||
if (widget->focusPolicy() == Qt::NoFocus)
|
if (widget->focusPolicy() != Qt::NoFocus)
|
||||||
widgets.removeOne(widget);
|
chain << widget;
|
||||||
}
|
}
|
||||||
return widgets;
|
return chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTabOrder(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
void setTabOrder(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user