QListWidget flickering

hi,

currently I have a QListWidget that I fill with items. This items are log lines from software. But QListWidget flickers like hell if many data arrives. Sometimes it leave blank sometimes it show something. Any idea how to optimize this?

Ingo
Ingo FoersterProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

trinitrotolueneDirector - Software EngineeringCommented:
why don't you have a caching strategy rather than load in real time? pre-fetch and then display as opposed to doing both at the same time.

Else create a separate thread for the load and let your GUI run in a separate thread. Fire an event when the data load completes and then let your GUI thread pick up the updates....
0
sarabandeCommented:
if you were using addItem or insertItem function to fill QListWidget you may change to 'addItems' resp. 'insertItems'. flickering occurs if the whole list was painted for each update. this is often due to event handling which forces additional paintings by invalidating parts of the window. or by customizing the list for example by drawing images or additional lines.

Sara
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ingo FoersterProgrammerAuthor Commented:
@ trinitrotoluene
I always use an own thread to decouple. This cause the flickering. If I do not use the own thread the UI is freeze until the list filling is finished.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Ingo FoersterProgrammerAuthor Commented:
@sara
I will try your suggestion.
0
sarabandeCommented:
I always use an own thread to decouple. This cause the flickering.
the thread my not cause painting. instead it should fill a shared list (container) with the data and then send a message to the main thread that it should refill from list.

if the thread is the only one which writes to the list, you not even need a mutex. simply write to the container and signal end of writing by a message to the gui and end the thread. then the main thread may take responsibility.

Sara
0
Ingo FoersterProgrammerAuthor Commented:
I use now the function to add more than one item at the same time and it works better. Thanks for the hint.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.