mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
24 lines
542 B
C++
24 lines
542 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> _bindObject;
|
|
bool _ignoreNullObject{ false };
|
|
};
|
|
#endif // MAINTHREAD_H
|