PDA

View Full Version : Delaying repaint in QListBox



gren15
1st April 2009, 18:30
I am using Qt3.3.5, where I have a QListBox, in which I have added a number of pixmaps (100).


myListBox->insertItem(myPixmap1, myText);


Everytime an item of the QListBox is selected, I do a modification to the pixmap and add it back to the QListBox


myListBox->changeItem(updatedPixmap, updatedText, indexLocation);


Issue

As the QListBox grows, the Vertical Scroll bar appears. When I select the last item of the QListBox, there is a flicker.
This happens because when a changeItem is called, it removes the old item and replaces by the new one, during this time the vertical scroll bar moves up when the item is removed, and moves back down to the bottom of the QlistBox view after the 'changeItem' is called.


Troubleshooting
I tried:


myListBox->setUpdatesEnabled(false);
myListBox->changeItem(updatedPixmap, updatedText, indexLocation);
myListBox->setUpdatesEnabled(true);

but this doesn't work.

Is there any way to workaround this? Maybe delaying the repaint/ update ?

Any suggestions will be appreciated, as this solution is required for my project.
Thanks!