0

I am writing a small application in Qt (with PySide in Python), which makes extensive use of QGraphicsView and displays animations (sort of). There are a few buttons to start/stop/pause and a few other widgets.

At first, I thought I should use QThread to handle the graphics and send signals to the main thread to QGraphicsScene etc., so I began implementing it. It worked, but I was not very satisfied with it - I tried a few different ways, but I think I overcomplicated it too much and the signal/slot mechanism and locking QMutexes was not even that fast.

Then (I am new to PySide), I found the processEvents() method in the docs. I tried implementing it and it works just the way I want, it's fast and simple. Right now I am using it and everything is done on the main thread, and the GUI is responsive.

My questions are: Is it wrong to use that method in that way? Should I just stick to QThreads?

These questions are related to these...

How to make Qt work when main thread is busy?

Should I use QCoreApplication::processEvents() or QApplication::processEvents()?

... where others say it should not be used.

Community
  • 1
  • 1
mkcms
  • 262
  • 3
  • 9
  • possible duplicate of [Should I use QCoreApplication::processEvents() or QApplication::processEvents()?](http://stackoverflow.com/questions/2150966/should-i-use-qcoreapplicationprocessevents-or-qapplicationprocessevents) – Raidri Mar 24 '15 at 15:15
  • Why do you care what "others" say? You've discovered for yourself that `processEvents` can work well in certain situations, so why lumber yourself with maintaining a more complex multi-threaded solution when you already know it doesn't work any better for you? The `processEvents` function has been part of Qt since the very beginning, and the documentation has never suggested it shouldn't be used. It certainly has it's limitations (e.g. no parallel processing), but as long as you understand what it can and cannot do, there's no reason not to use it (practicality beats purity). – ekhumoro Mar 24 '15 at 17:24

0 Answers0