WindowHelper.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef WINDOWHELPER_H
  2. #define WINDOWHELPER_H
  3. #include <QObject>
  4. #include <QQuickWindow>
  5. #include <QtQml/qqml.h>
  6. #include <QQuickItem>
  7. #include <QWindow>
  8. #include <QJsonObject>
  9. /**
  10. * @brief The WindowHelper class
  11. */
  12. class WindowHelper : public QObject
  13. {
  14. Q_OBJECT
  15. QML_NAMED_ELEMENT(WindowHelper)
  16. public:
  17. explicit WindowHelper(QObject *parent = nullptr);
  18. /**
  19. * @brief initWindow FluWindow中初始化调用
  20. * @param window
  21. */
  22. Q_INVOKABLE void initWindow(QQuickWindow* window);
  23. /**
  24. * @brief destoryWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
  25. */
  26. Q_INVOKABLE void destoryWindow();
  27. /**
  28. * @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
  29. * @param window
  30. * @param path
  31. * @return
  32. */
  33. Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
  34. /**
  35. * @brief firstUpdate 窗口创建成功后调用,只调用一次
  36. */
  37. Q_INVOKABLE void firstUpdate();
  38. private:
  39. QQuickWindow* window;
  40. };
  41. #endif // WINDOWHELPER_H