diff options
Diffstat (limited to 'src/widgets/dialogs/qwizard.cpp')
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 36327741c8..740ac1d387 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1704,16 +1704,29 @@ void QWizardPrivate::_q_updateButtonStates() void QWizardPrivate::_q_handleFieldObjectDestroyed(QObject *object) { + int destroyed_index = -1; QVector<QWizardField>::iterator it = fields.begin(); while (it != fields.end()) { const QWizardField &field = *it; if (field.object == object) { + destroyed_index = fieldIndexMap.value(field.name, -1); fieldIndexMap.remove(field.name); it = fields.erase(it); } else { ++it; } } + if (destroyed_index != -1) { + QMap<QString, int>::iterator it2 = fieldIndexMap.begin(); + while (it2 != fieldIndexMap.end()) { + int index = it2.value(); + if (index > destroyed_index) { + QString field_name = it2.key(); + fieldIndexMap.insert(field_name, index-1); + } + ++it2; + } + } } void QWizardPrivate::setStyle(QStyle *style) |