diff widgets/LevelPanToolButton.h @ 1589:27ea5d61b402

Provide context menu in LevelPanToolButton, + a bit of tidying
author Chris Cannam
date Tue, 31 Mar 2020 13:45:06 +0100
parents a18e78b9c78b
children
line wrap: on
line diff
--- a/widgets/LevelPanToolButton.h	Mon Mar 30 11:29:16 2020 +0100
+++ b/widgets/LevelPanToolButton.h	Tue Mar 31 13:45:06 2020 +0100
@@ -18,6 +18,7 @@
 #include <QToolButton>
 
 class LevelPanWidget;
+class QMenu;
 
 class LevelPanToolButton : public QToolButton
 {
@@ -37,6 +38,9 @@
     bool includesMute() const;
 
     void setImageSize(int pixels);
+
+    /// Specify whether a right-click context menu is provided
+    void setProvideContextMenu(bool);
                         
     void setBigImageSize(int pixels);
                         
@@ -55,6 +59,9 @@
 
     void setEnabled(bool enabled);
     
+protected slots:
+    void contextMenuRequested(const QPoint &);
+
 signals:
     void levelChanged(float);
     void panChanged(float);
@@ -78,6 +85,8 @@
     int m_pixelsBig;
     bool m_muted;
     float m_savedLevel;
+    bool m_provideContextMenu;
+    QMenu *m_lastContextMenu;
 };
 
 #endif