Mercurial > minori
diff include/gui/widgets/graph.h @ 365:f81bed4e04ac
*: megacommit that probably breaks things
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 02 Oct 2024 23:06:43 -0400 |
parents | f31305b9f60a |
children |
line wrap: on
line diff
--- a/include/gui/widgets/graph.h Tue Jul 16 21:15:59 2024 -0400 +++ b/include/gui/widgets/graph.h Wed Oct 02 23:06:43 2024 -0400 @@ -103,6 +103,8 @@ /* only draw this if we actually have any data */ if (total) { + const int rect_width = (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width); + painter.save(); QPen pen(painter.pen()); @@ -110,12 +112,11 @@ painter.setPen(pen); QPainterPath path; - path.addRect(x + offset, y, - (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width), each_height); + path.addRect(x + offset, y, rect_width, each_height); painter.fillPath(path, Qt::darkGreen); painter.drawPath(path); - offset += (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width); + offset += rect_width; painter.restore(); }