@@ -157,23 +157,24 @@ void FrameGraphicsItem::paint(QPainter* painter, const QStyleOptionGraphicsItem*
157157 QColor::fromHsv ((color.hue () + 120 ) % 360 , color.saturation (), color.value (), color.alpha ());
158158
159159 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 ());
161161 auto mainRect = rect ();
162- mainRect.setWidth ( rect (). width () - width );
162+ mainRect.setHeight (mainRect. height () / 2 );
163163 painter->fillRect (mainRect, color);
164164 auto secondaryRect = rect ();
165165 secondaryRect.setWidth (width);
166- secondaryRect.moveRight (rect ().right ());
166+ secondaryRect.setHeight (mainRect.height ());
167+ secondaryRect.moveBottom (rect ().bottom ());
167168 painter->fillRect (secondaryRect, secondaryColor);
168169 } else {
169- const auto width = rect ().width () * static_cast <float >(cost ()) / (secondaryCost () + cost () );
170+ const auto width = rect ().width () * static_cast <float >(cost ()) / (secondaryCost ());
170171 auto mainRect = rect ();
171- // mainRect.setWidth(rect().width() - width);
172- mainRect.moveRight ( rect (). right () );
172+ mainRect.setWidth (width);
173+ mainRect.setHeight (mainRect. height () / 2 );
173174 painter->fillRect (mainRect, color);
174175 auto secondaryRect = rect ();
175- secondaryRect.setWidth (width );
176- secondaryRect.moveRight (rect ().right ());
176+ secondaryRect.setHeight (mainRect. height () );
177+ secondaryRect.moveBottom (rect ().bottom ());
177178
178179 painter->fillRect (secondaryRect, secondaryColor);
179180 }
0 commit comments