Sorry but i am very new in Qt's world and could not understand what you said. Can u kindly tell me where am i changing the location?

If you are talking about updating the 'xLocation' integer variable in paint function then well, i am doing that because i want each new rectangle to be drawn at new place.

If not, then please guide as to what i need to do.

Thanks a lot wysota