mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-07-02 08:31:57 -05:00
Focus segment type selection when new segment is added
This commit is contained in:
parent
725ad2beb0
commit
2a581c3e2c
|
|
@ -164,4 +164,9 @@ std::shared_ptr<MacroSegment> MacroActionEdit::Data() const
|
|||
return *_entryData;
|
||||
}
|
||||
|
||||
void MacroActionEdit::FocusTypeSelection()
|
||||
{
|
||||
_actionSelection->setFocus();
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public:
|
|||
std::shared_ptr<MacroAction> * = nullptr);
|
||||
void SetupWidgets(bool basicSetup = false);
|
||||
void SetEntryData(std::shared_ptr<MacroAction> *);
|
||||
void FocusTypeSelection() override;
|
||||
|
||||
private slots:
|
||||
void ActionSelectionChanged(const QString &text);
|
||||
|
|
|
|||
|
|
@ -305,4 +305,9 @@ std::shared_ptr<MacroSegment> MacroConditionEdit::Data() const
|
|||
return *_entryData;
|
||||
}
|
||||
|
||||
void MacroConditionEdit::FocusTypeSelection()
|
||||
{
|
||||
_conditionSelection->setFocus();
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public:
|
|||
void SetRootNode(bool);
|
||||
void SetupWidgets(bool basicSetup = false);
|
||||
void SetEntryData(std::shared_ptr<MacroCondition> *);
|
||||
void FocusTypeSelection() override;
|
||||
|
||||
private slots:
|
||||
void LogicSelectionChanged(int idx);
|
||||
|
|
|
|||
|
|
@ -650,6 +650,18 @@ void MacroEdit::HighlightCondition(int idx, QColor color) const
|
|||
ui->conditionsList->Highlight(idx, color);
|
||||
}
|
||||
|
||||
void MacroEdit::ScrollAndFocusNewSegment(MacroSegmentList *list, int newIdx,
|
||||
int *currentIdx)
|
||||
{
|
||||
QTimer::singleShot(0, this, [this, list, newIdx, currentIdx]() {
|
||||
list->ensureWidgetVisible(list->WidgetAt(*currentIdx));
|
||||
auto *widget = list->WidgetAt(newIdx);
|
||||
if (widget) {
|
||||
widget->FocusTypeSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void resetSegmentHighlights(MacroSegmentList *list)
|
||||
{
|
||||
MacroSegmentEdit *widget = nullptr;
|
||||
|
|
@ -1087,10 +1099,7 @@ void MacroEdit::AddMacroAction(Macro *macro, int idx, const std::string &id,
|
|||
ui->actionsList->SetHelpMsgVisible(false);
|
||||
emit(MacroSegmentOrderChanged());
|
||||
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
ui->actionsList->ensureWidgetVisible(
|
||||
ui->actionsList->WidgetAt(currentActionIdx));
|
||||
});
|
||||
ScrollAndFocusNewSegment(ui->actionsList, idx, ¤tActionIdx);
|
||||
}
|
||||
|
||||
void MacroEdit::AddMacroAction(int idx)
|
||||
|
|
@ -1398,10 +1407,8 @@ void MacroEdit::AddMacroElseAction(Macro *macro, int idx, const std::string &id,
|
|||
ui->elseActionsList->SetHelpMsgVisible(false);
|
||||
emit(MacroSegmentOrderChanged());
|
||||
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
ui->elseActionsList->ensureWidgetVisible(
|
||||
ui->elseActionsList->WidgetAt(currentElseActionIdx));
|
||||
});
|
||||
ScrollAndFocusNewSegment(ui->elseActionsList, idx,
|
||||
¤tElseActionIdx);
|
||||
}
|
||||
|
||||
void MacroEdit::AddMacroElseAction(int idx)
|
||||
|
|
@ -1611,10 +1618,7 @@ void MacroEdit::AddMacroCondition(Macro *macro, int idx, const std::string &id,
|
|||
ui->conditionsList->SetHelpMsgVisible(false);
|
||||
emit(MacroSegmentOrderChanged());
|
||||
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
ui->conditionsList->ensureWidgetVisible(
|
||||
ui->conditionsList->WidgetAt(currentConditionIdx));
|
||||
});
|
||||
ScrollAndFocusNewSegment(ui->conditionsList, idx, ¤tConditionIdx);
|
||||
}
|
||||
|
||||
void MacroEdit::on_conditionAdd_clicked()
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ private:
|
|||
void PopulateMacroActions(Macro &m, uint32_t afterIdx = 0);
|
||||
void PopulateMacroElseActions(Macro &m, uint32_t afterIdx = 0);
|
||||
void PopulateMacroConditions(Macro &m, uint32_t afterIdx = 0);
|
||||
void ScrollAndFocusNewSegment(MacroSegmentList *list, int newIdx,
|
||||
int *currentIdx);
|
||||
void SetupMacroSegmentSelection(MacroSection type, int idx);
|
||||
void
|
||||
SetupContextMenu(const QPoint &pos,
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ public:
|
|||
void SetSelected(bool);
|
||||
virtual std::shared_ptr<MacroSegment> Data() const = 0;
|
||||
virtual void SetupWidgets(bool basicSetup = false) = 0;
|
||||
virtual void FocusTypeSelection() {}
|
||||
|
||||
void SetupVarMappings(MacroSegment *segment);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user