* @brief Sets the UI timer frequency in Hz. */
| 113 | * @brief Sets the UI timer frequency in Hz. |
| 114 | */ |
| 115 | void Misc::TimerEvents::setFPS(int hz) |
| 116 | { |
| 117 | hz = qBound(1, hz, 240); |
| 118 | |
| 119 | if (m_uiTimerHz != hz) { |
| 120 | m_uiTimerHz = hz; |
| 121 | m_settings.setValue("uiRefreshRate", hz); |
| 122 | |
| 123 | if (m_uiTimer.isActive()) { |
| 124 | m_uiTimer.stop(); |
| 125 | m_uiTimer.start(1000 / m_uiTimerHz, Qt::PreciseTimer, this); |
| 126 | } |
| 127 | |
| 128 | Q_EMIT fpsChanged(); |
| 129 | } |
| 130 | } |
no test coverage detected