Qtimer::singleshot slot completed

  • Hi All
    Is there any way I can find out that slot
    QTimer::singleShot(1500, this, std::bind(&MyClass::crossCapture, this, getMousePointerX(), getMousePointerY()));

    has been completed

  • Qt Champions 2018

    put qDebug("Completed"); as the first line of MyClass::crossCapture

  • I am passing a reference variable as bool in slot of Qtimer::singleShot and then accesing this variable in called and putting a while loop on the same to check of the slot is completed any other way to do that

  • Qt Champions 2018

    Are you using multiple threads? if not what you are doing is totally useless. No instruction can be performed while another is in the same thread

  • @VRonin said in Qtimer::singleshot slot completed:

    hat you are doing is totally usel

    I am using multple thread one is thread1 amd other is main Gui threadd

    Qt Enthusiast about 6 hours ago
    Hi All

    Is there any way I can find out that slot updateGui is completed .

    QTimer::singleShot(0, this, updateinMaingui());

  • Qt Champions 2018

    Then the only solution is have a signal in the main thread that fires when that method completed

  • if you can help me with the sample code

  • Qt Champions 2018

    class MyClass : public QObject{
    // other stuff
    Q_SIGNAL void crossCaptureFinished();
    void crossCapture(int x, int y){
    //other stuff
    emit crossCaptureFinished();

    [edit: added missing emit keyword SGaist]

  • @Qt-Enthusiast could you please described in words what's your requirement or what you're trying to do overall? You've already have asked about QTimer::singleShot, and now this loop inside it, it sounds that you might be over complicating things...

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.