diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index eee32f17450..608b4974104 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -52,19 +52,32 @@ Rectangle {
root.updateCursorPosition();
}
- function clearAll() {
+ function clearData() {
Plotter.reset();
view.clearData();
rangeMover.x = 2
rangeMover.opacity = 0
}
+ function clearAll() {
+ clearData();
+ selectedEventIndex = -1;
+ Plotter.valuesdone = false;
+ canvas.requestPaint();
+ view.visible = false;
+ root.elapsedTime = 0;
+ root.updateTimer();
+ }
+
+ property int selectedEventIndex : -1;
+ property bool mouseTracking: false;
+
//handle debug data coming from C++
Connections {
target: connection
onEvent: {
if (Plotter.valuesdone) {
- root.clearAll();
+ root.clearData();
}
if (!Plotter.valuesdone && event === 0) //### only handle paint event
@@ -73,7 +86,7 @@ Rectangle {
onRange: {
if (Plotter.valuesdone) {
- root.clearAll();
+ root.clearData();
}
// todo: consider nestingLevel
@@ -95,11 +108,6 @@ Rectangle {
onClear: {
root.clearAll();
- Plotter.valuesdone = false;
- canvas.requestPaint();
- view.visible = false;
- root.elapsedTime = 0;
- root.updateTimer();
}
}
@@ -136,6 +144,15 @@ Rectangle {
endTime: (rangeMover.x + rangeMover.width) * Plotter.xScale(canvas);
}
+ function hideRangeDetails() {
+ rangeDetails.visible = false
+ rangeDetails.duration = ""
+ rangeDetails.label = ""
+ rangeDetails.type = ""
+ rangeDetails.file = ""
+ rangeDetails.line = -1
+ }
+
//our main interaction view
Flickable {
id: flick
@@ -155,12 +172,11 @@ Rectangle {
height: flick.contentHeight
x: flick.contentX
onClicked: {
- rangeDetails.visible = false
- rangeDetails.duration = ""
- rangeDetails.label = ""
- rangeDetails.type = ""
- rangeDetails.file = ""
- rangeDetails.line = -1
+ root.hideRangeDetails();
+ }
+ hoverEnabled: true
+ onExited: {
+ root.hideRangeDetails();
}
}
@@ -207,36 +223,63 @@ Rectangle {
GradientStop { position: 1.0; color: myColor }
}
smooth: true
+
+ property bool componentIsCompleted: false
+ Component.onCompleted: componentIsCompleted = true;
+
+ property bool isSelected: root.selectedEventIndex == index;
+ onIsSelectedChanged: {
+ if (!root.mouseTracking && componentIsCompleted) {
+ if (isSelected) {
+ enableSelected(0, 0);
+ }
+ else
+ disableSelected();
+ }
+ }
+
+ function enableSelected(x,y) {
+ currentItem = obj
+ myColor = Qt.darker(baseColor, 1.2)
+ rangeDetails.duration = duration
+ rangeDetails.label = label
+ rangeDetails.file = fileName
+ rangeDetails.line = line
+ rangeDetails.type = Plotter.names[type]
+
+ var pos = mapToItem(rangeDetails.parent, x, y+height)
+ var preferredX = Math.max(10, pos.x - rangeDetails.width/2)
+ if (preferredX + rangeDetails.width > rangeDetails.parent.width)
+ preferredX = rangeDetails.parent.width - rangeDetails.width
+ rangeDetails.x = preferredX
+
+ var preferredY = pos.y - rangeDetails.height/2;
+ if (preferredY + rangeDetails.height > root.height - 10)
+ preferredY = root.height - 10 - rangeDetails.height;
+ if (preferredY < 10)
+ preferredY=10;
+ rangeDetails.y = preferredY;
+ rangeDetails.visible = true
+ }
+
+ function disableSelected() {
+ myColor = baseColor
+ }
+
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: {
- currentItem = obj
- myColor = Qt.darker(baseColor, 1.2)
- rangeDetails.duration = duration
- rangeDetails.label = label
- rangeDetails.file = fileName
- rangeDetails.line = line
- rangeDetails.type = Plotter.names[type]
-
- var pos = mapToItem(rangeDetails.parent, mouseX, y+height)
- var preferredX = Math.max(10, pos.x - rangeDetails.width/2)
- if (preferredX + rangeDetails.width > rangeDetails.parent.width)
- preferredX = rangeDetails.parent.width - rangeDetails.width
- rangeDetails.x = preferredX
-
- var preferredY = pos.y - rangeDetails.height/2;
- if (preferredY + rangeDetails.height > root.height - 10)
- preferredY = root.height - 10 - rangeDetails.height;
- if (preferredY < 10)
- preferredY=10;
- rangeDetails.y = preferredY;
- rangeDetails.visible = true
+ root.mouseTracking = true;
+ root.selectedEventIndex = index;
+ enableSelected(mouseX, y);
+ root.mouseTracking = false;
}
onExited: {
- myColor = baseColor
+ disableSelected();
}
+
onClicked: root.gotoSourceLocation(rangeDetails.file, rangeDetails.line);
}
}
@@ -246,6 +289,18 @@ Rectangle {
//popup showing the details for the hovered range
RangeDetails {
id: rangeDetails
+
+ // follow the flickable
+ property int flickableX: flick.contentX;
+ property int lastFlickableX;
+ onXChanged: lastFlickableX = flickableX;
+ onFlickableXChanged: {
+ x = x - flickableX + lastFlickableX;
+ if (visible && (x + width <= 0 || x > root.width)) {
+ root.hideRangeDetails();
+ visible = false;
+ }
+ }
}
Rectangle {
@@ -324,5 +379,4 @@ Rectangle {
opacity: 0
anchors.top: canvas.top
}
-
}
diff --git a/src/plugins/qmlprofiler/qml/RangeMover.qml b/src/plugins/qmlprofiler/qml/RangeMover.qml
index 8617b3399ee..68c528074c7 100644
--- a/src/plugins/qmlprofiler/qml/RangeMover.qml
+++ b/src/plugins/qmlprofiler/qml/RangeMover.qml
@@ -43,7 +43,8 @@ Item {
property real possibleValue: (canvas.canvasWindow.x + x) * Plotter.xScale(canvas)
onPossibleValueChanged: {
prevXStep = canvas.canvasWindow.x;
- value = possibleValue
+ if (value != possibleValue)
+ value = possibleValue;
}
property real value
diff --git a/src/plugins/qmlprofiler/qml/clean_pane_small.png b/src/plugins/qmlprofiler/qml/clean_pane_small.png
new file mode 100644
index 00000000000..341e23861a1
Binary files /dev/null and b/src/plugins/qmlprofiler/qml/clean_pane_small.png differ
diff --git a/src/plugins/qmlprofiler/qml/qml.qrc b/src/plugins/qmlprofiler/qml/qml.qrc
index 0befcb5b062..a735d65b704 100644
--- a/src/plugins/qmlprofiler/qml/qml.qrc
+++ b/src/plugins/qmlprofiler/qml/qml.qrc
@@ -12,5 +12,6 @@
ToolButton.qml
analyzer_category_small.png
TimeDisplay.qml
+ clean_pane_small.png
diff --git a/src/plugins/qmlprofiler/qmlprofilercalleeview.h b/src/plugins/qmlprofiler/qmlprofilercalleeview.h
index 8d436dab2d6..715a006eddd 100644
--- a/src/plugins/qmlprofiler/qmlprofilercalleeview.h
+++ b/src/plugins/qmlprofiler/qmlprofilercalleeview.h
@@ -52,6 +52,7 @@ signals:
public slots:
void clean();
+
void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
const QStringList &data, const QString &fileName, int line);
void complete();
diff --git a/src/plugins/qmlprofiler/qmlprofilercallerview.h b/src/plugins/qmlprofiler/qmlprofilercallerview.h
index 71ceb69b061..7f9416fea98 100644
--- a/src/plugins/qmlprofiler/qmlprofilercallerview.h
+++ b/src/plugins/qmlprofiler/qmlprofilercallerview.h
@@ -52,6 +52,7 @@ signals:
public slots:
void clean();
+
void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
const QStringList &data, const QString &fileName, int line);
void complete();
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 321a35de0b0..49de24df466 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -101,6 +101,7 @@ public:
bool m_isAttached;
QAction *m_attachAction;
QToolButton *m_recordButton;
+ QToolButton *m_clearButton;
bool m_recordingEnabled;
enum ConnectMode {
@@ -300,6 +301,11 @@ QWidget *QmlProfilerTool::createControlWidget()
d->m_recordButton->setChecked(true);
layout->addWidget(d->m_recordButton);
+ d->m_clearButton = new QToolButton(toolbarWidget);
+ d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png")));
+ connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay()));
+ layout->addWidget(d->m_clearButton);
+
QLabel *timeLabel = new QLabel(tr("Elapsed: 0 s"));
QPalette palette = timeLabel->palette();
palette.setColor(QPalette::WindowText, Qt::white);
@@ -308,6 +314,7 @@ QWidget *QmlProfilerTool::createControlWidget()
connect(this, SIGNAL(setTimeLabel(QString)), timeLabel, SLOT(setText(QString)));
layout->addWidget(timeLabel);
+
toolbarWidget->setLayout(layout);
return toolbarWidget;
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index fd590c3e1a4..375b82a714b 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -64,8 +64,6 @@ public:
bool canRunRemotely() const;
bool needsOutputPane() const { return false; }
- void clearDisplay();
-
public slots:
void connectClient();
void disconnectClient();
@@ -77,6 +75,8 @@ public slots:
void gotoSourceLocation(const QString &fileUrl, int lineNumber);
void updateTimer(qreal elapsedSeconds);
+ void clearDisplay();
+
signals:
void setTimeLabel(const QString &);
void fetchingData(bool);
diff --git a/src/plugins/qmlprofiler/timelineview.cpp b/src/plugins/qmlprofiler/timelineview.cpp
index 9583fcf167d..265fe9464a4 100644
--- a/src/plugins/qmlprofiler/timelineview.cpp
+++ b/src/plugins/qmlprofiler/timelineview.cpp
@@ -201,6 +201,7 @@ void TimelineView::updateTimeline(bool updateStartX)
ctxt->setContextProperty("duration", qMax(qRound(m_ranges.property(i).property("duration").toNumber()/qreal(1000)),1));
ctxt->setContextProperty("fileName", m_ranges.property(i).property("fileName").toString());
ctxt->setContextProperty("line", m_ranges.property(i).property("line").toNumber());
+ ctxt->setContextProperty("index", i);
QString label;
QVariantList list = m_ranges.property(i).property("label").toVariant().value();
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/plugins/qmlprofiler/tracewindow.cpp b/src/plugins/qmlprofiler/tracewindow.cpp
index 71f11dfa802..842c4537e9a 100644
--- a/src/plugins/qmlprofiler/tracewindow.cpp
+++ b/src/plugins/qmlprofiler/tracewindow.cpp
@@ -312,6 +312,8 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connect(m_view->rootObject(), SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(m_view->rootObject(), SIGNAL(updateTimer()), this, SLOT(updateTimer()));
+
+ connect(this, SIGNAL(internalClearDisplay()), m_view->rootObject(), SLOT(clearAll()));
}
void TraceWindow::updateCursorPosition()
@@ -329,6 +331,8 @@ void TraceWindow::clearDisplay()
{
if (m_plugin)
m_plugin.data()->clearView();
+ else
+ emit internalClearDisplay();
}
void TraceWindow::setRecording(bool recording)
diff --git a/src/plugins/qmlprofiler/tracewindow.h b/src/plugins/qmlprofiler/tracewindow.h
index eae46f5be4d..f234d52bfc7 100644
--- a/src/plugins/qmlprofiler/tracewindow.h
+++ b/src/plugins/qmlprofiler/tracewindow.h
@@ -63,6 +63,7 @@ public:
void setRecording(bool recording);
bool isRecording() const;
+
public slots:
void updateCursorPosition();
void updateTimer();
@@ -74,6 +75,8 @@ signals:
void timeChanged(qreal newTime);
void range(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, const QStringList &data, const QString &fileName, int line);
+ void internalClearDisplay();
+
private:
QWeakPointer m_plugin;
QSize m_sizeHint;