Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50271

WindowStaysOnTopHint works randomly (if at all) on Windows



    • Bug
    • Status: Closed
    • P3: Somewhat important
    • Resolution: Done
    • 5.4.0
    • 5.10.1
    • QPA: Windows
    • Windows 7 Professional 64-bit.
    • 329a029c361bcbaf70f3aa919693f0bef48a152f (qtbase/5.9, 16.5.2017, 5.9.1)


      Attempting to set Qt::WindowStaysOnTopHint seldom works on Windows these days.

      We recently upgraded to Qt 5.4 (from Qt 4.7) and every widget or dialog that uses this flag rarely has the underlying window style set. (I.e., they're never 'on top'.)

      Very occasionally it works as advertised, but most of the time the widget in question will either be opened beneath other windows, or other windows can be moved/opened over it.

      We have two main ways of setting this flag:

      1) Calling setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint) from the constructor of a QWidget derived object.

      2) Passing Qt::WindowStaysOnTopHint (along with other flags) as the second parameter to the QDialog constructor.

      Neither seem to work particularly well.

      Our products are built for both Linux and Windows. The Linux versions are working fine. (At least nobody has complained about them since we upgraded, and they appear to be working fine.)


        1. main.cpp
          0.4 kB
        2. qtbug50271_diag.diff
          5 kB
        3. qtbug50271.zip
          2 kB
        4. testdialog.cpp
          0.9 kB
        5. testdialog.h
          0.1 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              kleint Friedemann Kleint
              CrazyDef James Robertson
              3 Vote for this issue
              6 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes