blob: 86c147d01535d7ecf5aedda080da9a3b58fef1a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "platform/gui_thread.hpp"
#include <utility>
#include <QtCore/QCoreApplication>
namespace platform
{
bool 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;
return QObject::connect(&source, &QObject::destroyed, QCoreApplication::instance(), std::move(task));
}
bool 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;
return QObject::connect(&source, &QObject::destroyed, QCoreApplication::instance(), task);
}
} // namespace platform
|