WindowsFramelessWidget.h 935 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef WINDOWSFRAMELESSWIDGET_H
  2. #define WINDOWSFRAMELESSWIDGET_H
  3. #include <QWidget>
  4. class WindowsWindowEffect;
  5. class TitleBar;
  6. class WindowsFramelessWidget : public QWidget
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit WindowsFramelessWidget(QWidget *parent = nullptr);
  11. void setTitleBar(TitleBar *tBar);
  12. void setResizeEnabled(bool isEnabled);
  13. bool getResizeEnabled() const;
  14. WindowsWindowEffect *getWindowEffect() const;
  15. TitleBar *getTitleBar() const;
  16. protected:
  17. virtual QString effectType() const { return ""; };
  18. private:
  19. WindowsWindowEffect *windowEffect;
  20. TitleBar *titleBar;
  21. bool isResizeEnabled;
  22. private slots:
  23. void onScreenChanged(QScreen *screen);
  24. signals:
  25. // QWidget interface
  26. protected:
  27. void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
  28. bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
  29. };
  30. #endif // WINDOWSFRAMELESSWIDGET_H