Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
28
libs/platform/gui_thread_qt.cpp
Normal file
28
libs/platform/gui_thread_qt.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "platform/gui_thread.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
namespace platform
|
||||
{
|
||||
base::TaskLoop::PushResult GuiThread::Push(Task && task)
|
||||
{
|
||||
// Following hack is used to post on main message loop |fn| when
|
||||
// |source| is destroyed (at the exit of the code block).
|
||||
QObject source;
|
||||
QObject::connect(&source, &QObject::destroyed, QCoreApplication::instance(), std::move(task));
|
||||
|
||||
return {true, base::TaskLoop::kNoId};
|
||||
}
|
||||
|
||||
base::TaskLoop::PushResult GuiThread::Push(Task const & task)
|
||||
{
|
||||
// Following hack is used to post on main message loop |fn| when
|
||||
// |source| is destroyed (at the exit of the code block).
|
||||
QObject source;
|
||||
QObject::connect(&source, &QObject::destroyed, QCoreApplication::instance(), task);
|
||||
|
||||
return {true, base::TaskLoop::kNoId};
|
||||
}
|
||||
} // namespace platform
|
||||
Loading…
Add table
Add a link
Reference in a new issue