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.7k 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.
  • P Offline
    P Offline
    pengxu
    wrote on 12 May 2022, 02:07 last edited by pengxu
    #1

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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 12 May 2022, 21:04 last edited by
      #2

      Hi,

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

      Which are they ?

      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 13 May 2022, 11:41
      0
      • J Offline
        J Offline
        JoeCFD
        wrote on 12 May 2022, 21:33 last edited by JoeCFD 5 Dec 2022, 21:34
        #3

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

        P 1 Reply Last reply 13 May 2022, 06:17
        0
        • J JoeCFD
          12 May 2022, 21:33

          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 13 May 2022, 06:17 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

          J 1 Reply Last reply 13 May 2022, 13:30
          0
          • S SGaist
            12 May 2022, 21:04

            Hi,

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

            Which are they ?

            P Offline
            P Offline
            pengxu
            wrote on 13 May 2022, 11:41 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 13 May 2022, 12:17
            0
            • P pengxu
              13 May 2022, 11:41

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

              M Offline
              M Offline
              mpergand
              wrote on 13 May 2022, 12:17 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
                13 May 2022, 06:17

                @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

                J Offline
                J Offline
                JoeCFD
                wrote on 13 May 2022, 13:30 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 16 May 2022, 05:48
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 13 May 2022, 18:58 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 16 May 2022, 02:33
                  1
                  • S SGaist
                    13 May 2022, 18:58

                    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 16 May 2022, 02:33 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

                    J A 2 Replies Last reply 16 May 2022, 20:24
                    0
                    • J JoeCFD
                      13 May 2022, 13:30

                      @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 16 May 2022, 05:48 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
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 16 May 2022, 20:05 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
                          16 May 2022, 02:33

                          @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

                          J Offline
                          J Offline
                          JoeCFD
                          wrote on 16 May 2022, 20:24 last edited by
                          #12

                          @pengxu try overlay widget with fullscreen widget as parent.

                          1 Reply Last reply
                          0
                          • P pengxu
                            16 May 2022, 02:33

                            @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 28 Aug 2024, 08:14 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 25 Nov 2024, 21:03 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