Commit ad9b6e4e authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Switch away from modes that become deactivated

Make sure any mode that gets disabled is no longer displayed.

Task-number: QTCREATORBUG-1107
Reviewed-by: con
parent af1b31d3
...@@ -218,6 +218,18 @@ void ModeManager::enabledStateChanged() ...@@ -218,6 +218,18 @@ void ModeManager::enabledStateChanged()
int index = d->m_modes.indexOf(mode); int index = d->m_modes.indexOf(mode);
QTC_ASSERT(index >= 0, return); QTC_ASSERT(index >= 0, return);
d->m_modeStack->setTabEnabled(index, mode->isEnabled()); d->m_modeStack->setTabEnabled(index, mode->isEnabled());
// Make sure we leave any disabled mode to prevent possible crashes:
if (mode == currentMode() && !mode->isEnabled()) {
// This assumes that there is always at least one enabled mode.
for (int i = 0; i < d->m_modes.count(); ++i) {
if (d->m_modes.at(i) != mode &&
d->m_modes.at(i)->isEnabled()) {
activateMode(d->m_modes.at(i)->id());
break;
}
}
}
} }
void ModeManager::aboutToRemoveObject(QObject *obj) void ModeManager::aboutToRemoveObject(QObject *obj)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment