Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]How to make always top window
QtWS25 Last Chance

[Solved]How to make always top window

Scheduled Pinned Locked Moved General and Desktop
11 Posts 7 Posters 91.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jackbauer_777
    wrote on 21 Oct 2010, 09:12 last edited by
    #1

    I want to know how to make the widget which always keep top like TaskManager
    whenever active window switches to any window.

    Please advise me!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on 21 Oct 2010, 09:56 last edited by
      #2

      @setWindowFlags(Qt::WindowStaysOnTopHint);@

      1 Reply Last reply
      2
      • J Offline
        J Offline
        Jackbauer_777
        wrote on 21 Oct 2010, 11:12 last edited by
        #3

        Thank you for your quick response!
        I succeeded^^
        So this problem is solved.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jackbauer_777
          wrote on 21 Oct 2010, 11:24 last edited by
          #4

          Sorry but When I used FramelessWindowHint,
          my Widget can't keep "StaysOnTop".

          How should I do ? please teach me!

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mcosta
            wrote on 21 Oct 2010, 13:01 last edited by
            #5

            The Qt documentation for Qt::WindowStaysOnTopHint says:

            bq. Informs the window system that the window should stay on top of all other windows. Note that on some window managers on X11 you also have to pass Qt::X11BypassWindowManagerHint for this flag to work correctly.

            If you are on X11 try it

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stukdev
              wrote on 22 Oct 2010, 06:51 last edited by
              #6

              bq. Sorry but When I used FramelessWindowHint,
              my Widget can’t keep “StaysOnTop”.

              How should I do ? please teach me!

              This work for me (windows xp)
              this->setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);

              maybe try the tips of mcosta if you're on x11.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jackbauer_777
                wrote on 25 Oct 2010, 14:03 last edited by
                #7

                Thank Mr stuk and mcosta for your kind reply!

                I succeeded in making Frameless and StaysOnTop window.

                My fault is that I called setWindowFlags twice for FramelessWindowHint and WindowStaysOnTopHint respectively.

                I apologize for my poor knowledge.

                So this issue is solved.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mingxiao
                  wrote on 1 Nov 2013, 21:00 last edited by
                  #8

                  On a similar vein, from the main app I'm opening up a small dialog box by creating a QWebView.

                  By default its in the background I wanted it to show up on the foreground so I set the WindowStayOnTop flag, however I don't want it to always stay on top, just when its first created and then act like a normal window afterwards.

                  How do I achieve this?

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    lygstate
                    wrote on 17 Dec 2013, 03:22 last edited by
                    #9

                    really good answer, but I want more, if I want the widget won't be stay on top when i switch to other application, such as Chrome/Visual Studio, how to do that, that means, I want that widget only stay TOP in-application.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mpcarlos87
                      wrote on 30 Apr 2014, 08:12 last edited by
                      #10

                      [quote author="lygstate" date="1387250539"]really good answer, but I want more, if I want the widget won't be stay on top when i switch to other application, such as Chrome/Visual Studio, how to do that, that means, I want that widget only stay TOP in-application.[/quote]

                      I'm looking for the same thank you! Anyone knows how to do it?

                      Thanks!

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tataeress
                        wrote on 12 Feb 2021, 12:56 last edited by
                        #11

                        It can be done by adding flag Qt::Popup
                        and if you have some transparent window so you want to have it always on top of chrome etc.. and at the same time you want your that flag not to force you show the rectangular edges of the window
                        you also add the flag Qt::Sheet

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved