ACF $AcfVersion:0$
CHierarchicalHeaderView.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QtGlobal>
7#if QT_VERSION >= 0x050000
8#include <QtWidgets/QHeaderView>
9#else
10#include <QtGui/QHeaderView>
11#endif
12
13
14namespace iwidgets
15{
16
17
21class CHierarchicalHeaderView: public QHeaderView
22{
23 Q_OBJECT
24public:
25 typedef QHeaderView BaseClass;
26
32
33 CHierarchicalHeaderView(Qt::Orientation orientation, QWidget* parent = 0);
34
35 // reimplemented (QHeaderView)
36 virtual void setModel(QAbstractItemModel* model) override;
37
38protected:
39 // reimplemented (QHeaderView)
40 virtual void paintSection(
41 QPainter* painter,
42 const QRect& rect,
43 int logicalIndex) const override;
44 virtual QSize sectionSizeFromContents(int logicalIndex) const override;
45
46private Q_SLOTS:
47 void on_sectionResized(int logicalIndex);
48
49private:
50 QStyleOptionHeader GetStyleOptionForCell(int logicalIndex) const;
51 QModelIndex GetChildIndex(int sectionIndex) const;
52 QSize GetCellSize(
53 const QModelIndex& childIndex,
54 const QHeaderView* headerViewPtr,
55 QStyleOptionHeader styleOptions) const;
56 void PaintHorizontalSection(
57 QPainter *painter,
58 const QRect& sectionRect,
59 int logicalChildIndex,
60 const QHeaderView* headerViewPtr,
61 const QStyleOptionHeader& styleOptions,
62 const QModelIndex& childIndex) const;
63 void PaintVerticalSection(
64 QPainter *painter,
65 const QRect& sectionRect,
66 int logicalChildIndex,
67 const QHeaderView* headerViewPtr,
68 const QStyleOptionHeader& styleOptions,
69 const QModelIndex& childIndex) const;
70 QModelIndexList GetChilds(const QModelIndex& searchedIndex) const;
71 QModelIndexList SearchChilds(const QModelIndex& curentIndex) const;
72 QModelIndex FindRootIndex(QModelIndex index) const;
73 QModelIndexList GetParentIndexes(QModelIndex index) const;
74 QModelIndex FindChild(const QModelIndex& curentIndex, int sectionIndex, int& curentChildIndex) const;
75 void SetForegroundBrush(QStyleOptionHeader& opt, const QModelIndex& index) const;
76 void SetBackgroundBrush(QStyleOptionHeader& opt, const QModelIndex& index) const;
77 int GetCurrentCellWidth(
78 const QModelIndex& searchedIndex,
79 const QModelIndex& childIndex,
80 int sectionIndex,
81 const QHeaderView* headerViewPtr) const;
82 int GetCurrentCellLeft(
83 const QModelIndex& searchedIndex,
84 const QModelIndex& childIndex,
85 int sectionIndex,
86 int left,
87 const QHeaderView* headerViewPtr) const;
88 int PaintHorizontalCell(
89 QPainter *painter,
90 const QHeaderView* headerViewPtr,
91 const QModelIndex& cellIndex,
92 const QModelIndex& childIndex,
93 int logicalChildIndex,
94 const QStyleOptionHeader& styleOptions,
95 const QRect& sectionRect,
96 int top) const;
97 int PaintVerticalCell(
98 QPainter *painter,
99 const QHeaderView* headerViewPtr,
100 const QModelIndex& cellIndex,
101 const QModelIndex& childIndex,
102 int logicalChildIndex,
103 const QStyleOptionHeader& styleOptions,
104 const QRect& sectionRect,
105 int left) const;
106};
107
108
109} // namespace iwidgets
110
111
112
Hierarchical header view for QTableView.
virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override
CHierarchicalHeaderView(Qt::Orientation orientation, QWidget *parent=0)
virtual QSize sectionSizeFromContents(int logicalIndex) const override
virtual void setModel(QAbstractItemModel *model) override
Namespace contains implementation of Qt widget extensions.