@@ -157,23 +157,24 @@ void FrameGraphicsItem::paint(QPainter* painter, const QStyleOptionGraphicsItem*
157
157
QColor::fromHsv ((color.hue () + 120 ) % 360 , color.saturation (), color.value (), color.alpha ());
158
158
159
159
if (cost () > secondaryCost ()) {
160
- const auto width = rect ().width () * static_cast <float >(secondaryCost ()) / (cost () + secondaryCost () );
160
+ const auto width = rect ().width () * static_cast <float >(secondaryCost ()) / (cost ());
161
161
auto mainRect = rect ();
162
- mainRect.setWidth ( rect (). width () - width );
162
+ mainRect.setHeight (mainRect. height () / 2 );
163
163
painter->fillRect (mainRect, color);
164
164
auto secondaryRect = rect ();
165
165
secondaryRect.setWidth (width);
166
- secondaryRect.moveRight (rect ().right ());
166
+ secondaryRect.setHeight (mainRect.height ());
167
+ secondaryRect.moveBottom (rect ().bottom ());
167
168
painter->fillRect (secondaryRect, secondaryColor);
168
169
} else {
169
- const auto width = rect ().width () * static_cast <float >(cost ()) / (secondaryCost () + cost () );
170
+ const auto width = rect ().width () * static_cast <float >(cost ()) / (secondaryCost ());
170
171
auto mainRect = rect ();
171
- // mainRect.setWidth(rect().width() - width);
172
- mainRect.moveRight ( rect (). right () );
172
+ mainRect.setWidth (width);
173
+ mainRect.setHeight (mainRect. height () / 2 );
173
174
painter->fillRect (mainRect, color);
174
175
auto secondaryRect = rect ();
175
- secondaryRect.setWidth (width );
176
- secondaryRect.moveRight (rect ().right ());
176
+ secondaryRect.setHeight (mainRect. height () );
177
+ secondaryRect.moveBottom (rect ().bottom ());
177
178
178
179
painter->fillRect (secondaryRect, secondaryColor);
179
180
}
0 commit comments