windowbutton.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
  2. // Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
  3. // SPDX-License-Identifier: Apache-2.0
  4. #ifndef WINDOWBUTTON_H
  5. #define WINDOWBUTTON_H
  6. #include <QtWidgets/QPushButton>
  7. namespace QWK {
  8. class WindowButtonPrivate;
  9. class WindowButton : public QPushButton {
  10. Q_OBJECT
  11. Q_DECLARE_PRIVATE(WindowButton)
  12. Q_PROPERTY(QIcon iconNormal READ iconNormal WRITE setIconNormal FINAL)
  13. Q_PROPERTY(QIcon iconChecked READ iconChecked WRITE setIconChecked FINAL)
  14. Q_PROPERTY(QIcon iconDisabled READ iconDisabled WRITE setIconDisabled FINAL)
  15. public:
  16. explicit WindowButton(QWidget *parent = nullptr);
  17. ~WindowButton();
  18. public:
  19. QIcon iconNormal() const;
  20. void setIconNormal(const QIcon &icon);
  21. QIcon iconChecked() const;
  22. void setIconChecked(const QIcon &icon);
  23. QIcon iconDisabled() const;
  24. void setIconDisabled(const QIcon &icon);
  25. Q_SIGNALS:
  26. void doubleClicked();
  27. protected:
  28. void checkStateSet() override;
  29. void mouseDoubleClickEvent(QMouseEvent *event) override;
  30. protected:
  31. WindowButton(WindowButtonPrivate &d, QWidget *parent = nullptr);
  32. QScopedPointer<WindowButtonPrivate> d_ptr;
  33. };
  34. }
  35. #endif // WINDOWBUTTON_H