Fix flamegraph tooltip for top-level item
authorMilian Wolff <mail@milianw.de>
Sun, 8 Jan 2017 22:58:22 +0000 (23:58 +0100)
committerMilian Wolff <mail@milianw.de>
Sun, 8 Jan 2017 22:58:22 +0000 (23:58 +0100)
Use the item's "function" directly, as that one is actually a
tooltip-like label already for the top-level item.

gui/flamegraph.cpp
screenshots/gui_flamegraph.png

index 5bd4c8e..c510b76 100644 (file)
@@ -163,6 +163,10 @@ QString FrameGraphicsItem::description() const
     }
     const auto fraction = QString::number(double(m_cost)  * 100. / totalCost, 'g', 3);
     const auto function = QString(QLatin1String("<span style='font-family:monospace'>") + m_function.toHtmlEscaped() + QLatin1String("</span>"));
+    if (!parentItem()) {
+        return function;
+    }
+
     switch (m_costType) {
     case Allocations:
         tooltip = i18nc("%1: number of allocations, %2: relative number, %3: function label",
index b96a943..5b0b9fb 100644 (file)
Binary files a/screenshots/gui_flamegraph.png and b/screenshots/gui_flamegraph.png differ