Signals and slot machines QT


I have asked a number of different questions now all regarding one main issue in my program and still not solved it at all, I'm using threading to keep my UI from locking up, but basically it still does because apparently you can't do UI stuff in threads.

So I've been told to use custom signals and slots (not that any examples were given).

So from the documentation I've read I came up with this code:



void paint_signal(double x, double y);


  connect(this,SIGNAL(paint_signal(double x, double y)), this, SLOT(PaintSomething(x,y)));

the Paintsomething function is within the same class as all of this....


*future2 = QtConcurrent::run(this, &GUI::paintAll);

paint all emits the paint_signal and passes 2 doubles

emit paint_signal(x, y);

but I get this error which I just don't understand at all

 connect: No such signal GUI::paint_signal(double x, double y)

        SIGNAL(paint_signal(double, double)),

Remove parameter names and it should work. If this one doesn't work this one will:

        SIGNAL(paint_signal(double, double)),

Let me know if this works out for you :)


The idea is that you cannot use the UI in a thread, instead you emit signals from the thread to the UI. Because this answer probably gets you back to the beginning (and possibly a new question) here is a working example of how to emit signals from threads:

QT Signals to UI in a thread