diff widgets/AudioDial.cpp @ 1589:27ea5d61b402

Provide context menu in LevelPanToolButton, + a bit of tidying
author Chris Cannam
date Tue, 31 Mar 2020 13:45:06 +0100
parents e5464dc2f6cf
children a798a7b5e215
line wrap: on
line diff
--- a/widgets/AudioDial.cpp	Mon Mar 30 11:29:16 2020 +0100
+++ b/widgets/AudioDial.cpp	Tue Mar 31 13:45:06 2020 +0100
@@ -106,12 +106,10 @@
     if (!m_provideContextMenu) {
         return;
     }
-    
-    if (m_lastContextMenu) {
-        delete m_lastContextMenu;
-    }
-    
-    QMenu *m = new QMenu;
+
+    delete m_lastContextMenu;
+    m_lastContextMenu = new QMenu;
+    auto m = m_lastContextMenu;
 
     if (m_title == "") {
         MenuTitle::addTitle(m, tr("Dial"));
@@ -129,7 +127,6 @@
                  });
 
     m->popup(mapToGlobal(pos));
-    m_lastContextMenu = m;
 }
 
 void AudioDial::setRangeMapper(RangeMapper *mapper)