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. Can qwidget show on top of anoter app when that app is in fullscreen mode on Mac OS?
Forum Updated to NodeBB v4.3 + New Features

Can qwidget show on top of anoter app when that app is in fullscreen mode on Mac OS?

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 6 Posters 1.5k Views 3 Watching
  • 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.
  • JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #3

    Yes, you can. Set its parent to nullptr and the flag to on top. This works on Linux.

    P 1 Reply Last reply
    0
    • JoeCFDJ JoeCFD

      Yes, you can. Set its parent to nullptr and the flag to on top. This works on Linux.

      P Offline
      P Offline
      pengxu
      wrote on last edited by
      #4

      @JoeCFD
      like this?
      QWidget* test = new QWidget();
      test->setWindowFlag(Qt::WindowStaysOnTopHint);
      test->show();

      It does not work on Mac, when other app at fullscreen state

      JoeCFDJ 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        It's going to depend on the OS and the application.

        Which are they ?

        P Offline
        P Offline
        pengxu
        wrote on last edited by
        #5

        @SGaist
        I'm sorry, I re-edited the question.
        What I need is on Mac OS system

        M 1 Reply Last reply
        0
        • P pengxu

          @SGaist
          I'm sorry, I re-edited the question.
          What I need is on Mac OS system

          M Offline
          M Offline
          mpergand
          wrote on last edited by
          #6

          @pengxu
          At least it works with Qt::tool window flag. (tested with one of my apps)
          But, as the doc stated, it should work with Qt::WindowStaysOnTopHint, maybee in combination with another flag (dialog ?) .

          1 Reply Last reply
          0
          • P pengxu

            @JoeCFD
            like this?
            QWidget* test = new QWidget();
            test->setWindowFlag(Qt::WindowStaysOnTopHint);
            test->show();

            It does not work on Mac, when other app at fullscreen state

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #7

            @pengxu said in Can qwidget show on top of anoter app when that app is in fullscreen mode on Mac OS?:

            Qt::WindowStaysOnTopHint

            Try to create a window and set the flags as below to see if it works. Do not use qwidget.
            setWindowFlags(Qt::CustomizeWindowHint
            | Qt::FramelessWindowHint
            | Qt::WindowStaysOnTopHint);

            Sure, as mpergand suggested, you can try qdialog as well.

            Or something like subwindow? not sure. Never used it.
            https://localcoder.org/notification-window-in-mac-with-or-without-qt#solution_1

            If nothing works, add overlay widget to the fullscreen widget and use the full screen widget as parent. this will work.

            P 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              A full screen application on macOS is not the same thing as one on Windows or Linux. It moves to its own "desktop" and thus other applications are not working on the same space.

              What exactly are you trying to do with your application ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              P 1 Reply Last reply
              1
              • SGaistS SGaist

                A full screen application on macOS is not the same thing as one on Windows or Linux. It moves to its own "desktop" and thus other applications are not working on the same space.

                What exactly are you trying to do with your application ?

                P Offline
                P Offline
                pengxu
                wrote on last edited by
                #9

                @SGaist
                My application has an function "sharing screen", there is toolbar on top of screen that users can try to stop sharing. Even when user is using other apps on fullscreen mode.
                I can achieve this by using objective-c code, but I don't know how to achieve this by Qt

                JoeCFDJ A 2 Replies Last reply
                0
                • JoeCFDJ JoeCFD

                  @pengxu said in Can qwidget show on top of anoter app when that app is in fullscreen mode on Mac OS?:

                  Qt::WindowStaysOnTopHint

                  Try to create a window and set the flags as below to see if it works. Do not use qwidget.
                  setWindowFlags(Qt::CustomizeWindowHint
                  | Qt::FramelessWindowHint
                  | Qt::WindowStaysOnTopHint);

                  Sure, as mpergand suggested, you can try qdialog as well.

                  Or something like subwindow? not sure. Never used it.
                  https://localcoder.org/notification-window-in-mac-with-or-without-qt#solution_1

                  If nothing works, add overlay widget to the fullscreen widget and use the full screen widget as parent. this will work.

                  P Offline
                  P Offline
                  pengxu
                  wrote on last edited by
                  #10

                  @JoeCFD
                  I tried this, but it does not work either
                  QDialog* test = new QDialog();
                  // test->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool | Qt::FramelessWindowHint);
                  test->setWindowFlags(Qt::CustomizeWindowHint
                  | Qt::FramelessWindowHint
                  | Qt::WindowStaysOnTopHint);
                  test->show();

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    Since it's macOS specific, nothing wrong with mixing some Objective-C++ to achieve your objective.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • P pengxu

                      @SGaist
                      My application has an function "sharing screen", there is toolbar on top of screen that users can try to stop sharing. Even when user is using other apps on fullscreen mode.
                      I can achieve this by using objective-c code, but I don't know how to achieve this by Qt

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by
                      #12

                      @pengxu try overlay widget with fullscreen widget as parent.

                      1 Reply Last reply
                      0
                      • P pengxu

                        @SGaist
                        My application has an function "sharing screen", there is toolbar on top of screen that users can try to stop sharing. Even when user is using other apps on fullscreen mode.
                        I can achieve this by using objective-c code, but I don't know how to achieve this by Qt

                        A Offline
                        A Offline
                        abooo
                        wrote on last edited by
                        #13

                        @pengxu Can you share how to use object-c to implement this feature?

                        1 Reply Last reply
                        1
                        • R Offline
                          R Offline
                          Rida Shamasneh
                          wrote on last edited by
                          #14

                          Hi all,

                          Any help with this issue?

                          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