MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / drawGrid

Function drawGrid

cp-profiler/src/cpprofiler/tree/tree_scroll_area.cpp:29–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27constexpr int y_margin = 20;
28
29static void drawGrid(QPainter &painter, QSize size)
30{
31
32 const int cell_w = 100;
33 const int cell_h = 100;
34
35 {
36 QPen pen = painter.pen();
37 pen.setWidth(1);
38 pen.setStyle(Qt::DotLine);
39 painter.setPen(pen);
40 }
41
42 const auto columns = std::ceil(static_cast<float>(size.width()) / cell_w);
43 const auto rows = std::ceil(static_cast<float>(size.height()) / cell_h);
44
45 for (auto row = 0; row < rows; ++row)
46 {
47 for (auto col = 0; col < columns; ++col)
48 {
49 auto x = col * cell_w;
50 auto y = row * cell_h;
51 painter.drawRect(x, y, cell_w, cell_w);
52 }
53 }
54}
55
56void TreeScrollArea::paintEvent(QPaintEvent *event)
57{

Callers

nothing calls this directly

Calls 4

setWidthMethod · 0.80
drawRectMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected