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

Tool Windows don’t stay on top of main Window after upgrading from QT 5.8 to QT 5.12.3



  • Hi,
    I’m experiencing an issue on Windows after upgrading to QT 5.12.3
    I have a set of tool windows that I create and assign a native window as their parent using setTransientParent(). These windows previously would always stay on top of the native window, but now they go behind the parent window just as soon as I mouse over the parent window.
    I’ve used Spy++ to inspect the native Win32 properties and it says that the tool windows do not have a parent assigned to them. The same tool windows in the old QT version, however, do have a parent.

    More details:

    • We’re setting this flags on the tool windows: Qt::Tool | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint
    • We’re setting these attributes: Qt::WA_NativeWindow and Qt::WA_NoSystemBackground

    Here's the code that sets the parent:

    HWND hMainWin = TpQtWin::mainWindow();
    QWindow* qMainWin = QWindow::fromWinId((WId)hMainWin);
    
    toolWindowWidget->setAttribute(Qt::WA_NativeWindow);
    
    QWindow* toolWindow = toolWindowWidget->windowHandle();
    toolWindow->setTransientParent(qMainWin);
    

    Has something changed in the more recent QT versions and I need to be doing something new?

    Any ideas on where to investigate or things to try?

    Thank you.


  • Lifetime Qt Champion

    Hi,

    There might have a lot of things that could have changed in between. Did you also check with a more current version ? Thinking about the latest 5.12 but also 5.14.



  • Hi @SGaist
    Unfortunately, we're in a situation where we have to use QT 5.12.3 as we've taken a dependence on a component that requires that specific version.


  • Lifetime Qt Champion

    I currently really meant just to check whether the situation is better with a newer version. If so, you might be able to backport the patch.

    Qt 5.12.3 exactly ? That's pretty surprising since Qt is both forward and backward compatible.


Log in to reply