MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / Rebuild

Method Rebuild

lib/utils/temp-variable.cpp:868–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866}
867
868void TempVarOutputMappingsWidget::Rebuild()
869{
870 _loading = true;
871
872 // Remove all existing row widgets from layout and delete them
873 for (auto &row : _rows) {
874 _rowsLayout->removeWidget(row.container);
875 delete row.container;
876 }
877 _rows.clear();
878
879 if (!_segment) {
880 _loading = false;
881 UpdateVisibility();
882 return;
883 }
884
885 const auto &mappings = _segment->GetVarMappings();
886 for (int i = 0; i < (int)mappings.size(); i++) {
887 const auto &mapping = mappings[i];
888
889 auto container = new QWidget(this);
890 auto rowLayout = new QHBoxLayout();
891 rowLayout->setContentsMargins(0, 0, 0, 0);
892
893 auto tempVarCombo = new FilterComboBox(
894 container,
895 obs_module_text("AdvSceneSwitcher.tempVar.select"));
896 tempVarCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
897 tempVarCombo->setMaximumWidth(350);
898 tempVarCombo->setDuplicatesEnabled(true);
899 PopulateTempVarCombo(tempVarCombo);
900 if (mapping.tempVar.HasValidID()) {
901 QVariant v;
902 v.setValue(mapping.tempVar);
903 tempVarCombo->setCurrentIndex(
904 tempVarCombo->findData(v));
905 }
906
907 auto arrowLabel = new QLabel(container);
908 {
909 QIcon icon;
910 const auto path = (GetThemeTypeName() == "Light")
911 ? "theme:Light/right.svg"
912 : "theme:Dark/right.svg";
913 icon.addFile(QString::fromUtf8(path), QSize(),
914 QIcon::Normal, QIcon::Off);
915 arrowLabel->setPixmap(icon.pixmap(16, 16));
916 }
917
918 auto varSel = new VariableSelection(container);
919 varSel->SetVariable(mapping.variable);
920
921 auto removeBtn = new QToolButton(container);
922 removeBtn->setProperty("themeID", QVariant(QString::fromUtf8(
923 "removeIconSmall")));
924 removeBtn->setProperty(
925 "class", QVariant(QString::fromUtf8("icon-trash")));

Callers

nothing calls this directly

Calls 8

obs_module_textFunction · 0.85
RemoveFunction · 0.85
sizeMethod · 0.80
HasValidIDMethod · 0.80
GetThemeTypeNameFunction · 0.70
setValueMethod · 0.45
SetVariableMethod · 0.45
setToolTipMethod · 0.45

Tested by

no test coverage detected