qtmaterialappbar.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef QTMATERIALAPPBAR_H
  2. #define QTMATERIALAPPBAR_H
  3. #include <QtWidgets/QWidget>
  4. #include <QtWidgets/QHBoxLayout>
  5. class QtMaterialAppBarPrivate;
  6. class QtMaterialAppBar : public QWidget
  7. {
  8. Q_OBJECT
  9. Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
  10. Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
  11. public:
  12. explicit QtMaterialAppBar(QWidget *parent = 0);
  13. ~QtMaterialAppBar();
  14. QSize sizeHint() const Q_DECL_OVERRIDE;
  15. void setUseThemeColors(bool value);
  16. bool useThemeColors() const;
  17. void setForegroundColor(const QColor &color);
  18. QColor foregroundColor() const;
  19. void setBackgroundColor(const QColor &color);
  20. QColor backgroundColor() const;
  21. inline QHBoxLayout *appBarLayout() const;
  22. protected:
  23. void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
  24. const QScopedPointer<QtMaterialAppBarPrivate> d_ptr;
  25. private:
  26. Q_DISABLE_COPY(QtMaterialAppBar)
  27. Q_DECLARE_PRIVATE(QtMaterialAppBar)
  28. };
  29. inline QHBoxLayout *QtMaterialAppBar::appBarLayout() const
  30. {
  31. return static_cast<QHBoxLayout *>(layout());
  32. }
  33. #endif // QTMATERIALAPPBAR_H