Debugger: Move ownership of perspective dock widgets to plugins

Similar to the previous patch, but affecting more plugins: with dynamic
perspectives lifetime is better managed close to the code that knows how
to (re-)construct the items.

Change-Id: I0e7bfcf769d198ec2afa88b972be900baa1b6a46
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-07-31 16:13:11 +02:00
parent 01e1653734
commit 01f2b982a2
11 changed files with 150 additions and 169 deletions

View File

@@ -83,24 +83,28 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
m_flameGraphView = new FlameGraphView(m_profilerModelManager);
prepareEventsView(m_flameGraphView);
QByteArray anchorDockId;
QWidget *anchor = nullptr;
if (m_traceView->isUsable()) {
anchorDockId = m_traceView->objectName().toLatin1();
perspective->addOperation({anchorDockId, m_traceView, {}, Perspective::SplitVertical});
perspective->addOperation({m_flameGraphView->objectName().toLatin1(), m_flameGraphView,
anchorDockId, Perspective::AddToTab});
anchor = m_traceView;
perspective->addWindow(m_traceView, Perspective::SplitVertical, nullptr);
perspective->addWindow(m_flameGraphView, Perspective::AddToTab, anchor);
} else {
anchorDockId = m_flameGraphView->objectName().toLatin1();
perspective->addOperation({anchorDockId, m_flameGraphView, {},
Perspective::SplitVertical});
anchor = m_flameGraphView;
perspective->addWindow(m_flameGraphView, Perspective::SplitVertical, nullptr);
}
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
anchorDockId, Perspective::AddToTab});
perspective->addOperation({anchorDockId, nullptr, {}, Perspective::Raise});
perspective->addWindow(m_statisticsView, Perspective::AddToTab, anchor);
perspective->addWindow(anchor, Perspective::Raise, nullptr);
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
}
QmlProfilerViewManager::~QmlProfilerViewManager()
{
delete m_traceView;
delete m_flameGraphView;
delete m_statisticsView;
}
void QmlProfilerViewManager::clear()
{
m_traceView->clear();