Introduce setPerspectiveEnabled

This enables us to mark perspectives as disabled.

Change-Id: I52b2434f33f8550b6d2459f915dfd8cdb1389140
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Hannah von Reth
2017-07-11 15:57:45 +02:00
parent 429163ea1e
commit ada1429594
4 changed files with 19 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
#include <QHBoxLayout>
#include <QMenu>
#include <QStackedWidget>
#include <QStandardItemModel>
#include <QToolButton>
using namespace Debugger;
@@ -142,6 +143,16 @@ void DebuggerMainWindow::onModeChanged(Core::Id mode)
}
}
void DebuggerMainWindow::setPerspectiveEnabled(const QByteArray &perspectiveId, bool enabled)
{
const int index = m_perspectiveChooser->findData(perspectiveId);
QTC_ASSERT(index != -1, return);
auto model = qobject_cast<QStandardItemModel*>(m_perspectiveChooser->model());
QTC_ASSERT(model, return);
QStandardItem *item = model->item(index, 0);
item->setFlags(enabled ? item->flags() | Qt::ItemIsEnabled : item->flags() & ~Qt::ItemIsEnabled );
}
void DebuggerMainWindow::resetCurrentPerspective()
{
loadPerspectiveHelper(m_currentPerspectiveId, false);