Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 364:99c961c91809 | 365:f81bed4e04ac |
|---|---|
| 101 | 101 |
| 102 offset += text_width + HORIZ_SPACING; | 102 offset += text_width + HORIZ_SPACING; |
| 103 | 103 |
| 104 /* only draw this if we actually have any data */ | 104 /* only draw this if we actually have any data */ |
| 105 if (total) { | 105 if (total) { |
| 106 const int rect_width = (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width); | |
| 107 | |
| 106 painter.save(); | 108 painter.save(); |
| 107 | 109 |
| 108 QPen pen(painter.pen()); | 110 QPen pen(painter.pen()); |
| 109 pen.setStyle(Qt::NoPen); | 111 pen.setStyle(Qt::NoPen); |
| 110 painter.setPen(pen); | 112 painter.setPen(pen); |
| 111 | 113 |
| 112 QPainterPath path; | 114 QPainterPath path; |
| 113 path.addRect(x + offset, y, | 115 path.addRect(x + offset, y, rect_width, each_height); |
| 114 (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width), each_height); | |
| 115 painter.fillPath(path, Qt::darkGreen); | 116 painter.fillPath(path, Qt::darkGreen); |
| 116 painter.drawPath(path); | 117 painter.drawPath(path); |
| 117 | 118 |
| 118 offset += (static_cast<double>(value) / total) * (width - offset - HORIZ_SPACING - value_width); | 119 offset += rect_width; |
| 119 | 120 |
| 120 painter.restore(); | 121 painter.restore(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 offset += HORIZ_SPACING; | 124 offset += HORIZ_SPACING; |
