#ifndef MAINTHREAD_H #define MAINTHREAD_H #include #include #include class MainThread : public QObject { Q_OBJECT public: static void post(std::function func); ~MainThread(); private: static std::shared_ptr createShared(QObject* bindObject = nullptr); private slots: void mainThreadSlot(std::function func); private: MainThread(QObject* bindObject = nullptr); QPointer mBindObject; bool mIgnoreNullObject{ false }; }; #endif // MAINTHREAD_H