aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlprofilertool.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-01-28 09:10:46 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-01-28 12:37:45 +0000
commit39eec848ceb57b4d1caa6ab3086f1c2d48f9cd9a (patch)
treeb54f0a2871f40ceca3b53767f95d1b4c458468ba /src/plugins/qmlprofiler/qmlprofilertool.cpp
parent7a5198e8672bda2e048f398feb7cd261da57022e (diff)
QmlProfiler: Delay creation of views until activation
We don't need to waste the time and memory required to create the views if they are never shown. Change-Id: I56add08981c90263e6735f5b7e6fac2140b457e4 Fixes: QTCREATORBUG-21894 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertool.cpp')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index ba1e17cd134..1196429d7dc 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -195,9 +195,12 @@ QmlProfilerTool::QmlProfilerTool()
d->m_searchButton = new QToolButton;
d->m_searchButton->setIcon(Utils::Icons::ZOOM_TOOLBAR.icon());
d->m_searchButton->setToolTip(tr("Search timeline event notes."));
+ d->m_searchButton->setEnabled(false);
connect(d->m_searchButton, &QToolButton::clicked, this, &QmlProfilerTool::showTimeLineSearch);
- d->m_searchButton->setEnabled(d->m_viewContainer->traceView()->isUsable());
+ connect(d->m_viewContainer, &QmlProfilerViewManager::viewsCreated, this, [this]() {
+ d->m_searchButton->setEnabled(d->m_viewContainer->traceView()->isUsable());
+ });
d->m_displayFeaturesButton = new QToolButton;
d->m_displayFeaturesButton->setIcon(Utils::Icons::FILTER.icon());
@@ -451,6 +454,7 @@ void QmlProfilerTool::updateTimeDisplay()
void QmlProfilerTool::showTimeLineSearch()
{
QmlProfilerTraceView *traceView = d->m_viewContainer->traceView();
+ QTC_ASSERT(traceView, return);
QTC_ASSERT(qobject_cast<QDockWidget *>(traceView->parentWidget()), return);
traceView->parentWidget()->raise();
traceView->setFocus();
@@ -482,7 +486,8 @@ void QmlProfilerTool::setButtonsEnabled(bool enable)
{
d->m_clearButton->setEnabled(enable);
d->m_displayFeaturesButton->setEnabled(enable);
- d->m_searchButton->setEnabled(d->m_viewContainer->traceView()->isUsable() && enable);
+ const QmlProfilerTraceView *traceView = d->m_viewContainer->traceView();
+ d->m_searchButton->setEnabled(traceView && traceView->isUsable() && enable);
d->m_recordFeaturesMenu->setEnabled(enable);
}