MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / errorIcon

Function errorIcon

GGEasy/forms/formsutil/errordialog.cpp:34–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32enum { IconSize = 32 };
33
34QIcon errorIcon(const QPainterPath& path)
35{
36
37 const QRectF rect = path.boundingRect();
38
39 qreal scale = static_cast<double>(IconSize) / qMax(rect.width(), rect.height());
40
41 double ky = rect.bottom() * scale;
42 double kx = rect.left() * scale;
43 if (rect.width() > rect.height())
44 ky += (static_cast<double>(IconSize) - rect.height() * scale) / 2;
45 else
46 kx -= (static_cast<double>(IconSize) - rect.width() * scale) / 2;
47
48 QPixmap pixmap(IconSize, IconSize);
49 pixmap.fill(Qt::transparent);
50 QPainter painter;
51 painter.begin(&pixmap);
52 painter.setRenderHint(QPainter::Antialiasing);
53 painter.setPen(Qt::NoPen);
54 painter.setBrush(Qt::black);
55 // painter.translate(tr);
56 painter.translate(-kx, ky);
57 painter.scale(scale, -scale);
58 painter.drawPath(path);
59 return QIcon(pixmap);
60}
61
62class ErrorModel : public QAbstractTableModel {
63 mvector<ErrorItem*> items;

Callers 1

dataMethod · 0.85

Calls 7

QIconClass · 0.85
widthMethod · 0.80
translateMethod · 0.80
scaleMethod · 0.80
boundingRectMethod · 0.45
heightMethod · 0.45
setPenMethod · 0.45

Tested by

no test coverage detected