| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef RUNNABLETHREAD_H
- #define RUNNABLETHREAD_H
- #include <QThread>
- #include <QRunnable>
- #include <QScopedPointer>
- class CustomRunnablePrivate;
- class CustomRunnable : public QRunnable
- {
- Q_DISABLE_COPY(CustomRunnable)
- public:
- CustomRunnable();
- ~CustomRunnable();
- void setCallbackFunction(void (*callback)(void *), void *parameter);
- protected:
- void run();
- private:
- friend class CustomRunnablePrivate;
- QScopedPointer<CustomRunnablePrivate> m_Private;
- };
- class CustomThreadPrivate;
- class CustomThread : public QThread
- {
- Q_DISABLE_COPY(CustomThread)
- public:
- explicit CustomThread(QObject *parent = NULL);
- ~CustomThread();
- void setCallbackFunction(void (*callback)(void *), void *parameter);
- void setEventLoop(const bool exec);
- void setusleep(const unsigned long value);
- public slots:
- void callbackFunctionSlots();
- protected:
- void run();
- private:
- friend class CustomThreadPrivate;
- QScopedPointer<CustomThreadPrivate> m_Private;
- };
- #endif // RUNNABLETHREAD_H
|