ExpandLayout.h 955 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef EXPANDLAYOUT_H
  2. #define EXPANDLAYOUT_H
  3. #include <QLayout>
  4. class ExpandLayout : public QLayout
  5. {
  6. Q_OBJECT
  7. public:
  8. explicit ExpandLayout(QWidget *parent = nullptr);
  9. ~ExpandLayout();
  10. void addWidget(QWidget *w);
  11. QSize sizeHint() const override;
  12. void addItem(QLayoutItem *item) override;
  13. QLayoutItem *itemAt(int index) const override;
  14. QLayoutItem *takeAt(int index) override;
  15. int count() const override;
  16. QSize minimumSize() const override;
  17. Qt::Orientations expandingDirections() const override;
  18. void setGeometry(const QRect &rect) override;
  19. bool hasHeightForWidth() const override;
  20. int heightForWidth(int width) const override;
  21. bool eventFilter(QObject *watched, QEvent *event) override;
  22. void removeAllItems();
  23. signals:
  24. private:
  25. int doLayout(const QRect &rect, bool move) const;
  26. QList<QLayoutItem *> m_items;
  27. QList<QWidget *> m_widgets;
  28. };
  29. #endif // EXPANDLAYOUT_H