Mercurial > hg > svgui
comparison widgets/AudioDial.cpp @ 170:bdba24db0446
* minor fixes to tooltip
author | Chris Cannam |
---|---|
date | Tue, 17 Oct 2006 13:50:17 +0000 |
parents | d4be66d61c04 |
children | dbd34ff746c7 |
comparison
equal
deleted
inserted
replaced
169:86cee2b060c7 | 170:bdba24db0446 |
---|---|
67 | 67 |
68 | 68 |
69 // Constructor. | 69 // Constructor. |
70 AudioDial::AudioDial(QWidget *parent) : | 70 AudioDial::AudioDial(QWidget *parent) : |
71 QDial(parent), | 71 QDial(parent), |
72 m_knobColor(Qt::black), m_meterColor(Qt::white), | 72 m_knobColor(Qt::black), |
73 m_meterColor(Qt::white), | |
73 m_defaultValue(0), | 74 m_defaultValue(0), |
74 m_mappedValue(0), | 75 m_mappedValue(0), |
75 m_noMappedUpdate(false), | 76 m_noMappedUpdate(false), |
76 m_showTooltip(false), | 77 m_showTooltip(false), |
77 m_rangeMapper(0) | 78 m_rangeMapper(0) |
88 } | 89 } |
89 | 90 |
90 | 91 |
91 void AudioDial::setRangeMapper(RangeMapper *mapper) | 92 void AudioDial::setRangeMapper(RangeMapper *mapper) |
92 { | 93 { |
93 if (!m_rangeMapper) { | 94 if (!m_rangeMapper && mapper) { |
94 connect(this, SIGNAL(valueChanged(int)), | 95 connect(this, SIGNAL(valueChanged(int)), |
95 this, SLOT(updateMappedValue(int))); | 96 this, SLOT(updateMappedValue(int))); |
96 } | 97 } |
98 | |
97 delete m_rangeMapper; | 99 delete m_rangeMapper; |
98 m_rangeMapper = mapper; | 100 m_rangeMapper = mapper; |
99 m_mappedValue = m_rangeMapper->getValueForPosition(value()); | 101 |
102 if (m_rangeMapper) { | |
103 m_mappedValue = m_rangeMapper->getValueForPosition(value()); | |
104 } else { | |
105 m_mappedValue = value(); | |
106 } | |
100 } | 107 } |
101 | 108 |
102 | 109 |
103 void AudioDial::paintEvent(QPaintEvent *) | 110 void AudioDial::paintEvent(QPaintEvent *) |
104 { | 111 { |
344 } | 351 } |
345 | 352 |
346 | 353 |
347 void AudioDial::updateMappedValue(int value) | 354 void AudioDial::updateMappedValue(int value) |
348 { | 355 { |
349 if (m_rangeMapper) { | 356 if (!m_noMappedUpdate) { |
350 if (!m_noMappedUpdate) { | 357 if (m_rangeMapper) { |
351 m_mappedValue = m_rangeMapper->getValueForPosition(value); | 358 m_mappedValue = m_rangeMapper->getValueForPosition(value); |
359 } else { | |
360 m_mappedValue = value; | |
352 } | 361 } |
353 } | 362 } |
354 | 363 |
355 if (m_showTooltip) { | 364 if (m_showTooltip) { |
356 QString name = objectName(); | 365 QString name = objectName(); |