Qt World Summit: Submit your Presentation

Window focus with process pointer

  • Hi there,

    Currently working on an application that runs external programs using process.start. The process is then stored in a QList for future handling. Now when the user double clicks an item in my tableWidget I start the process, but when the user clicks an item that already fired an external process it should bring up that window and not start a new process.
    So the question is: How can I get a window raised using the process class??

    qpProcess.start("program", qslArguments);


  • Welcome to the forum.

    You can use "QProcess::state()":http://doc.qt.nokia.com/4.7/qprocess.html#state for finding out of the current state of the execution of the process. However, the question is, if this is really what you like to see. If like to avoid doubly started processes this is ok. What about the process has been successfully executed already? Do you tolerate repeated execution, when not necessary?

  • Hi, thx for the info.....
    It is more that I have a server like program in Qt that has to be able to "fire" client executables. With the finished and error signals I always know what the state of the client program is. So when a user double clicked an item it launches a client process. I keep track of that process and link it to the double clicked item. When the user double clicks the same item I give a notification in the status bar telling the user that the program is already open for that item, but I also want to give focus to that client process.
    I found some stuff with pid(), but not really getting it just yet.

  • I think that is not possible, if you are using QProcess. What you could do is to display all information in a QTextBrowser window, when the user clicks again. However, you need to handle also additional commands input by the user then.

Log in to reply