qthread

Calling a function in child thread in Qt?

I have a main thread that invokes a child thread function at different times but I am not sure whether that is right way of doing it in Qt.What is wrong with the below code and looking for better alternative There is a main thread running infinitly when ever main thread releases the lock child does a piece of work. #include <QtCore/QC...

How can I terminate a QThread

Recently ,I come across this problem as I memtioned in this Title. I have tried by using QThread::terminate(),but I just can NOT stop the thread ,which is in a dead loop (let's say,while(1)). thanks a lot. ...

Qt signaling across threads, one is GUI thread?

What does it mean to move a object from one thread to another in Qt using moveToThread? Everything seems to work even before using moveToThread, which moves the object from one thread (GUI thread) to a another thread ( worked) and Qt:connect calls the appropriate slot on object. Is there any difference because of where the object lives,...

Emitting signals from other threads

I have a class which has a method that is called by the main thread and 3 other threads (2 QThreads and 1 made with QtConcurrent::run()). Inside this method I sometimes emit a signal. Is this okay or could it cause problems since I am not emitting signals that belong to the calling threads. ...

exception generated with qtconcurrent and calling QTime:currentTime

I seem to be getting an exception generated only with a thread created with Qtconcurrent::run I have a class named FPSengine which has a method named FPSengine::getData() that is called by the main thread and 3 other threads (2 QThreads and 1 made with QtConcurrent::run()). Inside FPSengine::getData() I call QTime::currentTime(). If I c...

*** glibc detected *** double free or corruption (fasttop):

A call to clear on a QByteArray generates the following exception: * glibc detected * /home/yan/FPS2/FPS2: double free or corruption (fasttop): 0 ?? 1 ?? 2 free 3 QByteArray::clear() 4 FPSengine::getDatagrams 5 FPSengine::xmitData 6 FPSengine::getData 7 threadDatalog::run 8 ?? 9 start_thread 10 clone 11 ?? 0 is this a qt ...

Question about QThread implementation

Hi, A QThread object represents a single thread of execution. But is the OS thread created when the QThread object is created, or when the start() method is called? I'm interested in whether I can have several QThread objects lying around, and the OS will create threads on start() and kill them after run() returns, and then I can reuse...

Do I need to call QThread.exec() in my thread?

I am not calling exec() yet my timer and QUdpSocket work just fine. Is exec used to wait for an event to continue? ...

Can I use waitForReadyRead in a QThread that belongs to the mainthread?

I have a QThread that contains a QUDPsocket (socket is member not local to QThread::run(), maybe I should change that from what I am reading). This QThread is instantiated in my QMainWindow class ie the GUI thread(I am not calling move to thread). Is it still safe to use waitForReadyRead or do I absolutly need to instantiate the QThread ...

Sending custom PyQt signals?

I'm practicing PyQt and (Q)threads by making a simple Twitter client. I have two Qthreads. Main/GUI thread. Twitter fetch thread - fetches data from Twitter every X minutes. So, every X minutes my Twitter thread downloads a new set of status updates (a Python list). I want to hand this list over to the Main/GUI thread, so that it can...

how can i inherit from both QWidget and QThread?

I have a class like this class GUI : public QWidget, public QThread When I do the above i get errors about connect signals. The error says "Reference to "connect" is ambiguous". Is there a way to inherit from both? Thank you ...

qapps runs well but breakpoint sometimes generates segmentation fault

I have a qApp that generates a segmentation fault only when a breakpoint is inserted in the code (I can put it at different places) and only after 4-5 breakpoint stops. Do I have a problem with my code or is this a DBG bug. the method is part of a QThread Class. Basically what I did is i took the mandlebrot example, and have 3 instan...

one timer per thread using Qt

Hi, I modified Qt's broadcast sender example so that it has ten threads and in each thread it starts a timer, but only timer of the first thread is triggered. How can I have one timer running for each thread? ...

Is it safe to draw three separate QImages in three separate QThreads?

I have a QMainWindow with three widgets inside that are promoted to a class containing a subclassed QThread. They each draw on a local QImage in their rexpective qthread which is sent with a signal once its drawn and then rendered by calling update (mandlebrot example) from the slot. Is this safe or dangerous? They do not share any data...

QThread and QRunnable - Simple multithread GUI application

Hello. Is it possible in QT to run QRunnable from QThread object without blocking GUI? I was created new thread using class derivered from QThread and from this class I want to run many small functions. But GUI is loocking when I'm trying to run QRunnable. Could you give me some instruction how to do this or maybe some example how to do...

QThread blocking main application

I have a simple form UI that has a slot for a button, starting a thread: void MainWindow::LoadImage() { aThread->run(); } And the run() method looks like this: void CameraThread::run() { qDebug("Staring Thread"); while(1) { qDebug("ping"); QThread::sleep(1); } } When I click the button that calls...

keep alive thread in PyQt4

Hey, I have a PyQt4 application, which at some point packs a big file using the tarfile module. Since the tarfile module does not implement any callback strategy, it blocks and the Qt GUI gets unresponsive. I want the GUI to keep updating during that time. The only possibility is a separate thread. So, I start a QThread. What do I have...

python QThread.run parameters - changed between versions?

Hi, In my code (python2.6, PyQt4) I do something like this: def myRun(): doStuff thread = QtCore.QThread() thread.run = myRun thread.start() On my gentoo machine, this works perfectly. On a ubunut (9.10, Karmic Koala) it does not work, it says: Type Error: myRun() takes no arguments (1 given) Did something change in QT? How can ...

Creating a QThread event loop in an existing non QT thread

My code is a plugin of a host software which gets limited processing time. Therefore, I create a second thread (via system API) and start QApplication there. That way, the GUI runs smoothly. Now, I would like to run a QThread event loop in the original such that I could use Signal/Slot (Qt::QueuedConnection) to invoke functions that are...

QThread and reading memory.

Dear All: I have faced such a problem. I have a library which allows through UDP inter-process communication. It is very straight forward. The library creates shared memory available for other processes to write and read from. When process wants to read a interested memory it passes a string value which uniquely points to corresponding ...