PDA

View Full Version : Some children not redrawn on large QT widget after repaint



suneyes
15th March 2010, 06:08
I have am application which resembles a form and some widgets on it. For this is use QFrame and QLineEdit for example.
I provide drag-drop of the widgets within the form. When i start drag i 'highlight' the background of the form (or any other container) indicating which is right parent. For this i have event filter installed for the widget and handle the paint event, in which i render highlighted background for widget. When request for highlight, i call repaint(). This works well till medium sized forms.
But if a have a large form and many edits on it, and if i start drag of one edit, then the other visible ones disappear. This disappearing is sometimes partial, sometimes total. I suspected the following:
1. Due to large form , paint starts from start of widget and by the time it reaches visible portion, its exhausted. But the rect that paintEvent gives is smart i.e only visible portion.
2. Somehow the paint of children happen before parent and hence they get 'hidden'. For this i tried to raise() the visible children after painting. It works fine, but its heavy, so not a perfect solution
3. I also have setAutoFillBackground(true) in the cTor of widget, when i remove this i.e it works almost fine without any additions.

Ive read that continuous repainting of widget causes flicker and even hiding of children. Is there any better solution or real cause of this ?
Also please let me know if i need to post the code part here for better idea.