MCPcopy Create free account
hub / github.com/KDAB/GammaRay / drawGrid

Method drawGrid

plugins/quickinspector/quickdecorationsdrawer.cpp:341–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void QuickDecorationsDrawer::drawGrid()
342{
343 const QRectF &viewRect(m_renderInfo->viewRect);
344 const QPointF &gridOffset(m_renderInfo->settings.gridOffset);
345 const QSizeF &gridCellSize(m_renderInfo->settings.gridCellSize);
346
347 if (!m_renderInfo->settings.gridEnabled || gridCellSize.isEmpty())
348 return;
349
350 m_painter->save();
351 m_painter->setPen(m_renderInfo->settings.gridColor);
352
353 QVector<QLineF> lines;
354 lines.reserve((viewRect.width() / gridCellSize.width()) + (viewRect.height() / gridCellSize.height()));
355
356 // NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
357 for (qreal x = viewRect.left() + gridOffset.x(); x < viewRect.right(); x += gridCellSize.width()) {
358 if (x < viewRect.left())
359 continue;
360
361 lines << QLineF(QPointF(x, viewRect.top()) * m_renderInfo->zoom,
362 QPointF(x, viewRect.bottom()) * m_renderInfo->zoom);
363 }
364
365 // NOLINTNEXTLINE (clang-analyzer-security.FloatLoopCounter)
366 for (qreal y = viewRect.top() + gridOffset.y(); y < viewRect.bottom(); y += gridCellSize.height()) {
367 if (y < viewRect.top())
368 continue;
369
370 lines << QLineF(QPointF(viewRect.left(), y) * m_renderInfo->zoom,
371 QPointF(viewRect.right(), y) * m_renderInfo->zoom);
372 }
373
374 m_painter->drawLines(lines);
375 m_painter->restore();
376}
377
378void QuickDecorationsDrawer::drawArrow(const QPointF &first, const QPointF &second)
379{

Callers

nothing calls this directly

Calls 7

QPointFClass · 0.85
saveMethod · 0.80
reserveMethod · 0.80
leftMethod · 0.80
rightMethod · 0.80
isEmptyMethod · 0.45
drawLinesMethod · 0.45

Tested by

no test coverage detected