aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-06-28 15:33:55 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-07-05 12:31:44 +0000
commite9d36fe9efdbc5a0743db33cf87f82ac5a530525 (patch)
tree8fd252365e89b10d2d5c4c3e7ba1576937eac30d /src/libs
parentbcc62b6f72ef441c6a82cb69e921e7a5fb0acf75 (diff)
Tracing: Use Combobox for the modes menu
This is a better fit than a custom Button + Menu combination. Fixes: QTCREATORBUG-22579 Change-Id: Ie6f8a7ef2ce0da67a16bc365d6f619a11bc56221 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/tracing/qml/FlameGraphView.qml28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/libs/tracing/qml/FlameGraphView.qml b/src/libs/tracing/qml/FlameGraphView.qml
index 621569e8bb..f98bcb3134 100644
--- a/src/libs/tracing/qml/FlameGraphView.qml
+++ b/src/libs/tracing/qml/FlameGraphView.qml
@@ -45,7 +45,7 @@ ScrollView {
function resetRoot() { flamegraph.resetRoot(); }
property bool zoomed: flamegraph.zoomed
- property int sizeRole: -1
+ property var sizeRole: modes[Math.max(0, modesMenu.currentIndex)]
property var model: null
property int typeIdRole: -1
@@ -56,7 +56,7 @@ ScrollView {
property int summaryRole: -1
property int noteRole: -1
- property var trRoleNames: []
+ property var trRoleNames: ({})
property var modes: []
@@ -314,29 +314,11 @@ ScrollView {
}
}
- Button {
+ ComboBox {
+ id: modesMenu
x: flickable.width - width
y: flickable.contentY
-
- // It won't listen to anchors.margins and by default it doesn't add any margin. Great.
- width: implicitWidth + 20
-
- text: qsTr("Visualize %1").arg(trRoleNames[root.sizeRole])
- onClicked: modesMenu.open()
-
- Menu {
- id: modesMenu
- y: parent.height
- Instantiator {
- model: root.modes
- MenuItem {
- text: root.trRoleNames[modelData]
- onTriggered: root.sizeRole = modelData
- }
- onObjectAdded: modesMenu.insertItem(index, object)
- onObjectRemoved: modesMenu.removeItem(object)
- }
- }
+ model: root.modes.map(function(role) { return root.trRoleNames[role] });
}
}
}