forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import "../tracing/"
|
||||
|
||||
FlameGraphView {
|
||||
id: root
|
||||
sizeRole: PerfProfilerFlameGraphModel.SamplesRole
|
||||
|
||||
model: flameGraphModel
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ FlameGraphView {
|
||||
id: root
|
||||
|
||||
model: flameGraphModel
|
||||
sizeRole: QmlProfilerFlameGraphModel.DurationRole
|
||||
|
||||
typeIdRole: QmlProfilerFlameGraphModel.TypeIdRole
|
||||
sourceFileRole: QmlProfilerFlameGraphModel.FilenameRole
|
||||
|
||||
@@ -28,7 +28,6 @@ import "../tracing/"
|
||||
|
||||
FlameGraphView {
|
||||
id: root
|
||||
sizeRole: TestFlameGraphModel.SizeRole
|
||||
|
||||
model: flameGraphModel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user