| 43 | } |
| 44 | |
| 45 | void setGrDb(float grDb) |
| 46 | { |
| 47 | if (std::fabs(grDb - m_grDb) < 0.05f) return; |
| 48 | m_grDb = grDb; |
| 49 | constexpr float kMaxGr = 20.0f; |
| 50 | m_smooth.setTarget(std::clamp(-m_grDb, 0.0f, kMaxGr) / kMaxGr); |
| 51 | if (!m_smooth.needsAnimation()) { |
| 52 | if (m_animTimer.isActive()) m_animTimer.stop(); |
| 53 | update(); |
| 54 | } else if (!m_animTimer.isActive()) { |
| 55 | m_animElapsed.restart(); |
| 56 | m_animTimer.start(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | protected: |
| 61 | void paintEvent(QPaintEvent*) override |