Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Call Slot only when process finished the last time?



  • Hi there,

    in my application i have a FOR-Loop in which i start a process x-times. When the process finishes i call the my Slot-function to show a MessageBox to the user that it has finished.

    My Problem is now, that the Slot-Function is everytime called when the process finished. So when the process starts 5-times, the message appears 5-times, but the message should only appear if the process runs the 5th time (the last run).

    How can i do this? Thanks for help!


  • Moderators

    Can't you Just move the message box out of the loop then?



  • @Chris-Kawa yes that is an option, but what if erros appear while the processes running? If i put the MessageBox after the for-loop i need a mechanism to check if there was an error or not. therefore i wanted to use Signal and Slot for the process.

    EDIT
    i solved it. I wrote a function in which i check if there where errors with readAllStandardError and if the size of it is zero, no error appeared and the show the message box.