diff widgets/AudioDial.h @ 1584:e5464dc2f6cf

Add optional context menu to AudioDial
author Chris Cannam
date Thu, 26 Mar 2020 12:10:55 +0000
parents 05d614f6e46d
children
line wrap: on
line diff
--- a/widgets/AudioDial.h	Thu Mar 26 11:16:47 2020 +0000
+++ b/widgets/AudioDial.h	Thu Mar 26 12:10:55 2020 +0000
@@ -42,6 +42,7 @@
 #include <map>
 
 class RangeMapper;
+class QMenu;
 
 /**
  * AudioDial is a nicer-looking QDial that by default reacts to mouse
@@ -78,6 +79,7 @@
     int defaultValue() const { return m_defaultValue; }
 
     void setShowToolTip(bool show);
+    void setProvideContextMenu(bool provide);
 
 signals:
     void mouseEntered();
@@ -113,6 +115,8 @@
 
     void setToDefault();
 
+    void edit();
+
 protected:
     void drawTick(QPainter &paint, double angle, int size, bool internal);
     void paintEvent(QPaintEvent *) override;
@@ -127,6 +131,7 @@
 
 protected slots:
     void updateMappedValue(int value);
+    void contextMenuRequested(const QPoint &);
 
 private:
     QColor m_knobColor;
@@ -143,6 +148,11 @@
     QPoint m_posMouse;
 
     bool m_showTooltip;
+    bool m_provideContextMenu;
+
+    QString m_title;
+
+    QMenu *m_lastContextMenu;
 
     RangeMapper *m_rangeMapper;
 };