Qt: clamp progress bar values

This commit is contained in:
Megamouse 2018-06-09 16:27:56 +02:00 committed by kd-11
parent 88bfdb0c05
commit 2b8cab906c
7 changed files with 21 additions and 26 deletions

View file

@ -439,10 +439,10 @@ void gs_frame::progress_increment(int delta)
#ifdef _WIN32
if (m_tb_progress)
{
m_tb_progress->setValue(m_tb_progress->value() + delta);
m_tb_progress->setValue(std::clamp(m_tb_progress->value() + delta, m_tb_progress->minimum(), m_tb_progress->maximum()));
}
#elif HAVE_QTDBUS
m_progress_value += delta;
m_progress_value = std::clamp(m_progress_value + delta, 0, m_gauge_max);
UpdateProgress(m_progress_value);
#endif
}