forked from qt-creator/qt-creator
Debugger: Add a way to notify perspective about their activation
Change-Id: I5a6189e835aa293341f357c08f1d4b8ca4dd8326 Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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<QWidget *> ToolbarDescription::widgets() const
|
||||
{
|
||||
return m_widgets;
|
||||
|
||||
@@ -82,6 +82,10 @@ public:
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
using Callback = std::function<void()>;
|
||||
void setAboutToActivateCallback(const Callback &cb);
|
||||
void aboutToActivate();
|
||||
|
||||
private:
|
||||
Perspective(const Perspective &) = delete;
|
||||
void operator=(const Perspective &) = delete;
|
||||
@@ -90,6 +94,7 @@ private:
|
||||
QVector<QByteArray> m_docks;
|
||||
QVector<Operation> m_operations;
|
||||
QPointer<QWidget> m_centralWidget;
|
||||
Callback m_aboutToActivateCallback;
|
||||
};
|
||||
|
||||
class DEBUGGER_EXPORT ToolbarDescription
|
||||
|
||||
Reference in New Issue
Block a user