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

Function lantern

cp-profiler/src/cpprofiler/tree/node_drawing.cpp:177–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void lantern(QPainter &painter, int x, int y, int size, bool selected, bool has_gradient, bool has_solutions)
178{
179
180 using namespace lantern;
181
182 const int height = K * size;
183
184 if (selected)
185 {
186 painter.setBrush(colors::gold);
187 }
188 else
189 {
190 QColor main_color = has_solutions ? colors::green : colors::red;
191 if (has_gradient)
192 {
193 QLinearGradient gradient(x - HALF_WIDTH, y,
194 x + HALF_WIDTH, y + BASE_HEIGHT + height);
195 gradient.setColorAt(0, colors::white);
196 gradient.setColorAt(1, main_color);
197 painter.setBrush(gradient);
198 }
199 else
200 {
201 painter.setBrush(main_color);
202 }
203 }
204
205 QPointF points[5] = {QPointF(x, y),
206 QPointF(x + HALF_WIDTH, y + BASE_HEIGHT),
207 QPointF(x + HALF_WIDTH, y + BASE_HEIGHT + height),
208 QPointF(x - HALF_WIDTH, y + BASE_HEIGHT + height),
209 QPointF(x - HALF_WIDTH, y + BASE_HEIGHT)};
210
211 painter.drawConvexPolygon(points, 5);
212}
213
214} // namespace draw
215} // namespace tree

Callers 1

processCurrentNodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected