forked from qt-creator/qt-creator
Modes: Temporarily re-add a removeMode function
Partially reverts 6a142dfd95
Looks like this was used by 3rdparty plugin(s) for a mode that is only
useful for some time and then should not be shown again.
Re-add removeMode from before 5.0, but do not trigger that automatically
from the mode destructor, so it doesn't interfere at shutdown.
This patch is just a binary compatible partial revert. Since removeMode
is broken in several aspects (e.g. corresponding commands are not
removed) and we don't really support adding and removing modes during
runtime, this should be replaced later on by a different way to handle
the usecase, like a "visible" property for modes, which could be useful
in other ways too.
Fixes: QTCREATORBUG-26270
Change-Id: Ief2a36d94bd09b0511a14f528b33fdbcc4c4222b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -256,6 +256,21 @@ void ModeManagerPrivate::appendMode(IMode *mode)
|
||||
QObject::connect(mode, &IMode::enabledStateChanged, [this, mode] { enabledStateChanged(mode); });
|
||||
}
|
||||
|
||||
void ModeManager::removeMode(IMode *mode)
|
||||
{
|
||||
const int index = d->m_modes.indexOf(mode);
|
||||
if (index >= d->m_modes.size() - 1 && d->m_modes.size() > 1)
|
||||
d->m_modeStack->setCurrentIndex(d->m_modes.size() - 2);
|
||||
d->m_modes.remove(index);
|
||||
if (d->m_startingUp)
|
||||
return;
|
||||
|
||||
d->m_modeCommands.remove(index);
|
||||
d->m_modeStack->removeTab(index);
|
||||
|
||||
d->m_mainWindow->removeContextObject(mode);
|
||||
}
|
||||
|
||||
void ModeManagerPrivate::enabledStateChanged(IMode *mode)
|
||||
{
|
||||
int index = d->m_modes.indexOf(mode);
|
||||
|
||||
Reference in New Issue
Block a user