| 306 | } |
| 307 | |
| 308 | void UBGraphicsTriangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) |
| 309 | { |
| 310 | painter->setPen(Qt::NoPen); |
| 311 | |
| 312 | QPolygonF polygon; |
| 313 | |
| 314 | if (mShouldPaintInnerTriangle) { |
| 315 | QLinearGradient gradient1(QPointF(A1.x(), 0), QPointF(A2.x(), 0)); |
| 316 | gradient1.setColorAt(0, edgeFillColor()); |
| 317 | gradient1.setColorAt(1, middleFillColor()); |
| 318 | |
| 319 | painter->setBrush(gradient1); |
| 320 | polygon << A1 << A2 << B2 << B1; |
| 321 | painter->drawPolygon(polygon); |
| 322 | polygon.clear(); |
| 323 | |
| 324 | QLinearGradient gradient2(QPointF(0, B1.y()), QPointF(0, B2.y())); |
| 325 | gradient2.setColorAt(0, edgeFillColor()); |
| 326 | gradient2.setColorAt(1, middleFillColor()); |
| 327 | |
| 328 | painter->setBrush(gradient2); |
| 329 | polygon << B1 << B2 << C2 << C1; |
| 330 | painter->drawPolygon(polygon); |
| 331 | polygon.clear(); |
| 332 | |
| 333 | QLinearGradient gradient3(CC, C2); |
| 334 | gradient3.setColorAt(0, edgeFillColor()); |
| 335 | gradient3.setColorAt(1, middleFillColor()); |
| 336 | |
| 337 | painter->setBrush(gradient3); |
| 338 | polygon << C1 << C2 << A2 << A1; |
| 339 | painter->drawPolygon(polygon); |
| 340 | polygon.clear(); |
| 341 | |
| 342 | |
| 343 | painter->setBrush(Qt::NoBrush); |
| 344 | painter->setPen(drawColor()); |
| 345 | |
| 346 | polygon << A1 << B1 << C1; |
| 347 | painter->drawPolygon(polygon); |
| 348 | polygon.clear(); |
| 349 | |
| 350 | polygon << A2 << B2 << C2; |
| 351 | painter->drawPolygon(polygon); |
| 352 | } |
| 353 | |
| 354 | else { |
| 355 | QLinearGradient gradient(QPointF(A1.x(), 0), QPointF(C1.x(), 0)); |
| 356 | gradient.setColorAt(0, edgeFillColor()); |
| 357 | gradient.setColorAt(1, middleFillColor()); |
| 358 | painter->setBrush(gradient); |
| 359 | painter->setPen(drawColor()); |
| 360 | polygon << A1 << B1 << C1; |
| 361 | painter->drawPolygon(polygon); |
| 362 | polygon.clear(); |
| 363 | } |
| 364 | |
| 365 |
nothing calls this directly
no test coverage detected