mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Add deferred function to update context bar
With the queued connection in d68484e7
, the "Deselect" signal for
sources which are being deleted is never fired, as the object is gone by
the time the queued signal is processed. This results in the context bar
not updating.
This commit adds a new UpdateContextBarDeferred function, allowing
queuing of only the context bar update instead of the whole signal
handler.
This commit is contained in:
parent
580eecda01
commit
38ad3ba18f
|
@ -227,8 +227,7 @@ void SourceTreeItem::ReconnectSignals()
|
|||
(obs_sceneitem_t *)calldata_ptr(cd, "item");
|
||||
|
||||
if (curItem == this_->sceneitem)
|
||||
QMetaObject::invokeMethod(this_, "Select",
|
||||
Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this_, "Select");
|
||||
};
|
||||
|
||||
auto itemDeselect = [](void *data, calldata_t *cd) {
|
||||
|
@ -238,8 +237,7 @@ void SourceTreeItem::ReconnectSignals()
|
|||
(obs_sceneitem_t *)calldata_ptr(cd, "item");
|
||||
|
||||
if (curItem == this_->sceneitem)
|
||||
QMetaObject::invokeMethod(this_, "Deselect",
|
||||
Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this_, "Deselect");
|
||||
};
|
||||
|
||||
auto reorderGroup = [](void *data, calldata_t *) {
|
||||
|
@ -538,13 +536,13 @@ void SourceTreeItem::ExpandClicked(bool checked)
|
|||
void SourceTreeItem::Select()
|
||||
{
|
||||
tree->SelectItem(sceneitem, true);
|
||||
OBSBasic::Get()->UpdateContextBar();
|
||||
OBSBasic::Get()->UpdateContextBarDeferred();
|
||||
}
|
||||
|
||||
void SourceTreeItem::Deselect()
|
||||
{
|
||||
tree->SelectItem(sceneitem, false);
|
||||
OBSBasic::Get()->UpdateContextBar();
|
||||
OBSBasic::Get()->UpdateContextBarDeferred();
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
|
|
|
@ -2948,6 +2948,12 @@ static bool is_network_media_source(obs_source_t *source, const char *id)
|
|||
return !is_local_file;
|
||||
}
|
||||
|
||||
void OBSBasic::UpdateContextBarDeferred(bool force)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "UpdateContextBar",
|
||||
Qt::QueuedConnection, Q_ARG(bool, force));
|
||||
}
|
||||
|
||||
void OBSBasic::UpdateContextBar(bool force)
|
||||
{
|
||||
if (!ui->contextContainer->isVisible() && !force)
|
||||
|
|
|
@ -1024,6 +1024,7 @@ public slots:
|
|||
|
||||
void ClearContextBar();
|
||||
void UpdateContextBar(bool force = false);
|
||||
void UpdateContextBarDeferred(bool force = false);
|
||||
|
||||
public:
|
||||
explicit OBSBasic(QWidget *parent = 0);
|
||||
|
|
Loading…
Reference in a new issue