Unsolved How to apply rotation property for custom widget plug-in.
-
Hi,
I have prepared rectangle custom widget plugin and integrated it into qt designer. I want to write rotation property for the rectangle widget. I am using QPainter:: drawRect() and QPainter:: rotate(int angle) API to achieve the same. As for as I increase the angle of QPainter:: rotate(int angle) API, then the rectangle widget hide behind selection box of qt designer.
Is another way in Qt to auto adjust the selection box of qt designer according to change in angle?
How will I achieve the same. Please suggest me.Sample code is:
void Rect::paintEvent(QPaintEvent *event) { QPainter painter(this); int left = 100; int top = 50; int width = 200; nt height = 150; QRect r1(left, top, width, height); painter.setPen(Qt::blue); painter.rotate(90); painter.drawRect(r1); }
Thanks
-
Hi
Im not sure what "selection box of qt designer" is.I think what u are seeing is clipping.
A Widgets has an area (client area). You cannot draw outside this area. (in paintevent)
Since you are just rotating HOW you draw, and not the actual widget itself then
you see it being cutted.