Qt::WindowCloseButtonHint on a certain window



  • Hello,

    i have a Program that starts a QT (QMainWindow) when one clicks on a button.

    I want the QT Program just to stay on top of this other window.

    Qt::WindowCloseButtonHint makes a window stay on top all windows
    @
    w.setWindowFlags( Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
    @

    I have the HWND to the window that starts the QT Program.

    Thanks.


  • Moderators

    whats your question after all?



  • My question is how to place my qt main window on top a certain window.
    I only have the Hinstance (NOT HWND) to this window.


  • Moderators

    ok, sry did got what you wanted.

    In Qt you would do this: listen to the window activation event (e.g. with an event filter) on the base window and call QWidget::raise() for the widget/window you want to place above.

    So in case your main application is not written in Qt you need to struggle with WinAPI accomplishing the same mechanism i described.



  • Am thinking i could set the HWND from the program that opens the QT as the parent to the QT program.
    Then set the window flag of the qt program to QT::Tool ;-)



  • Solved:

    using the SetParent win32 API and the Qt::Tool
    @
    HWND newParent = SetParent((HWND)w.winId(), p_hwnd);
    w.setWindowFlags( Qt::Tool);
    @

    where p_hwnd is the Program that starts my Qt.

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.