1
0
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:
Tux3 / Mlkj / !Lev.uXFMLA 2015-01-26 18:29:13 +01:00
parent 03fe9a355f
commit ac2700fdeb
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -39,6 +39,7 @@ private:
const int rectW, rectH; const int rectW, rectH;
const int spikeW, spikeH; const int spikeW, spikeH;
const int roundedFactor; ///< By how much are the corners of the main rect rounded 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 #endif // CALLCONFIRMWIDGET_H