mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
UI: Update quick transitions on transition add/removal
Fixes a bug where the individual drop-down lists of each quick transition would not have the correct available transitions listed if transitions were added, renamed, or removed
This commit is contained in:
@@ -392,6 +392,9 @@ void OBSBasic::AddTransition()
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||
|
||||
ClearQuickTransitionWidgets();
|
||||
RefreshQuickTransitions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,6 +448,9 @@ void OBSBasic::on_transitionRemove_clicked()
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||
|
||||
ClearQuickTransitionWidgets();
|
||||
RefreshQuickTransitions();
|
||||
}
|
||||
|
||||
void OBSBasic::RenameTransition()
|
||||
@@ -483,8 +489,11 @@ void OBSBasic::RenameTransition()
|
||||
|
||||
obs_source_set_name(transition, name.c_str());
|
||||
int idx = ui->transitions->findData(variant);
|
||||
if (idx != -1)
|
||||
if (idx != -1) {
|
||||
ui->transitions->setItemText(idx, QT_UTF8(name.c_str()));
|
||||
ClearQuickTransitionWidgets();
|
||||
RefreshQuickTransitions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,6 +928,31 @@ void OBSBasic::QuickTransitionRemoveClicked()
|
||||
quickTransitions.erase(quickTransitions.begin() + idx);
|
||||
}
|
||||
|
||||
void OBSBasic::ClearQuickTransitionWidgets()
|
||||
{
|
||||
if (!IsPreviewProgramMode())
|
||||
return;
|
||||
|
||||
QVBoxLayout *programLayout =
|
||||
reinterpret_cast<QVBoxLayout*>(programOptions->layout());
|
||||
|
||||
for (int idx = 0;; idx++) {
|
||||
QLayoutItem *item = programLayout->itemAt(idx);
|
||||
if (!item)
|
||||
break;
|
||||
|
||||
QWidget *widget = item->widget();
|
||||
if (!widget)
|
||||
continue;
|
||||
|
||||
int id = widget->property("id").toInt();
|
||||
if (id != 0) {
|
||||
delete widget;
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::RefreshQuickTransitions()
|
||||
{
|
||||
if (!IsPreviewProgramMode())
|
||||
|
||||
Reference in New Issue
Block a user