comparison 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
comparison
equal deleted inserted replaced
1588:0f36e0eca6b0 1589:27ea5d61b402
16 #define LEVEL_PAN_TOOLBUTTON_H 16 #define LEVEL_PAN_TOOLBUTTON_H
17 17
18 #include <QToolButton> 18 #include <QToolButton>
19 19
20 class LevelPanWidget; 20 class LevelPanWidget;
21 class QMenu;
21 22
22 class LevelPanToolButton : public QToolButton 23 class LevelPanToolButton : public QToolButton
23 { 24 {
24 Q_OBJECT 25 Q_OBJECT
25 26
35 36
36 /// Discover whether the level range includes muting or not 37 /// Discover whether the level range includes muting or not
37 bool includesMute() const; 38 bool includesMute() const;
38 39
39 void setImageSize(int pixels); 40 void setImageSize(int pixels);
41
42 /// Specify whether a right-click context menu is provided
43 void setProvideContextMenu(bool);
40 44
41 void setBigImageSize(int pixels); 45 void setBigImageSize(int pixels);
42 46
43 public slots: 47 public slots:
44 /// Set level in the range [0,1] -- will be rounded 48 /// Set level in the range [0,1] -- will be rounded
53 /// Specify whether the level range should include muting or not 57 /// Specify whether the level range should include muting or not
54 void setIncludeMute(bool); 58 void setIncludeMute(bool);
55 59
56 void setEnabled(bool enabled); 60 void setEnabled(bool enabled);
57 61
62 protected slots:
63 void contextMenuRequested(const QPoint &);
64
58 signals: 65 signals:
59 void levelChanged(float); 66 void levelChanged(float);
60 void panChanged(float); 67 void panChanged(float);
61 68
62 void mouseEntered(); 69 void mouseEntered();
76 LevelPanWidget *m_lpw; 83 LevelPanWidget *m_lpw;
77 int m_pixels; 84 int m_pixels;
78 int m_pixelsBig; 85 int m_pixelsBig;
79 bool m_muted; 86 bool m_muted;
80 float m_savedLevel; 87 float m_savedLevel;
88 bool m_provideContextMenu;
89 QMenu *m_lastContextMenu;
81 }; 90 };
82 91
83 #endif 92 #endif