mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
Defer loading .rdc from drag & drop, to unblock the calling application
This commit is contained in:
@@ -372,6 +372,11 @@ void GUIInvoke::call(const std::function<void()> &f)
|
||||
return;
|
||||
}
|
||||
|
||||
defer(f);
|
||||
}
|
||||
|
||||
void GUIInvoke::defer(const std::function<void()> &f)
|
||||
{
|
||||
GUIInvoke *invoke = new GUIInvoke(f);
|
||||
invoke->moveToThread(qApp->thread());
|
||||
invoke->metaObject()->method(methodIndex).invoke(invoke, Qt::QueuedConnection);
|
||||
|
||||
@@ -177,6 +177,9 @@ public:
|
||||
static void blockcall(const std::function<void()> &f);
|
||||
static bool onUIThread();
|
||||
|
||||
// same as call() above, but it doesn't check for an instant call on the UI thread
|
||||
static void defer(const std::function<void()> &f);
|
||||
|
||||
protected slots:
|
||||
void doInvoke()
|
||||
{
|
||||
|
||||
@@ -1776,7 +1776,11 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QString fn = dragFilename(event->mimeData());
|
||||
if(!fn.isEmpty())
|
||||
LoadFromFilename(fn, false);
|
||||
{
|
||||
// we defer this so we can return immediately and unblock whichever application dropped the
|
||||
// item.
|
||||
GUIInvoke::defer([this, fn]() { LoadFromFilename(fn, false); });
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::LoadSaveLayout(QAction *action, bool save)
|
||||
|
||||
Reference in New Issue
Block a user