View Full Version : Keep RoundedRectangle AspectRatio

19th October 2009, 14:58
I've created my custom overiding the paintEvent function. In my window I draw a simple rounded rectangle:

void MyWidget::paintEvent(QPaintevent *)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, antialiased);
painter.setWindow(0,0, 300, 100);
painter.drawRoundRect(0,0,300,100, 20, 20);

Ok...now, after I launched my application, witch is only composed by MyWidget, when I try to resize the window the asperatio of the rounded corners is corrupted...they don't seem anymore like a quarter of circle but a quarter o ellipse and I don't want this behaviour.
How I can keep the right aspet ratio (quarter circle like) for the rounder cornerd even if I streach the window?