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

Method PopulateSelection

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

Source from the content-addressed store, hash-verified

569}
570
571void TempVariableSelection::PopulateSelection()
572{
573 std::vector<TempVariable> vars;
574 const auto appendVars = [&vars](const Macro *macro,
575 const MacroSegment *segment) {
576 const auto newVars = macro->GetTempVars(segment);
577 vars.insert(vars.end(), newVars.begin(), newVars.end());
578 };
579
580 const auto segment = GetSegment();
581 if (!segment) {
582 return;
583 }
584
585 auto macro = segment->GetMacro();
586 appendVars(macro, segment);
587
588 while ((macro = getParentMacro(macro))) {
589 appendVars(macro,
590 getMacroSegmentFromNestedMacro(macro, _macroEdits));
591 }
592
593 if (vars.empty()) {
594 return;
595 }
596
597 for (const auto &var : vars) {
598 QVariant variant;
599 variant.setValue(var.GetRef());
600 _selection->addItem(QString::fromStdString(var.Name()),
601 variant);
602 }
603
604 // Make sure content is readable when expanding combobox
605 auto view = _selection->view();
606 if (view) {
607 view->setMinimumWidth(view->sizeHintForColumn(0));
608 _selection->setMinimumWidth(view->sizeHintForColumn(0));
609 view->updateGeometry();
610 _selection->updateGeometry();
611 }
612
613 adjustSize();
614 updateGeometry();
615}
616
617static MacroEdit *
618getMacroEditFromMacro(const std::vector<MacroEdit *> &macroEdits, Macro *macro)

Callers

nothing calls this directly

Calls 10

getParentMacroFunction · 0.85
GetTempVarsMethod · 0.80
GetRefMethod · 0.80
endMethod · 0.45
beginMethod · 0.45
GetMacroMethod · 0.45
emptyMethod · 0.45
setValueMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected