Browse Source

Fix rounding for non-square CallConfirmWidget

Thanks to @krepa098
pull/1061/head
Tux3 / Mlkj / !Lev.uXFMLA 11 years ago
parent
commit
ac2700fdeb
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 5
      src/widget/callconfirmwidget.cpp
  2. 1
      src/widget/callconfirmwidget.h

5
src/widget/callconfirmwidget.cpp

@ -14,7 +14,8 @@ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor) : @@ -14,7 +14,8 @@ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor) :
QWidget(Widget::getInstance()), anchor(Anchor),
rectW{120}, rectH{85},
spikeW{30}, spikeH{15},
roundedFactor{15}
roundedFactor{20},
rectRatio{static_cast<qreal>(rectH)/static_cast<qreal>(rectW)}
{
setWindowFlags(Qt::SubWindow);
@ -81,7 +82,7 @@ void CallConfirmWidget::paintEvent(QPaintEvent*) @@ -81,7 +82,7 @@ void CallConfirmWidget::paintEvent(QPaintEvent*)
painter.setBrush(brush);
painter.setPen(Qt::NoPen);
painter.drawRoundRect(mainRect, roundedFactor, roundedFactor);
painter.drawRoundRect(mainRect, roundedFactor*rectRatio, roundedFactor);
painter.drawPolygon(spikePoly);
}

1
src/widget/callconfirmwidget.h

@ -39,6 +39,7 @@ private: @@ -39,6 +39,7 @@ private:
const int rectW, rectH;
const int spikeW, spikeH;
const int roundedFactor; ///< By how much are the corners of the main rect rounded
const qreal rectRatio; ///< Used to correct the rounding factors on non-square rects
};
#endif // CALLCONFIRMWIDGET_H

Loading…
Cancel
Save