Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
1588:0f36e0eca6b0 | 1589:27ea5d61b402 |
---|---|
104 void AudioDial::contextMenuRequested(const QPoint &pos) | 104 void AudioDial::contextMenuRequested(const QPoint &pos) |
105 { | 105 { |
106 if (!m_provideContextMenu) { | 106 if (!m_provideContextMenu) { |
107 return; | 107 return; |
108 } | 108 } |
109 | 109 |
110 if (m_lastContextMenu) { | 110 delete m_lastContextMenu; |
111 delete m_lastContextMenu; | 111 m_lastContextMenu = new QMenu; |
112 } | 112 auto m = m_lastContextMenu; |
113 | |
114 QMenu *m = new QMenu; | |
115 | 113 |
116 if (m_title == "") { | 114 if (m_title == "") { |
117 MenuTitle::addTitle(m, tr("Dial")); | 115 MenuTitle::addTitle(m, tr("Dial")); |
118 } else { | 116 } else { |
119 MenuTitle::addTitle(m, m_title); | 117 MenuTitle::addTitle(m, m_title); |
127 [=]() { | 125 [=]() { |
128 setToDefault(); | 126 setToDefault(); |
129 }); | 127 }); |
130 | 128 |
131 m->popup(mapToGlobal(pos)); | 129 m->popup(mapToGlobal(pos)); |
132 m_lastContextMenu = m; | |
133 } | 130 } |
134 | 131 |
135 void AudioDial::setRangeMapper(RangeMapper *mapper) | 132 void AudioDial::setRangeMapper(RangeMapper *mapper) |
136 { | 133 { |
137 if (m_rangeMapper == mapper) return; | 134 if (m_rangeMapper == mapper) return; |