diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 72e21923a64..1b7681ad70a 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -301,6 +301,7 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId, QTC_ASSERT(m_perspectiveForPerspectiveId.contains(m_currentPerspectiveId), return); const Perspective *perspective = m_perspectiveForPerspectiveId.value(m_currentPerspectiveId); + perspective->aboutToActivate(); for (const Perspective::Operation &operation : perspective->operations()) { QDockWidget *dock = m_dockForDockId.value(operation.dockId); if (!dock) { @@ -405,6 +406,17 @@ void Perspective::setName(const QString &name) m_name = name; } +void Perspective::setAboutToActivateCallback(const Perspective::Callback &cb) +{ + m_aboutToActivateCallback = cb; +} + +void Perspective::aboutToActivate() +{ + if (m_aboutToActivateCallback) + m_aboutToActivateCallback(); +} + QList ToolbarDescription::widgets() const { return m_widgets; diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index 0e8a9f5c81d..589055b5a8b 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -82,6 +82,10 @@ public: QString name() const; void setName(const QString &name); + using Callback = std::function; + void setAboutToActivateCallback(const Callback &cb); + void aboutToActivate(); + private: Perspective(const Perspective &) = delete; void operator=(const Perspective &) = delete; @@ -90,6 +94,7 @@ private: QVector m_docks; QVector m_operations; QPointer m_centralWidget; + Callback m_aboutToActivateCallback; }; class DEBUGGER_EXPORT ToolbarDescription