by looking into setWindow and setViewPort,
I understood that by setWindow i can tell the painter the rect i want it to draw in it.
so i did this :
QRect widgetRect
= this
->rect
();
windowRect.setHeight(widgetRect.height()-50);
windowRect.setWidth(widgetRect.width()-50);
windowRect.setX(widgetRect.x()-50);
windowRect.setY(widgetRect.y()-50);
painter.setWindow(windowRect);
painter.drawRect(myRect);
QRect widgetRect = this->rect();
QRect windowRect;
windowRect.setHeight(widgetRect.height()-50);
windowRect.setWidth(widgetRect.width()-50);
windowRect.setX(widgetRect.x()-50);
windowRect.setY(widgetRect.y()-50);
painter.setWindow(windowRect);
painter.drawRect(myRect);
To copy to clipboard, switch view to plain text mode
expecting that when i draw using the painter it will draw inside this windowRect.
but it does not, it will draw out of the border in the invisable area for the user.
I dont know what exactlly i should set it.
Bookmarks