UI: Use valueChanged() signal for T-Bar everywhere
The sliderMoved signal doesn't trigger when clicking on the slider, only the valueChanged signal. According to QTBUG-72995 this is intentional, since the documentation states that sliderDown also needs to be true for the sliderMoved signal to be triggered. As for why sliderDown isn't true when clicking, or why that would even be necessary for a signal that should trigger when the slider is moved (and it very clearly moves) remains a mystery. Also gets rid of the wrong usage of the on_foo_bar slot declaration, which should only be used for signals where the sender is part of a UI file and it gets connected automatically. While it of course is possible to connect it manually, this is against convention and can cause confusion. In this case it was particularly wrong since even if tBar was part of a UI file (which it isn't), the method should have been called on_tBar_valueChanged instead of on_tbar_position_valueChanged.
This commit is contained in:
parent
a44700871b
commit
8d4a0b3645
2 changed files with 4 additions and 14 deletions
|
|
@ -793,9 +793,7 @@ void OBSBasic::CreateProgramOptions()
|
|||
|
||||
tBar->setProperty("themeID", "tBarSlider");
|
||||
|
||||
connect(tBar, SIGNAL(sliderMoved(int)), this, SLOT(TBarChanged(int)));
|
||||
connect(tBar, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(on_tbar_position_valueChanged(int)));
|
||||
connect(tBar, &QSlider::valueChanged, this, &OBSBasic::TBarChanged);
|
||||
connect(tBar, SIGNAL(sliderReleased()), this, SLOT(TBarReleased()));
|
||||
|
||||
layout->addStretch(0);
|
||||
|
|
@ -918,8 +916,6 @@ void OBSBasic::TBarChanged(int value)
|
|||
{
|
||||
OBSSourceAutoRelease transition = obs_get_output_source(0);
|
||||
|
||||
tBar->setValue(value);
|
||||
|
||||
if (!tBarActive) {
|
||||
OBSSource sceneSource = GetCurrentSceneSource();
|
||||
OBSSource tBarTr = GetOverrideTransition(sceneSource);
|
||||
|
|
@ -945,6 +941,9 @@ void OBSBasic::TBarChanged(int value)
|
|||
|
||||
obs_transition_set_manual_time(transition,
|
||||
(float)value / T_BAR_PRECISION_F);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
|
||||
}
|
||||
|
||||
int OBSBasic::GetTbarPosition()
|
||||
|
|
@ -952,14 +951,6 @@ int OBSBasic::GetTbarPosition()
|
|||
return tBar->value();
|
||||
}
|
||||
|
||||
void OBSBasic::on_tbar_position_valueChanged(int value)
|
||||
{
|
||||
if (api) {
|
||||
api->on_event(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
|
||||
}
|
||||
|
||||
UNUSED_PARAMETER(value);
|
||||
}
|
||||
void OBSBasic::on_modeSwitch_clicked()
|
||||
{
|
||||
SetPreviewProgramMode(!IsPreviewProgramMode());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue