Mercurial > hg > svgui
comparison widgets/Thumbwheel.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 | bbc3f537564c |
children | a798a7b5e215 |
comparison
equal
deleted
inserted
replaced
1588:0f36e0eca6b0 | 1589:27ea5d61b402 |
---|---|
69 { | 69 { |
70 if (!m_provideContextMenu) { | 70 if (!m_provideContextMenu) { |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 if (m_lastContextMenu) { | 74 delete m_lastContextMenu; |
75 delete m_lastContextMenu; | 75 m_lastContextMenu = new QMenu; |
76 } | 76 auto m = m_lastContextMenu; |
77 | |
78 QMenu *m = new QMenu; | |
79 | 77 |
80 if (m_title == "") { | 78 if (m_title == "") { |
81 MenuTitle::addTitle(m, tr("Thumbwheel")); | 79 MenuTitle::addTitle(m, tr("Thumbwheel")); |
82 } else { | 80 } else { |
83 MenuTitle::addTitle(m, m_title); | 81 MenuTitle::addTitle(m, m_title); |
91 [=]() { | 89 [=]() { |
92 resetToDefault(); | 90 resetToDefault(); |
93 }); | 91 }); |
94 | 92 |
95 m->popup(mapToGlobal(pos)); | 93 m->popup(mapToGlobal(pos)); |
96 m_lastContextMenu = m; | |
97 } | 94 } |
98 | 95 |
99 void | 96 void |
100 Thumbwheel::setRangeMapper(RangeMapper *mapper) | 97 Thumbwheel::setRangeMapper(RangeMapper *mapper) |
101 { | 98 { |
117 { | 114 { |
118 m_showTooltip = show; | 115 m_showTooltip = show; |
119 m_noMappedUpdate = true; | 116 m_noMappedUpdate = true; |
120 updateMappedValue(getValue()); | 117 updateMappedValue(getValue()); |
121 m_noMappedUpdate = false; | 118 m_noMappedUpdate = false; |
119 } | |
120 | |
121 void | |
122 Thumbwheel::setProvideContextMenu(bool provide) | |
123 { | |
124 m_provideContextMenu = provide; | |
122 } | 125 } |
123 | 126 |
124 void | 127 void |
125 Thumbwheel::setMinimumValue(int min) | 128 Thumbwheel::setMinimumValue(int min) |
126 { | 129 { |