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

Method paintEvent

qrenderdoc/Widgets/Extended/RDHeaderView.cpp:799–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799void RDHeaderView::paintEvent(QPaintEvent *e)
800{
801 if(!m_customSizing)
802 return QHeaderView::paintEvent(e);
803
804 if(count() == 0)
805 return;
806
807 QPainter painter(viewport());
808
809 int start = qMax(visualIndexAt(e->rect().left()), 0);
810 int end = visualIndexAt(e->rect().right());
811
812 if(end == -1)
813 end = count() - 1;
814
815 // make sure we always paint the whole header for any merged headers
816 while(start > 0 && !hasGroupTitle(start - 1))
817 start--;
818 while(end < m_sections.count() && !hasGroupTitle(end))
819 end++;
820
821 QRect accumRect;
822 for(int i = start; i <= end; ++i)
823 {
824 int pos = sectionViewportPosition(i);
825 int size = sectionSize(i);
826
827 if(!hasGroupGap(i) && pos < 0)
828 {
829 size += pos;
830 pos = 0;
831 }
832
833 // either set or accumulate this section's rect
834 if(accumRect.isEmpty())
835 accumRect.setRect(pos, 0, size, viewport()->height());
836 else
837 accumRect.setWidth(accumRect.width() + size);
838
839 if(hasGroupTitle(i))
840 {
841 painter.save();
842
843 if(accumRect.left() < m_pinnedWidth && i >= m_pinnedColumns)
844 accumRect.setLeft(m_pinnedWidth);
845
846 paintSection(&painter, accumRect, i);
847 painter.restore();
848
849 // if we have more sections to go, reset so we can accumulate the next group
850 if(i < end)
851 accumRect = QRect();
852 }
853 }
854
855 // clear the remainder of the header if there's a gap
856 if(accumRect.right() < e->rect().right())

Callers

nothing calls this directly

Calls 15

paintEventFunction · 0.85
setRectMethod · 0.80
setLeftMethod · 0.80
countFunction · 0.50
QRectClass · 0.50
styleFunction · 0.50
leftMethod · 0.45
rectMethod · 0.45
rightMethod · 0.45
countMethod · 0.45
isEmptyMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected