LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   QThread and GUI (https://www.linuxquestions.org/questions/programming-9/qthread-and-gui-544292/)

ManuPeng 04-08-2007 11:04 AM

QThread and GUI
 
Hey,

Is there a way to update the GUI from within a QThread? The QThread::start() method doesn't accept arguments, like a pointer to a QProgressBar, so how do you feedback thread specific information to the GUI?

To be more exact, I have a QThread that counts, using a small for- loop, and I'd like a QLabel on my form to display the current value of the counter.

Any short code sample for me? Anyone?

Manu

ManuPeng 04-08-2007 11:53 AM

Progress
 
I got my class to multiple inherit from QObject and QThread at the same time and emit a signal to the GUI class. This passes the value of my counter to the slot that updates the QLabel, the only problem is that it's slow as Hell, and that's not exactely the point of multithreading...

Any idea what I'm doing wrong? Emitting too many signals too often?

Manu
PS: Just found it, I had a "sleep(1);" in there causing the thread to pause for one second very often.


All times are GMT -5. The time now is 05:48 AM.