Explorar el Código

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.
Clayton Groeneveld hace 5 años
padre
commit
f580de0bc7
Se han modificado 4 ficheros con 14 adiciones y 16 borrados
  1. 7 1
      UI/scene-tree.cpp
  2. 3 0
      UI/scene-tree.hpp
  3. 3 13
      UI/window-basic-main.cpp
  4. 1 2
      UI/window-basic-main.hpp

+ 7 - 1
UI/scene-tree.cpp

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

+ 3 - 0
UI/scene-tree.hpp

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

+ 3 - 13
UI/window-basic-main.cpp

@@ -408,11 +408,8 @@ OBSBasic::OBSBasic(QWidget *parent)
 	connect(ui->enablePreviewButton, SIGNAL(clicked()), this,
 		SLOT(TogglePreview()));
 
-	connect(ui->scenes->model(),
-		SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
-		this,
-		SLOT(ScenesReordered(const QModelIndex &, int, int,
-				     const QModelIndex &, int)));
+	connect(ui->scenes, SIGNAL(scenesReordered()), this,
+		SLOT(ScenesReordered()));
 }
 
 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,
-			       const QModelIndex &destination, int row)
+void OBSBasic::ScenesReordered()
 {
-	UNUSED_PARAMETER(parent);
-	UNUSED_PARAMETER(start);
-	UNUSED_PARAMETER(end);
-	UNUSED_PARAMETER(destination);
-	UNUSED_PARAMETER(row);
-
 	OBSProjector::UpdateMultiviewProjectors();
 }
 

+ 1 - 2
UI/window-basic-main.hpp

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