mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add support for widget caching to SceneItemSelectionWidget
This commit is contained in:
parent
fcf57ee031
commit
9805601c07
|
|
@ -589,6 +589,7 @@ static QStringList getSceneItemsList(SceneSelection &s)
|
|||
|
||||
void SceneItemSelectionWidget::PopulateItemSelection()
|
||||
{
|
||||
_sources->clear();
|
||||
const QStringList sceneItems = getSceneItemsList(_scene);
|
||||
AddSelectionGroup(_sources, sceneItems, false);
|
||||
_sources->setCurrentIndex(-1);
|
||||
|
|
@ -759,8 +760,8 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
|
|||
idx += 1;
|
||||
}
|
||||
_nameConflictIndex->setCurrentIndex(idx);
|
||||
_sources->setCurrentText(
|
||||
QString::fromStdString(GetWeakSourceName(item._source)));
|
||||
_sources->setCurrentIndex(_sources->findText(
|
||||
QString::fromStdString(GetWeakSourceName(item._source))));
|
||||
_sourceGroups->setCurrentText(
|
||||
QString::fromStdString(GetWeakSourceName(item._source)));
|
||||
_variables->SetVariable(item._variable);
|
||||
|
|
@ -773,7 +774,10 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
|
|||
|
||||
_currentSelection = item;
|
||||
|
||||
SetNameConflictVisibility();
|
||||
{
|
||||
const QSignalBlocker b(_nameConflictIndex);
|
||||
SetNameConflictVisibility();
|
||||
}
|
||||
|
||||
switch (item._nameConflictSelectionType) {
|
||||
case SceneItemSelection::NameConflictSelection::ALL:
|
||||
|
|
@ -795,10 +799,17 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
|
|||
|
||||
void SceneItemSelectionWidget::SetScene(const SceneSelection &s)
|
||||
{
|
||||
|
||||
_scene = s;
|
||||
_sources->clear();
|
||||
_nameConflictIndex->hide();
|
||||
if (_currentSelection._type != SceneItemSelection::Type::SOURCE_NAME) {
|
||||
PopulateItemSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
auto previous = _currentSelection;
|
||||
PopulateItemSelection();
|
||||
SetSceneItem(previous);
|
||||
}
|
||||
|
||||
void SceneItemSelectionWidget::ShowPlaceholder(bool value)
|
||||
|
|
@ -819,6 +830,15 @@ void SceneItemSelectionWidget::SetPlaceholderType(Placeholder t,
|
|||
}
|
||||
}
|
||||
|
||||
void SceneItemSelectionWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
const QSignalBlocker b1(_sources);
|
||||
const QSignalBlocker b2(this);
|
||||
PopulateItemSelection();
|
||||
SetSceneItem(_currentSelection);
|
||||
}
|
||||
|
||||
void SceneItemSelectionWidget::SceneChanged(const SceneSelection &s)
|
||||
{
|
||||
SetScene(s);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,10 @@ public:
|
|||
void SetScene(const SceneSelection &);
|
||||
void ShowPlaceholder(bool);
|
||||
void SetPlaceholderType(Placeholder t, bool resetSelection = true);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
signals:
|
||||
void SceneItemChanged(const SceneItemSelection &);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user