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. How to create transparent window in Linux
QtWS25 Last Chance

How to create transparent window in Linux

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 8.9k 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.
  • A Offline
    A Offline
    aashish.lg
    wrote on 6 Mar 2012, 11:55 last edited by
    #1

    I am using below mention code Inside constructor of MainWindow class of my simple QtWidget application.

    @setWindowFlags(Qt::FramelessWindowHint);
    setStyleSheet("background:transparent;");
    setAttribute(Qt::WA_TranslucentBackground);@

    This makes my window background transparent in WINDOW.
    But in Linux machine my window bg is totally black and on command prompt I am getting below mention message.

    “QGtkStyle was unable to detect the current GTK+ theme.”

    Please help whats going wrong in Linux machine

    1 Reply Last reply
    0
    • A Offline
      A Offline
      anselmolsm
      wrote on 7 Mar 2012, 12:30 last edited by
      #2

      Hi Ashish,

      Could you please describe your environment? For example, are you running Gnome, Unity, etc? It can help me and other people to find what is the cause of your problem.

      Maybe it is not the same case, but some colleagues experienced this issue when their gnome environments were with desktop effects disabled.

      Also, check if this issue happens when you use another style. Do the following: Run your app in the command line with the argument "-style <another style> ", where another style can be motif, plastique, cleanlooks, etc.

      Anselmo L. S. Melo (anselmolsm)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on 7 Mar 2012, 12:44 last edited by
        #3

        Be aware that your code is currently clearing out any set window flags besides Qt::FramelessWindowHint.
        @
        setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
        @
        In addition, make sure your X server supports ARGB visuals and you're having a compositing window manager.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aashish.lg
          wrote on 7 Mar 2012, 14:46 last edited by
          #4

          Thanks for your replies.

          I have checked my Linux environment details, below are the inputs:-

          1. I am using GNome desktop environment in my Suse Linux.
          2. I have checked by executing the app from command line by specifying various style flags but still black window.

          Note :- if I am not using any style flag from command line , I am getting the below mention message
          "lib: extension "RANDR" missing on display ":12.0".
          but after using any of the style suggested by you , now this message is not coming.

          1. I have ensured that none of other flags apart from FramelessWindowsHint is enabled by using the
            code suggested as
            @setWindowFlags(windowFlags() | Qt::FramelessWindowHint);@
          1 Reply Last reply
          0
          • A Offline
            A Offline
            aashish.lg
            wrote on 7 Mar 2012, 15:59 last edited by
            #5

            HI Guyz,

            I found very interesting post at below mention location about transparency effect on X11.

            http://stackoverflow.com/questions/7922177/qtwa-translucentbackground-available-everywhere

            I guess Lukas is very near to the root cause if the prob.
            I checked in my application using following code
            @QX11Info::isCompositingManagerRunning()@
            and it returned false, means I am not running Composite Manager and I dont know how to enable ARGB visuals for X11.

            First time in my life I am touching Linux machine.
            Guyz please help me how to enable ARGB visuals and Composite manager.

            Please help!!!!!

            Regards
            Ashish

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gitesh Yeole
              wrote on 14 Jun 2019, 07:06 last edited by
              #6

              Any further update on this ?
              I also have same question how to enable ARGB visuals and Composite manager ????

              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