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. Fullscreen and transparent window on MacOS
QtWS25 Last Chance

Fullscreen and transparent window on MacOS

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 828 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.
  • G Offline
    G Offline
    gladamyran
    wrote on 22 Oct 2019, 17:56 last edited by gladamyran
    #1

    Hello community!

    The problem I am trying to solve is to make a sort of screen recorder / screencast program. For that I am creating a window to select a rectangular area which should be recorded. I wanted to solve it solved like this: I create a fully transparent fullscreen window in order to paint on the whole screen (for the rectangle that I drag with the mouse) and receive mouse signals. Unfortunately when I make a window and initialize it like this

    setWindowState(windowState() | Qt::WindowFullScreen);
    setWindowOpacity(0);
    

    the background is lost, it just gets black. I've tried to change all sorts of flags, but nothing solved the problem. It works if I exchange it to

        setWindowState(windowState() | Qt::WindowMaximized);
        setWindowOpacity(0);
    

    but it's a bad solution, because I cannot record the menu bar in MacOS, which I need to do.

    So my question: Is there any way to

    • Grab all mouse events on the screen
    • with simultaneously being able to paint on the whole screen?
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on 22 Oct 2019, 20:30 last edited by mpergand
      #2

      @gladamyran said in Fullscreen and transparent window on MacOS:

      Try to call showFullScreen() instead of of setting Qt::WindowFullScreen attribute.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gladamyran
        wrote on 22 Oct 2019, 20:55 last edited by
        #3

        I tried that, it is the same result.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mpergand
          wrote on 22 Oct 2019, 21:13 last edited by
          #4

          All right, I understand what you mean by black background :)
          Unfortunatly, it's the default background.

          One possible workaround could be to take a snapshoot of the all desktop screen and draw this image as the background of the full screen window.

          btw, I don't know of multiplaform way to do this snapshoot ...
          I don't think Qt can do that.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gladamyran
            wrote on 23 Oct 2019, 17:19 last edited by
            #5

            I am actually not concerned with a cross platform solution, although it would be nice.
            It is a good idea taking a screenshot. It is a dirty solution, however, because of the flickering when I change to the window and the animation when I close the window.

            I guess for better results I would have to dig deeper into how to build GUI on MacOS in general.

            Thanks, anyway!

            1 Reply Last reply
            0

            1/5

            22 Oct 2019, 17:56

            • Login

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