MCPcopy Create free account
hub / github.com/baldurk/renderdoc / cacheSections

Method cacheSections

qrenderdoc/Widgets/Extended/RDHeaderView.cpp:118–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void RDHeaderView::cacheSections()
119{
120 if(m_suppressSectionCache)
121 return;
122
123 QAbstractItemModel *m = this->model();
124
125 if(!m)
126 return;
127
128 int oldCount = m_sections.count();
129 m_sections.resize(m->columnCount());
130
131 // give new sections a default minimum size
132 for(int col = oldCount; col < m_sections.count(); col++)
133 m_sections[col].size = 10;
134
135 for(int col = 0; col < m_sections.count(); col++)
136 {
137 if(m_columnGroupRole > 0)
138 {
139 QVariant v = m->data(m->index(0, col), m_columnGroupRole);
140 if(v.isValid())
141 m_sections[col].group = v.toInt();
142 else
143 m_sections[col].group = -m_columnGroupRole - col;
144
145 if(col > 0)
146 {
147 m_sections[col - 1].groupGap =
148 (m_sections[col].group != m_sections[col - 1].group) && m_sections[col].group >= 0;
149 }
150 }
151 else
152 {
153 m_sections[col].group = col;
154 m_sections[col].groupGap = true;
155 }
156 }
157
158 int accum = 0;
159
160 for(int col = 0; col < m_sections.count(); col++)
161 {
162 if(col == m_pinnedColumns)
163 m_pinnedWidth = accum;
164
165 m_sections[col].offset = accum;
166 accum += m_sections[col].size;
167
168 if(hasGroupGap(col))
169 accum += groupGapSize();
170 }
171
172 if(m_pinnedColumns >= m_sections.count())
173 m_pinnedWidth = m_pinnedColumns;
174
175 QHeaderView::initializeSections();

Callers

nothing calls this directly

Calls 15

orientationFunction · 0.85
fontFunction · 0.50
QFontMetricsClass · 0.50
styleFunction · 0.50
QSizeClass · 0.50
modelMethod · 0.45
countMethod · 0.45
resizeMethod · 0.45
columnCountMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected