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

Function addText

cp-profiler/src/cpprofiler/analysis/histogram_scene.cpp:25–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23QColor PatternRect::highlighted_outline{252, 148, 77};
24
25static void addText(QGraphicsScene &scene, int col, int row,
26 QGraphicsSimpleTextItem *text_item,
27 Align alignment = Align::CENTER)
28{
29 int item_width = text_item->boundingRect().width();
30 int item_height = text_item->boundingRect().height();
31
32 // center the item vertically at y
33 int y_offset = item_height / 2;
34 int x_offset = 0;
35
36 switch (alignment)
37 {
38 case Align::CENTER:
39 x_offset = (COLUMN_WIDTH - item_width) / 2;
40 break;
41 case Align::RIGHT:
42 x_offset = COLUMN_WIDTH - item_width;
43 break;
44 }
45
46 int x = col * COLUMN_WIDTH + x_offset;
47 int y = row * ROW_HEIGHT + y_offset;
48
49 text_item->setPos(x, y - y_offset);
50 scene.addItem(text_item);
51}
52
53static std::shared_ptr<PatternRect> addRect(HistogramScene &hist_scene, int row, int val)
54{

Callers 2

addTextMethod · 0.85
drawPatternsMethod · 0.85

Calls 2

widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected