UI: Fix multiview update regression

Fixes bug where multiview won't update when reordering scenes with drag
and drop. Was originally fixed with #2114, but bcddf4d caused a
regression where it didn't work anymore.
This commit is contained in:
Clayton Groeneveld 2020-08-21 03:39:42 -05:00 committed by jp9000
parent 27169f0d2e
commit f580de0bc7
4 changed files with 14 additions and 16 deletions

View File

@ -106,7 +106,11 @@ void SceneTree::startDrag(Qt::DropActions supportedActions)
void SceneTree::dropEvent(QDropEvent *event) void SceneTree::dropEvent(QDropEvent *event)
{ {
QListWidget::dropEvent(event); QListWidget::dropEvent(event);
if (event->source() == this && gridMode) {
if (event->source() != this)
return;
if (gridMode) {
int scrollWid = verticalScrollBar()->sizeHint().width(); int scrollWid = verticalScrollBar()->sizeHint().width();
int h = visualItemRect(item(count() - 1)).bottom(); int h = visualItemRect(item(count() - 1)).bottom();
@ -131,6 +135,8 @@ void SceneTree::dropEvent(QDropEvent *event)
setCurrentItem(item); setCurrentItem(item);
resize(size()); resize(size());
} }
emit scenesReordered();
} }
void SceneTree::dragMoveEvent(QDragMoveEvent *event) void SceneTree::dragMoveEvent(QDragMoveEvent *event)

View File

@ -34,4 +34,7 @@ protected:
virtual void dragMoveEvent(QDragMoveEvent *event) override; virtual void dragMoveEvent(QDragMoveEvent *event) override;
virtual void rowsInserted(const QModelIndex &parent, int start, virtual void rowsInserted(const QModelIndex &parent, int start,
int end) override; int end) override;
signals:
void scenesReordered();
}; };

View File

@ -408,11 +408,8 @@ OBSBasic::OBSBasic(QWidget *parent)
connect(ui->enablePreviewButton, SIGNAL(clicked()), this, connect(ui->enablePreviewButton, SIGNAL(clicked()), this,
SLOT(TogglePreview())); SLOT(TogglePreview()));
connect(ui->scenes->model(), connect(ui->scenes, SIGNAL(scenesReordered()), this,
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), SLOT(ScenesReordered()));
this,
SLOT(ScenesReordered(const QModelIndex &, int, int,
const QModelIndex &, int)));
} }
static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent, static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent,
@ -8232,15 +8229,8 @@ void OBSBasic::CheckDiskSpaceRemaining()
} }
} }
void OBSBasic::ScenesReordered(const QModelIndex &parent, int start, int end, void OBSBasic::ScenesReordered()
const QModelIndex &destination, int row)
{ {
UNUSED_PARAMETER(parent);
UNUSED_PARAMETER(start);
UNUSED_PARAMETER(end);
UNUSED_PARAMETER(destination);
UNUSED_PARAMETER(row);
OBSProjector::UpdateMultiviewProjectors(); OBSProjector::UpdateMultiviewProjectors();
} }

View File

@ -662,8 +662,7 @@ private slots:
void CheckDiskSpaceRemaining(); void CheckDiskSpaceRemaining();
void OpenSavedProjector(SavedProjectorInfo *info); void OpenSavedProjector(SavedProjectorInfo *info);
void ScenesReordered(const QModelIndex &parent, int start, int end, void ScenesReordered();
const QModelIndex &destination, int row);
void ResetStatsHotkey(); void ResetStatsHotkey();