diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml index f32395ab2ea..84633e0102f 100644 --- a/src/plugins/qmlprofiler/qml/MainView.qml +++ b/src/plugins/qmlprofiler/qml/MainView.qml @@ -82,16 +82,14 @@ Rectangle { onStateChanged: { // Clear if model is empty. if (qmlProfilerModelProxy.getState() === 0) - root.clearAll(); + root.clear(); } onDataAvailable: { view.clearData(); - zoomControl.setRange(0,0); - view.visible = true; - view.requestPaint(); zoomControl.setRange(qmlProfilerModelProxy.traceStartTime(), qmlProfilerModelProxy.traceStartTime() + qmlProfilerModelProxy.traceDuration()/10); + view.requestPaint(); } } @@ -106,21 +104,18 @@ Rectangle { } } - function clearData() { + function clear() { + flick.contentY = 0; + flick.contentX = 0; + flick.contentWidth = 0; view.clearData(); + view.startTime = view.endTime = 0; hideRangeDetails(); selectionRangeMode = false; updateRangeButton(); zoomControl.setRange(0,0); - } - - function clearDisplay() { - clearData(); - view.visible = false; - } - - function clearAll() { - clearDisplay(); + zoomSlider.externalUpdate = true; + zoomSlider.value = zoomSlider.minimumValue; } function nextEvent() { diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml index 40869602525..4d710ba8368 100644 --- a/src/plugins/qmlprofiler/qml/Overview.qml +++ b/src/plugins/qmlprofiler/qml/Overview.qml @@ -43,7 +43,7 @@ Canvas { property real endTime : 0 // ***** functions - function clearDisplay() + function clear() { dataReady = false; requestPaint(); diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml index 4327d427312..81e3b9933b7 100644 --- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml +++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml @@ -37,7 +37,6 @@ Canvas { property real startTime : 0 property real endTime : 0 - property real timePerPixel: 0 Connections { target: zoomControl @@ -55,7 +54,7 @@ Canvas { context.fillRect(0, 0, width, height); var realWidth = width - 1; // account for left border - var totalTime = endTime - startTime; + var totalTime = Math.max(1, endTime - startTime); var spacing = realWidth / totalTime; var initialBlockLength = 120; @@ -67,7 +66,7 @@ Canvas { var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock; var realStartPos = (startTime - realStartTime) * spacing - 1; - timePerPixel = timePerBlock/pixelsPerBlock; + var timePerPixel = timePerBlock/pixelsPerBlock; var initialColor = Math.floor(realStartTime/timePerBlock) % 2; @@ -100,6 +99,12 @@ Canvas { context.fillRect(0, 0, 1, height); } + function clear() + { + startTime = endTime = 0; + requestPaint(); + } + function prettyPrintTime( t ) { var round = 1; diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 096a5dda6d2..7b7da1c609e 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -292,13 +292,11 @@ qint64 QmlProfilerTraceView::selectionEnd() const return 0; } -void QmlProfilerTraceView::clearDisplay() +void QmlProfilerTraceView::clear() { - d->m_zoomControl->setRange(0,0); - d->m_mainView->rootObject()->setProperty("scrollY", QVariant(0)); - - QMetaObject::invokeMethod(d->m_mainView->rootObject(), "clearAll"); - QMetaObject::invokeMethod(d->m_overview->rootObject(), "clearDisplay"); + QMetaObject::invokeMethod(d->m_mainView->rootObject(), "clear"); + QMetaObject::invokeMethod(d->m_overview->rootObject(), "clear"); + QMetaObject::invokeMethod(d->m_timebar->rootObject(), "clear"); } void QmlProfilerTraceView::selectNextEventByHash(const QString &hash) diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h index ef2dee74a21..db1626c3631 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h @@ -78,7 +78,7 @@ public: void showContextMenu(QPoint position); public slots: - void clearDisplay(); + void clear(); void selectNextEventByHash(const QString &eventHash); void selectNextEventByLocation(const QString &filename, const int line, const int column); diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index ffb93897116..0f937b76911 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -170,7 +170,7 @@ void QmlProfilerViewManager::getStatisticsInRange(qint64 rangeStart, qint64 rang void QmlProfilerViewManager::clear() { - d->traceView->clearDisplay(); + d->traceView->clear(); d->eventsView->clear(); d->v8profilerView->clear(); }