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

Qt::WindowStaysOnTopHint and full screen



  • Hello,

    I have a small problem with using Qt::WindowStaysOnTopHin in full screen.

    On Windows 10, for example, windows with this flag are always visible on a GPU intel. On the other hand, on a Nvidia card, windows with the Qt::WindowStaysOnTopHint flag go to the background if I click on the main window.
    I need to do a raise() to bring them to the first plan but this has an unsightly effect (screen flickering).

    I also tried with the Qt::WindowStaysOnTopHint flag but it doesn't change anything.

    I use Qt 5.15.0 and Opengl 4.0

    Thanks !



  • try using the windows winAPI function SetWindowPos.

    for Qt4.7, maybe it's the same on Qt5

    #ifdef WIN32
    // first force to show widget on top most
    // get win handle of the widget to force focus
    SetWindowPos(widget->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME | 
     WP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
    
    // then unforce to show widget on top most
    SetWindowPos(widget->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
    
    #endif
    


  • This post is deleted!

Log in to reply