notification.h 688 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <QObject>
  3. class Notification : public QObject
  4. {
  5. Q_PROPERTY(NotificationType type READ type WRITE setType NOTIFY typeChanged)
  6. Q_OBJECT
  7. public:
  8. enum NotificationType {
  9. Stackable,
  10. Progress,
  11. BackgroundProgress,
  12. WarningLog
  13. };
  14. explicit Notification(QObject *parent = nullptr);
  15. NotificationType type() const
  16. {
  17. return m_type;
  18. }
  19. signals:
  20. void typeChanged(NotificationType type);
  21. public slots:
  22. void setType(NotificationType type)
  23. {
  24. if (m_type == type)
  25. return;
  26. m_type = type;
  27. emit typeChanged(m_type);
  28. }
  29. private:
  30. NotificationType m_type;
  31. };