forked from qt-creator/qt-creator
QmlProfiler: Consistently clear when clear button pressed
Several QML properties need extra treatment to avoid stale data after clearing. Toggling the visibility of the timeline renderer doesn't really help there. Task-number: QTCREATORBUG-11833 Change-Id: I1903d7bd69d6fe31ecc4cadca8e30fa2104fa09a Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -43,7 +43,7 @@ Canvas {
|
||||
property real endTime : 0
|
||||
|
||||
// ***** functions
|
||||
function clearDisplay()
|
||||
function clear()
|
||||
{
|
||||
dataReady = false;
|
||||
requestPaint();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user