mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix rounding for non-square CallConfirmWidget
Thanks to @krepa098
This commit is contained in:
parent
03fe9a355f
commit
ac2700fdeb
|
@ -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*)
|
|||
painter.setBrush(brush);
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
painter.drawRoundRect(mainRect, roundedFactor, roundedFactor);
|
||||
painter.drawRoundRect(mainRect, roundedFactor*rectRatio, roundedFactor);
|
||||
painter.drawPolygon(spikePoly);
|
||||
}
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue
Block a user