UI: Fix group sub-item selection bug
If a group's sub-item is selected in the list box and you select the group via the preview, the sub-item would be deselected, but that deselection would not be applied to the sub-item in the list box despite being deselected.
This commit is contained in:
parent
62d08fe38f
commit
448399d5ea
@ -119,6 +119,7 @@ void SourceTreeItem::DisconnectSignals()
|
||||
{
|
||||
sceneRemoveSignal.Disconnect();
|
||||
itemRemoveSignal.Disconnect();
|
||||
deselectSignal.Disconnect();
|
||||
visibleSignal.Disconnect();
|
||||
renameSignal.Disconnect();
|
||||
removeSignal.Disconnect();
|
||||
@ -163,6 +164,16 @@ void SourceTreeItem::ReconnectSignals()
|
||||
Q_ARG(bool, visible));
|
||||
};
|
||||
|
||||
auto itemDeselect = [] (void *data, calldata_t *cd)
|
||||
{
|
||||
SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data);
|
||||
obs_sceneitem_t *curItem =
|
||||
(obs_sceneitem_t*)calldata_ptr(cd, "item");
|
||||
|
||||
if (curItem == this_->sceneitem)
|
||||
QMetaObject::invokeMethod(this_, "Deselect");
|
||||
};
|
||||
|
||||
auto reorderGroup = [] (void *data, calldata_t*)
|
||||
{
|
||||
SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data);
|
||||
@ -185,6 +196,10 @@ void SourceTreeItem::ReconnectSignals()
|
||||
this);
|
||||
}
|
||||
|
||||
if (scene != GetCurrentScene())
|
||||
deselectSignal.Connect(signal, "item_deselect", itemDeselect,
|
||||
this);
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
|
||||
auto renamed = [] (void *data, calldata_t *cd)
|
||||
@ -432,6 +447,11 @@ void SourceTreeItem::ExpandClicked(bool checked)
|
||||
tree->GetStm()->CollapseGroup(sceneitem);
|
||||
}
|
||||
|
||||
void SourceTreeItem::Deselect()
|
||||
{
|
||||
tree->SelectItem(sceneitem, false);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
void SourceTreeModel::OBSFrontendEvent(enum obs_frontend_event event, void *ptr)
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
OBSSignal sceneRemoveSignal;
|
||||
OBSSignal itemRemoveSignal;
|
||||
OBSSignal groupReorderSignal;
|
||||
OBSSignal deselectSignal;
|
||||
OBSSignal visibleSignal;
|
||||
OBSSignal renameSignal;
|
||||
OBSSignal removeSignal;
|
||||
@ -77,6 +78,8 @@ private slots:
|
||||
void Renamed(const QString &name);
|
||||
|
||||
void ExpandClicked(bool checked);
|
||||
|
||||
void Deselect();
|
||||
};
|
||||
|
||||
class SourceTreeModel : public QAbstractListModel {
|
||||
|
Loading…
x
Reference in New Issue
Block a user