mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 13:49:08 +08:00
25 lines
543 B
C
25 lines
543 B
C
|
#ifndef MAINTHREAD_H
|
||
|
#define MAINTHREAD_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QPointer>
|
||
|
#include <QDebug>
|
||
|
|
||
|
class MainThread : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
|
||
|
static void post(std::function<void()> func);
|
||
|
~MainThread();
|
||
|
private:
|
||
|
static std::shared_ptr<MainThread> createShared(QObject* bindObject = nullptr);
|
||
|
private slots:
|
||
|
void mainThreadSlot(std::function<void()> func);
|
||
|
private:
|
||
|
MainThread(QObject* bindObject = nullptr);
|
||
|
QPointer<QObject> mBindObject;
|
||
|
bool mIgnoreNullObject{ false };
|
||
|
};
|
||
|
#endif // MAINTHREAD_H
|