mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Allow drag and drop reordering of macros
This commit is contained in:
parent
83df1ab658
commit
88dff37776
|
|
@ -584,6 +584,15 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::MoveAction</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ public slots:
|
|||
void MoveMacroConditionUp(int idx);
|
||||
void MoveMacroConditionDown(int idx);
|
||||
void HighlightMatchedMacros();
|
||||
void MacroDragDropReorder(QModelIndex, int, int, QModelIndex, int);
|
||||
|
||||
void on_screenRegionSwitches_currentRowChanged(int idx);
|
||||
void on_showFrame_clicked();
|
||||
|
|
|
|||
|
|
@ -384,6 +384,25 @@ void AdvSceneSwitcher::on_macros_currentRowChanged(int idx)
|
|||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::MacroDragDropReorder(QModelIndex, int from, int,
|
||||
QModelIndex, int to)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
if (from > to) {
|
||||
std::rotate(switcher->macros.rend() - from - 1,
|
||||
switcher->macros.rend() - from,
|
||||
switcher->macros.rend() - to);
|
||||
} else {
|
||||
std::rotate(switcher->macros.begin() + from,
|
||||
switcher->macros.begin() + from + 1,
|
||||
switcher->macros.begin() + to);
|
||||
}
|
||||
|
||||
for (auto &m : switcher->macros) {
|
||||
m->ResolveMacroRef();
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupMacroTab()
|
||||
{
|
||||
const QSignalBlocker signalBlocker(ui->macros);
|
||||
|
|
@ -401,6 +420,12 @@ void AdvSceneSwitcher::setupMacroTab()
|
|||
ui->macroHelp->setVisible(false);
|
||||
}
|
||||
|
||||
connect(ui->macros->model(),
|
||||
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
|
||||
this,
|
||||
SLOT(MacroDragDropReorder(QModelIndex, int, int, QModelIndex,
|
||||
int)));
|
||||
|
||||
delete conditionsList;
|
||||
conditionsList = new MacroSegmentList(this);
|
||||
conditionsList->SetHelpMsg(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user