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 I create a translucent window
Forum Updated to NodeBB v4.3 + New Features

Can I create a translucent window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.7k Views 1 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.
  • R Offline
    R Offline
    Radical
    wrote on last edited by
    #1

    Hi,

    I'm using QPixmap.grabWindow to get the contents of an existing X11 App's window (Orig).

    I also want to draw my own translucent window over Orig, so that:

    1. grabWindow still works for Orig, as if it isn't obscured by the visible details in my window
    2. mouse and keyboard events pass through my window

    I understand the concept of an overlay, but the docs only mention QGLwidget being drawn underneath regular widgets. Is it possible to meet my requirements in Qt?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rokemoon
      wrote on last edited by
      #2

      Try "this":http://developer.qt.nokia.com/wiki/QWidget_Semi-transparent_Background_Color for transparent window

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Radical
        wrote on last edited by
        #3

        Failed to replicate this with qtruby. I'll try with c++ later.

        For now I tried drawing the grabWindow pixmap in MyWindow's paintEvent. I then set MyWindow to always-on-top in gnome and tried alternately clicking each window's title-bar while MyWindow was partly covering the original.

        Unfortunately this caused recursive garbage. This means the window has to be on top for grabWindow to work. I've heard modern X11 implementations maintain a pixmap of each window in memory but I guess xlib and in turn qt ignore this feature.

        When I started the thread I was under the impression there was a way of drawing to an overlay, which I thought could exist above the default screen. I'm going to assume this isn't true.

        That leaves raising the original window before I paint mine. So I'm looking for a Qt function which accepts an arbritrary window id and sends a raise event.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          manishsharma
          wrote on last edited by
          #4
          1. mouse and keyboard events pass through my window

            1. Qt::WA_TransparentForMouseEvents or

            2. QWidget::setMask() -> you need to calculate region of MyWindow which can be painted and pass that to setMask function.

          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