diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 824ac1540cd..3940710e5a8 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -202,12 +202,24 @@ void QmlProfilerModelManager::replayQmlEvents(QmlEventLoader loader, } } +void QmlProfilerModelManager::initialize() +{ + d->textMarkModel->hideTextMarks(); + TimelineTraceManager::initialize(); +} + void QmlProfilerModelManager::clearEventStorage() { TimelineTraceManager::clearEventStorage(); emit traceChanged(); } +void QmlProfilerModelManager::clearTypeStorage() +{ + d->textMarkModel->clear(); + TimelineTraceManager::clearTypeStorage(); +} + static QString getDisplayName(const QmlEventType &event) { if (event.location().filename().isEmpty()) { @@ -261,6 +273,7 @@ void QmlProfilerModelManager::finalize() // which happens on stateChanged(Done). TimelineTraceManager::finalize(); + d->textMarkModel->showTextMarks(); emit traceChanged(); } diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h index 42a135916d7..6d73a08d516 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h @@ -66,6 +66,7 @@ public: void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer, ErrorHandler errorHandler, QFutureInterface &future) const; + void initialize() override; void finalize() override; void populateFileFinder(const ProjectExplorer::Target *target = nullptr); @@ -92,6 +93,7 @@ private: void restrictByFilter(QmlEventFilter filter); void clearEventStorage() final; + void clearTypeStorage() final; Timeline::TimelineTraceFile *createTraceFile() override; void replayEvents(TraceEventLoader loader, Initializer initializer, Finalizer finalizer, diff --git a/src/plugins/qmlprofiler/qmlprofilertextmark.cpp b/src/plugins/qmlprofiler/qmlprofilertextmark.cpp index 2112bd172aa..21173734505 100644 --- a/src/plugins/qmlprofiler/qmlprofilertextmark.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertextmark.cpp @@ -119,6 +119,18 @@ void QmlProfilerTextMarkModel::createMarks(QmlProfilerViewManager *viewManager, } } +void QmlProfilerTextMarkModel::showTextMarks() +{ + for (QmlProfilerTextMark *mark : qAsConst(m_marks)) + mark->setVisible(true); +} + +void QmlProfilerTextMarkModel::hideTextMarks() +{ + for (QmlProfilerTextMark *mark : qAsConst(m_marks)) + mark->setVisible(false); +} + bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const { QGridLayout *layout = new QGridLayout; diff --git a/src/plugins/qmlprofiler/qmlprofilertextmark.h b/src/plugins/qmlprofiler/qmlprofilertextmark.h index 09beb9bf88a..8ed4576ea19 100644 --- a/src/plugins/qmlprofiler/qmlprofilertextmark.h +++ b/src/plugins/qmlprofiler/qmlprofilertextmark.h @@ -59,6 +59,9 @@ public: void addTextMarkId(int typeId, const QmlEventLocation &location); void createMarks(QmlProfilerViewManager *viewManager, const QString &fileName); + void showTextMarks(); + void hideTextMarks(); + private: struct TextMarkId { int typeId; diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index b00379d24d9..af0ae935a80 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -471,18 +471,13 @@ void QmlProfilerTool::setButtonsEnabled(bool enable) d->m_recordFeaturesMenu->setEnabled(enable); } -void QmlProfilerTool::createTextMarks() +void QmlProfilerTool::createInitialTextMarks() { QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel(); foreach (IDocument *document, DocumentModel::openedDocuments()) model->createMarks(d->m_viewContainer, document->filePath().toString()); } -void QmlProfilerTool::clearTextMarks() -{ - d->m_profilerModelManager->textMarkModel()->clear(); -} - bool QmlProfilerTool::prepareTool() { if (d->m_profilerState->clientRecording()) { @@ -757,14 +752,13 @@ void QmlProfilerTool::initialize() void QmlProfilerTool::finalize() { updateTimeDisplay(); - createTextMarks(); + createInitialTextMarks(); setButtonsEnabled(true); d->m_recordButton->setEnabled(true); } void QmlProfilerTool::clear() { - clearTextMarks(); clearDisplay(); setButtonsEnabled(true); d->m_recordButton->setEnabled(true); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 4e6984f65e7..c96a40587f3 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -105,8 +105,7 @@ private: bool checkForUnsavedNotes(); void restoreFeatureVisibility(); void setButtonsEnabled(bool enable); - void createTextMarks(); - void clearTextMarks(); + void createInitialTextMarks(); void initialize(); void finalize();