You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
525 B

2 years ago
  1. #ifndef QFUNCTION_HPP
  2. #define QFUNCTION_HPP
  3. #include <QObject>
  4. #include <functional>
  5. class QFunction : public QObject {
  6. Q_OBJECT
  7. std::function<void()> m_func;
  8. public:
  9. explicit QFunction(std::function<void()> func, QObject *parent = nullptr);
  10. QFunction();
  11. QFunction(const QFunction &other) { m_func = other.m_func; }
  12. QFunction &operator=(const QFunction &other) {
  13. m_func = other.m_func;
  14. return *this;
  15. }
  16. std::function<void()> &get();
  17. // 拷贝构造函数
  18. signals:
  19. };
  20. #endif // QFUNCTION_HPP