Commit f30cbf97 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: allow interactive resizing of rows in timeline



Task-number: QTCREATORBUG-12337
Change-Id: Ib9ddb128605831841023bb3cc9aed758ed171de9
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 63ca5240
...@@ -39,6 +39,8 @@ Item { ...@@ -39,6 +39,8 @@ Item {
property var extdescriptions: [] property var extdescriptions: []
property var eventIds: [] property var eventIds: []
readonly property int dragHeight: 5
function trigger(i) { function trigger(i) {
return i * bindingTrigger * bindingTrigger; return i * bindingTrigger * bindingTrigger;
} }
...@@ -116,16 +118,28 @@ Item { ...@@ -116,16 +118,28 @@ Item {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
MouseArea { MouseArea {
property bool resizing: false
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: (resizing || height - mouseY < dragHeight) ? Qt.SizeVerCursor :
Qt.ArrowCursor;
onEntered: changeToolTip(extdescriptions[index]); onEntered: changeToolTip(extdescriptions[index]);
onExited: changeToolTip(""); onExited: changeToolTip("");
onPressed: resizing = (height - mouseY < dragHeight);
onReleased: resizing = false;
onClicked: { onClicked: {
if (mouse.modifiers & Qt.ShiftModifier) if (mouse.modifiers & Qt.ShiftModifier)
view.selectPrevFromId(modelIndex,eventIds[index]); view.selectPrevFromId(modelIndex,eventIds[index]);
else else
view.selectNextFromId(modelIndex,eventIds[index]); view.selectNextFromId(modelIndex,eventIds[index]);
} }
onMouseYChanged: {
if (resizing)
qmlProfilerModelProxy.setRowHeight(modelIndex, index + 1, mouseY);
}
} }
} }
} }
......
...@@ -53,12 +53,16 @@ TimelineRenderer::TimelineRenderer(QQuickPaintedItem *parent) : ...@@ -53,12 +53,16 @@ TimelineRenderer::TimelineRenderer(QQuickPaintedItem *parent) :
void TimelineRenderer::setProfilerModelProxy(QObject *profilerModelProxy) void TimelineRenderer::setProfilerModelProxy(QObject *profilerModelProxy)
{ {
if (m_profilerModelProxy) if (m_profilerModelProxy) {
disconnect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint())); disconnect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint()));
disconnect(m_profilerModelProxy, SIGNAL(rowHeightChanged()), this, SLOT(requestPaint()));
}
m_profilerModelProxy = qobject_cast<TimelineModelAggregator *>(profilerModelProxy); m_profilerModelProxy = qobject_cast<TimelineModelAggregator *>(profilerModelProxy);
if (m_profilerModelProxy) if (m_profilerModelProxy) {
connect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint())); connect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint()));
connect(m_profilerModelProxy, SIGNAL(rowHeightChanged()), this, SLOT(requestPaint()));
}
emit profilerModelProxyChanged(m_profilerModelProxy); emit profilerModelProxyChanged(m_profilerModelProxy);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment