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 b1802a164b.
Pick-to: 6.7 6.6
Change-Id: I3f329290187ddc76169ababe8ffa6059d953212d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
parent
bfc7535a10
commit
086897a1ae
|
|
@ -2172,13 +2172,14 @@ QWidgetList expectedFocusChain(const QList<QComboBox *> &boxes, const QList<int>
|
|||
|
||||
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
|
||||
for (auto *widget : widgets) {
|
||||
if (widget->focusPolicy() == Qt::NoFocus)
|
||||
widgets.removeOne(widget);
|
||||
for (auto *widget : all) {
|
||||
if (widget->focusPolicy() != Qt::NoFocus)
|
||||
chain << widget;
|
||||
}
|
||||
return widgets;
|
||||
return chain;
|
||||
}
|
||||
|
||||
void setTabOrder(const QList<QComboBox *> &boxes, const QList<int> &sequence)
|
||||
|
|
|
|||
Loading…
Reference in New Issue