qtmaterialsnackbar.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef QTMATERIALSNACKBAR_H
  2. #define QTMATERIALSNACKBAR_H
  3. #include "lib/qtmaterialoverlaywidget.h"
  4. class QtMaterialSnackbarPrivate;
  5. class QtMaterialSnackbar : public QtMaterialOverlayWidget
  6. {
  7. Q_OBJECT
  8. public:
  9. explicit QtMaterialSnackbar(QWidget *parent = 0);
  10. ~QtMaterialSnackbar();
  11. void setAutoHideDuration(int duration);
  12. int autoHideDuration() const;
  13. void setUseThemeColors(bool value);
  14. bool useThemeColors() const;
  15. void setBackgroundColor(const QColor &color);
  16. QColor backgroundColor() const;
  17. void setBackgroundOpacity(qreal opacity);
  18. qreal backgroundOpacity() const;
  19. void setTextColor(const QColor &color);
  20. QColor textColor() const;
  21. void setFontSize(qreal size);
  22. qreal fontSize() const;
  23. void setBoxWidth(int width);
  24. int boxWidth() const;
  25. void setClickToDismissMode(bool value);
  26. bool clickToDismissMode() const;
  27. public slots:
  28. void addMessage(const QString &message);
  29. void addInstantMessage(const QString &message);
  30. protected slots:
  31. void dequeue();
  32. protected:
  33. void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
  34. const QScopedPointer<QtMaterialSnackbarPrivate> d_ptr;
  35. private:
  36. Q_DISABLE_COPY(QtMaterialSnackbar)
  37. Q_DECLARE_PRIVATE(QtMaterialSnackbar)
  38. };
  39. #endif // QTMATERIALSNACKBAR_H