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. Translucent window with click-through behaviour

Translucent window with click-through behaviour

Scheduled Pinned Locked Moved General and Desktop
transparencywindowclickthroughtranslucent
3 Posts 2 Posters 1.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.
  • R Offline
    R Offline
    Rphysx
    wrote on 20 Jun 2015, 21:14 last edited by
    #1

    I'm making a translucent window using the following flags:

    w.setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
    w.setParent(0); // Create TopLevel-Widget
    w.setAttribute(Qt::WA_NoSystemBackground, true);
    w.setAttribute(Qt::WA_TranslucentBackground, true);
    w.setAttribute(Qt::WA_PaintOnScreen);
    

    The problem I'm facing is that every portion of the window which is unpainted has an undesiderable effect of click-through that alters the user experience.
    Using this simple hack on paint event:

    painter.fillRect(e->rect(), QColor(0,0,0,1));
    

    Give the wanted effect of a window region that spans through all the window and not just over painted parts.
    This anyway is undesiderable since it makes the window effectively opaque (even though is hardly noticeable) and here I am asking for possible solutions to effectively aim and fix this problem

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Jun 2015, 21:18 last edited by
      #2

      Hi,

      You should add which version of Qt you are using as well as OS you are running on

      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
      1
      • R Offline
        R Offline
        Rphysx
        wrote on 20 Jun 2015, 21:45 last edited by
        #3

        Win7 & Qt 5.4.2 with QtCreator 3.4.1

        1 Reply Last reply
        0

        1/3

        20 Jun 2015, 21:14

        • Login

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