Opened 7 years ago

Last modified 8 months ago

#279 new defect

Qt::WindowStaysOnTopHint support

Reported by: komh Owned by:
Priority: minor Milestone: Qt 5
Component: QtGui Version: 4.7.3
Severity: low Keywords:


Any plans ?

Change History (2)

comment:1 Changed 11 months ago by diver

  • Milestone changed from Qt Enhanced to Qt 5

comment:2 Changed 8 months ago by ataylor

I was just looking for this feature and wondering why it didn't work on OS/2. :)

I tried this hack:

#ifdef __OS2__
#define WS_TOPMOST  0x00200000L

    HWND hwnd = WinQueryWindow( winId(), QW_OWNER );
    if ( hwnd )
        WinSetWindowBits( hwnd, QWL_STYLE, isOnTop? WS_TOPMOST: 0L, WS_TOPMOST );

    Qt::WindowFlags flags = windowFlags();
    if ( isOnTop )
        flags |= Qt::WindowStaysOnTopHint;
        flags &= ~Qt::WindowStaysOnTopHint;
    setWindowFlags( flags );

Interestingly, using winId() for the dialog handle did nothing. However, using winId()'s owner 's hwnd does work... sort of.

Unfortunately, while the resulting window does stay on top, context menu events don't get inherited by child windows anymore, and the context menu itself opens behind the dialog, so this does not seem to be a viable workaround. :/

Note: See TracTickets for help on using tickets.