MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / drawProgressOverlay

Function drawProgressOverlay

launcher/ui/instanceview/InstanceDelegate.cpp:114–132  ·  view source on GitHub ↗

TODO this can be made a lot prettier

Source from the content-addressed store, hash-verified

112
113// TODO this can be made a lot prettier
114void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItem &option,
115 const int value, const int maximum)
116{
117 if (maximum == 0 || value == maximum)
118 {
119 return;
120 }
121
122 painter->save();
123
124 qreal percent = (qreal)value / (qreal)maximum;
125 QColor color = option.palette.color(QPalette::Dark);
126 color.setAlphaF(0.70f);
127 painter->setBrush(color);
128 painter->setPen(QPen(QBrush(), 0));
129 painter->drawPie(option.rect, 90 * 16, -percent * 360 * 16);
130
131 painter->restore();
132}
133
134void drawBadges(QPainter *painter, const QStyleOptionViewItem &option, BaseInstance *instance, QIcon::Mode mode, QIcon::State state)
135{

Callers 1

paintMethod · 0.85

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected