ColumnGroupHeaderView.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef COLUMNGROUPHEADERVIEW_H
  9. #define COLUMNGROUPHEADERVIEW_H
  10. #if !defined(Q_MOC_RUN)
  11. #include <QHeaderView>
  12. #include <QVector>
  13. #endif
  14. class ColumnGroupProxyModel;
  15. class ColumnGroupHeaderView
  16. : public QHeaderView
  17. {
  18. Q_OBJECT
  19. public:
  20. ColumnGroupHeaderView(QWidget* parent = 0);
  21. void setModel(QAbstractItemModel* model) override;
  22. QSize sizeHint() const override;
  23. bool IsGroupsShown() const;
  24. bool event(QEvent* event) override;
  25. public slots:
  26. void ShowGroups(bool showGroups);
  27. protected slots:
  28. void updateGeometries() override;
  29. private:
  30. int GroupViewHeight() const;
  31. private:
  32. struct Group
  33. {
  34. QRect rect;
  35. int col;
  36. };
  37. ColumnGroupProxyModel* m_groupModel;
  38. bool m_showGroups;
  39. QVector<Group> m_groups;
  40. };
  41. #endif // COLUMNGROUPHEADERVIEW_H