forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -28,6 +28,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.1
|
import QtQuick 2.1
|
||||||
|
import QtQuick.Controls 1.2
|
||||||
|
import QtQuick.Controls.Styles 1.2
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: labelContainer
|
id: labelContainer
|
||||||
@@ -45,6 +47,8 @@ Item {
|
|||||||
return i * bindingTrigger * bindingTrigger;
|
return i * bindingTrigger * bindingTrigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool reverseSelect: false
|
||||||
|
|
||||||
visible: trigger(qmlProfilerModelProxy.rowCount(modelIndex)) > 0
|
visible: trigger(qmlProfilerModelProxy.rowCount(modelIndex)) > 0
|
||||||
|
|
||||||
height: trigger(qmlProfilerModelProxy.height(modelIndex))
|
height: trigger(qmlProfilerModelProxy.height(modelIndex))
|
||||||
@@ -63,7 +67,9 @@ Item {
|
|||||||
for (var i = 0; i < labelList.length; i++ ) {
|
for (var i = 0; i < labelList.length; i++ ) {
|
||||||
desc[i] = labelList[i].description;
|
desc[i] = labelList[i].description;
|
||||||
ids[i] = labelList[i].id;
|
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;
|
descriptions = desc;
|
||||||
eventIds = ids;
|
eventIds = ids;
|
||||||
@@ -101,44 +107,49 @@ Item {
|
|||||||
visible: expanded
|
visible: expanded
|
||||||
Repeater {
|
Repeater {
|
||||||
model: descriptions.length
|
model: descriptions.length
|
||||||
Rectangle {
|
Button {
|
||||||
width: labelContainer.width
|
width: labelContainer.width
|
||||||
height: trigger(qmlProfilerModelProxy.rowHeight(modelIndex, index + 1))
|
height: trigger(qmlProfilerModelProxy.rowHeight(modelIndex, index + 1))
|
||||||
color: "#eaeaea"
|
action: Action {
|
||||||
border.width: 1
|
onTriggered: {
|
||||||
border.color:"#c8c8c8"
|
if (reverseSelect)
|
||||||
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)
|
|
||||||
view.selectPrevFromId(modelIndex,eventIds[index]);
|
view.selectPrevFromId(modelIndex,eventIds[index]);
|
||||||
else
|
else
|
||||||
view.selectNextFromId(modelIndex,eventIds[index]);
|
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: {
|
onMouseYChanged: {
|
||||||
if (resizing)
|
if (resizing)
|
||||||
qmlProfilerModelProxy.setRowHeight(modelIndex, index + 1, mouseY);
|
qmlProfilerModelProxy.setRowHeight(modelIndex, index + 1, y + mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,8 +52,6 @@ Rectangle {
|
|||||||
property real selectionRangeStart: selectionRange.startTime
|
property real selectionRangeStart: selectionRange.startTime
|
||||||
property real selectionRangeEnd: selectionRange.startTime + selectionRange.duration
|
property real selectionRangeEnd: selectionRange.startTime + selectionRange.duration
|
||||||
|
|
||||||
signal changeToolTip(string text)
|
|
||||||
|
|
||||||
color: "#dcdcdc"
|
color: "#dcdcdc"
|
||||||
|
|
||||||
// ***** connections with external objects
|
// ***** connections with external objects
|
||||||
@@ -186,6 +184,11 @@ Rectangle {
|
|||||||
buttonsBar.updateLockButton(selectionLocked);
|
buttonsBar.updateLockButton(selectionLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
property bool shiftPressed: false;
|
||||||
|
Keys.onPressed: shiftPressed = (event.key === Qt.Key_Shift);
|
||||||
|
Keys.onReleased: shiftPressed = false;
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: labelsflick
|
id: labelsflick
|
||||||
flickableDirection: Flickable.VerticalFlick
|
flickableDirection: Flickable.VerticalFlick
|
||||||
@@ -212,7 +215,9 @@ Rectangle {
|
|||||||
id: col
|
id: col
|
||||||
Repeater {
|
Repeater {
|
||||||
model: labels.rowCount
|
model: labels.rowCount
|
||||||
delegate: CategoryLabel { }
|
delegate: CategoryLabel {
|
||||||
|
reverseSelect: root.shiftPressed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -220,7 +220,6 @@ void QmlProfilerTraceView::reset()
|
|||||||
|
|
||||||
QQuickItem *rootObject = d->m_mainView->rootObject();
|
QQuickItem *rootObject = d->m_mainView->rootObject();
|
||||||
connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
|
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)
|
void QmlProfilerTraceView::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
@@ -108,7 +108,6 @@ private slots:
|
|||||||
|
|
||||||
void updateRange();
|
void updateRange();
|
||||||
|
|
||||||
void updateToolTip(const QString &text);
|
|
||||||
void profilerDataModelStateChanged();
|
void profilerDataModelStateChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user