Merge pull request #2954 from cg2121/property-list-reorder

UI: Allow drag & drop reorder of property lists
This commit is contained in:
Jim 2020-07-07 19:30:33 -07:00 committed by GitHub
commit d027c41165
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -594,6 +594,13 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
WidgetInfo *info = new WidgetInfo(this, prop, list);
list->setDragDropMode(QAbstractItemView::InternalMove);
connect(list->model(),
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
info,
SLOT(EditListReordered(const QModelIndex &, int, int,
const QModelIndex &, int)));
QVBoxLayout *sideLayout = new QVBoxLayout();
NewButton(sideLayout, info, "addIconSmall", &WidgetInfo::EditListAdd);
NewButton(sideLayout, info, "removeIconSmall",
@ -1774,6 +1781,19 @@ void WidgetInfo::GroupChanged(const char *setting)
: true);
}
void WidgetInfo::EditListReordered(const QModelIndex &parent, int start,
int end, const QModelIndex &destination,
int row)
{
UNUSED_PARAMETER(parent);
UNUSED_PARAMETER(start);
UNUSED_PARAMETER(end);
UNUSED_PARAMETER(destination);
UNUSED_PARAMETER(row);
EditableListChanged();
}
void WidgetInfo::EditableListChanged()
{
const char *setting = obs_property_name(property);

View file

@ -58,6 +58,8 @@ public slots:
void EditListEdit();
void EditListUp();
void EditListDown();
void EditListReordered(const QModelIndex &parent, int start, int end,
const QModelIndex &destination, int row);
};
/* ------------------------------------------------------------------------- */