Browse Source

UI: Resize SceneTree after dropEvent

Calling resizeEvent for SceneTree after a dropEvent has occurred
prevents a dropped item from being displayed in the incorrect location
while in Grid Mode. There might be a better way to fix the incorrectly
displayed location of a dropped item, but we already do this in
SetGridMode and rowsInserted, so this is probably okay.
Ryan Foster 3 years ago
parent
commit
fd0c4b7d09
1 changed files with 5 additions and 0 deletions
  1. 5 0
      UI/scene-tree.cpp

+ 5 - 0
UI/scene-tree.cpp

@@ -143,6 +143,11 @@ void SceneTree::dropEvent(QDropEvent *event)
 
 
 	QListWidget::dropEvent(event);
 	QListWidget::dropEvent(event);
 
 
+	// We must call resizeEvent to correctly place all grid items.
+	// We also do this in rowsInserted.
+	QResizeEvent resEvent(size(), size());
+	SceneTree::resizeEvent(&resEvent);
+
 	QTimer::singleShot(100, [this]() { emit scenesReordered(); });
 	QTimer::singleShot(100, [this]() { emit scenesReordered(); });
 }
 }