diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-23 15:46:40 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-24 14:52:57 +0200 |
commit | 3dbc59309a8d05025f49bd7f49fe7b7a0ddf11ef (patch) | |
tree | c6292b17221ed816fe2ea374afc92d73a28d23ce | |
parent | 84b00721e4f2d3daa49f4ebd16ebe3f44840736d (diff) | |
download | qt-creator-3dbc59309a8d05025f49bd7f49fe7b7a0ddf11ef.tar.gz |
QmlProfiler: restore tooltips on category labels
They had been lost somewhere between QtCreator 2.8 and 3.0. Also
putting the location in braces looks nicer than the original.
Change-Id: Ia455ba99015ad38c21e528a0f8177902749ba1d5
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | src/plugins/qmlprofiler/qml/CategoryLabel.qml | 71 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qml/MainView.qml | 11 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertraceview.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertraceview.h | 1 |
4 files changed, 49 insertions, 40 deletions
diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml index 872483bb8e..961387fc92 100644 --- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml +++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml @@ -28,6 +28,8 @@ ****************************************************************************/ import QtQuick 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 Item { id: labelContainer @@ -45,6 +47,8 @@ Item { return i * bindingTrigger * bindingTrigger; } + property bool reverseSelect: false + visible: trigger(qmlProfilerModelProxy.rowCount(modelIndex)) > 0 height: trigger(qmlProfilerModelProxy.height(modelIndex)) @@ -63,7 +67,9 @@ Item { for (var i = 0; i < labelList.length; i++ ) { desc[i] = labelList[i].description; ids[i] = labelList[i].id; - extdesc[i] = labelList[i].displayName + ":" + labelList[i].description; + extdesc[i] = labelList[i].description; + if (labelList[i].displayName !== undefined) + extdesc[i] += " (" + labelList[i].displayName + ")"; } descriptions = desc; eventIds = ids; @@ -101,44 +107,49 @@ Item { visible: expanded Repeater { model: descriptions.length - Rectangle { + Button { width: labelContainer.width height: trigger(qmlProfilerModelProxy.rowHeight(modelIndex, index + 1)) - color: "#eaeaea" - border.width: 1 - border.color:"#c8c8c8" - Text { - anchors.fill: parent - anchors.leftMargin: 5 - anchors.rightMargin: 5 - - text: descriptions[index] - textFormat: Text.PlainText - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - MouseArea { - property bool resizing: false - anchors.fill: parent - hoverEnabled: true - cursorShape: (resizing || height - mouseY < dragHeight) ? Qt.SizeVerCursor : - Qt.ArrowCursor; - onEntered: changeToolTip(extdescriptions[index]); - onExited: changeToolTip(""); - onPressed: resizing = (height - mouseY < dragHeight); - - onReleased: resizing = false; - - onClicked: { - if (mouse.modifiers & Qt.ShiftModifier) + action: Action { + onTriggered: { + if (reverseSelect) view.selectPrevFromId(modelIndex,eventIds[index]); else view.selectNextFromId(modelIndex,eventIds[index]); } + tooltip: extdescriptions[index] + } + + style: ButtonStyle { + background: Rectangle { + border.width: 1 + border.color: "#c8c8c8" + color: "#eaeaea" + } + label: Text { + text: descriptions[index] + textFormat: Text.PlainText + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + elide: Text.ElideRight + } + } + MouseArea { + hoverEnabled: true + property bool resizing: false + onPressed: resizing = true + onReleased: resizing = false + + height: dragHeight + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + cursorShape: Qt.SizeVerCursor + onMouseYChanged: { if (resizing) - qmlProfilerModelProxy.setRowHeight(modelIndex, index + 1, mouseY); + qmlProfilerModelProxy.setRowHeight(modelIndex, index + 1, y + mouseY); } } } diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml index 5d54cf5e92..aea2a60fcc 100644 --- a/src/plugins/qmlprofiler/qml/MainView.qml +++ b/src/plugins/qmlprofiler/qml/MainView.qml @@ -52,8 +52,6 @@ Rectangle { property real selectionRangeStart: selectionRange.startTime property real selectionRangeEnd: selectionRange.startTime + selectionRange.duration - signal changeToolTip(string text) - color: "#dcdcdc" // ***** connections with external objects @@ -186,6 +184,11 @@ Rectangle { buttonsBar.updateLockButton(selectionLocked); } + focus: true + property bool shiftPressed: false; + Keys.onPressed: shiftPressed = (event.key === Qt.Key_Shift); + Keys.onReleased: shiftPressed = false; + Flickable { id: labelsflick flickableDirection: Flickable.VerticalFlick @@ -212,7 +215,9 @@ Rectangle { id: col Repeater { model: labels.rowCount - delegate: CategoryLabel { } + delegate: CategoryLabel { + reverseSelect: root.shiftPressed + } } } } diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 53e80b93ad..abbcc9f7ba 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -220,7 +220,6 @@ void QmlProfilerTraceView::reset() QQuickItem *rootObject = d->m_mainView->rootObject(); connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); - connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString))); } ///////////////////////////////////////////////////////// @@ -318,11 +317,6 @@ void QmlProfilerTraceView::updateRange() } //////////////////////////////////////////////////////// -void QmlProfilerTraceView::updateToolTip(const QString &text) -{ - setToolTip(text); -} - void QmlProfilerTraceView::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h index de61820cc5..f407f20059 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h @@ -108,7 +108,6 @@ private slots: void updateRange(); - void updateToolTip(const QString &text); void profilerDataModelStateChanged(); protected: |