Qt World Summit: Register Today!

All my window blinks when using QProcess

  • In a multithreaded application I use a Qtprocess to launch an application external to my Qt application. The launch of this QtProcess is executed in a different thread from the GUI.

    This is how I launch my process and how I wait.
    QProcess Process;
    Process.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *pCreateProcArgs)
    pCreateProcArgs->flags |= CREATE_NO_WINDOW;
    pCreateProcArgs->startupInfo->dwFlags |= STARTF_USESHOWWINDOW | STARTF_FORCEOFFFEEDBACK;
    pCreateProcArgs->startupInfo->wShowWindow |= SW_HIDE | SW_SHOWNOACTIVATE;
    Process.start( cmd );
    PrestoProcess.waitForFinished( 600000 );

    When my process finishes the window of my Qt application blinks, but the other applications running on my computer as well.
    The frame of my window blinks as if it received an event of focus ... well I think. Same for all the applications present on my PC.

    I want to avoid that all my windows flash. How to do?
    I have already set up a filter so that the cursor is not modified (hourglass)

    Thank you in advance for your help

  • @rth42000 Hi, which operating system do you use? And which window manager? (If your OS gives you any choice :-) )

  • @rth42000 It sounds like it is losing and gaining focus back again cause it to flicker. Try setting your window to always on top then launch the process and then reset it back to a normal window zpos. See if that changes anything. If it does then at least we know where to look to solve the problem. If it doesn't chances are it's still creating a window even though you don't see it, which causes the flicker.

    Hard to tell without a screencast or video or something.

    Also try changing your process to be one without any custom flags, but make the process something that doesn't have a window. See if the flicker occurs. A simple process could just be something like:

    int main()
       return 0;

    It does nothing and should not create a window. Should be easy to test with.

Log in to reply