MCPcopy Create free account
hub / github.com/KDE/labplot / drawBackgroundItems

Method drawBackgroundItems

src/frontend/worksheet/WorksheetView.cpp:726–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726void WorksheetView::drawBackgroundItems(QPainter* painter, const QRectF& scene_rect) {
727 // canvas
728 m_worksheet->background()->draw(painter, scene_rect);
729
730 // grid
731 if (m_gridSettings.style != GridStyle::NoGrid && !m_isPrinting) {
732 QColor c = m_gridSettings.color;
733 c.setAlphaF(m_gridSettings.opacity);
734 painter->setPen(c);
735
736 qreal x, y;
737 qreal left = scene_rect.left();
738 qreal right = scene_rect.right();
739 qreal top = scene_rect.top();
740 qreal bottom = scene_rect.bottom();
741
742 if (m_gridSettings.style == GridStyle::Line) {
743 QLineF line;
744
745 // horizontal lines
746 y = top + m_gridSettings.verticalSpacing;
747 while (y < bottom) {
748 line.setLine(left, y, right, y);
749 painter->drawLine(line);
750 y += m_gridSettings.verticalSpacing;
751 }
752
753 // vertical lines
754 x = left + m_gridSettings.horizontalSpacing;
755 while (x < right) {
756 line.setLine(x, top, x, bottom);
757 painter->drawLine(line);
758 x += m_gridSettings.horizontalSpacing;
759 }
760 } else { // DotGrid
761 y = top + m_gridSettings.verticalSpacing;
762 while (y < bottom) {
763 x = left; // + m_gridSettings.horizontalSpacing;
764 while (x < right) {
765 x += m_gridSettings.horizontalSpacing;
766 painter->drawPoint(x, y);
767 }
768 y += m_gridSettings.verticalSpacing;
769 }
770 }
771 }
772}
773
774void WorksheetView::drawBackground(QPainter* painter, const QRectF& rect) {
775 painter->save();

Callers

nothing calls this directly

Calls 3

setPenMethod · 0.80
drawMethod · 0.45
backgroundMethod · 0.45

Tested by

no test coverage detected