From fd0c4b7d09cff888d8f9870cd64d89e1d0c6c032 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Sun, 28 Aug 2022 00:17:09 -0400 Subject: [PATCH] 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. --- UI/scene-tree.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UI/scene-tree.cpp b/UI/scene-tree.cpp index 1c2f1ab7e..769bd740e 100644 --- a/UI/scene-tree.cpp +++ b/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(); }); }