浏览代码

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 年之前
父节点
当前提交
fd0c4b7d09
共有 1 个文件被更改,包括 5 次插入0 次删除
  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);
 
+	// 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(); });
 }