diff widgets/AudioDial.cpp @ 1216:dc2af6616c83

Merge from branch 3.0-integration
author Chris Cannam
date Fri, 13 Jan 2017 10:29:50 +0000
parents 1badacff7ab2
children a34a2a25907c
line wrap: on
line diff
--- a/widgets/AudioDial.cpp	Fri Mar 04 12:23:31 2016 +0000
+++ b/widgets/AudioDial.cpp	Fri Jan 13 10:29:50 2017 +0000
@@ -409,13 +409,27 @@
 
     if (m_showTooltip) {
         QString name = objectName();
-        QString unit = "";
+        QString label;
+        if (m_rangeMapper) {
+            label = m_rangeMapper->getLabel(value);
+        }
         QString text;
-        if (m_rangeMapper) unit = m_rangeMapper->getUnit();
-        if (name != "") {
-            text = tr("%1: %2%3").arg(name).arg(m_mappedValue).arg(unit);
+        if (label != "") {
+            if (name != "") {
+                text = tr("%1: %2").arg(name).arg(label);
+            } else {
+                text = label;
+            }
         } else {
-            text = tr("%2%3").arg(m_mappedValue).arg(unit);
+            QString unit = "";
+            if (m_rangeMapper) {
+                unit = m_rangeMapper->getUnit();
+            }
+            if (name != "") {
+                text = tr("%1: %2%3").arg(name).arg(m_mappedValue).arg(unit);
+            } else {
+                text = tr("%2%3").arg(m_mappedValue).arg(unit);
+            }
         }
         setToolTip(text);
     }