lundi 20 avril 2015

How to call a slot,that belongs to a QThread, within that same QThread?

I have a QThread that starts an external linux binary. I use connect() to call a slot(), which is part of the QThread, whenever I get an output from that external linux binary. This seems not to work for me. Can anyone tell me what is wrong in the below code?

class ThreadPowerSubSystem : public QThread

ThreadPowerSubSystem(){ }

private slots:
void checkForTwoSecPress()
    qWarning("button pressed");


void run()
    QProcess *powerProcess = new QProcess();
    connect(powerProcess, SIGNAL(readyRead()), this, SLOT(checkForTwoSecPress()));

Also I need to call a function to display a dialog inside that slot. Can anyone show me an example on how to do it? Thanks.

Aucun commentaire:

Enregistrer un commentaire