Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54830

OS X: Clicks on transparent parts of windows no longer passes through starting in Qt 5.6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.2
    • 5.6.0, 5.6.1, 5.7.0
    • None
    • Mac OS X 10.11.5
      Mac OS X 10.8.5
    • macOS
    • c35fc435950437d3d046b17d06593873d7b82011

    Description

      With Qt 5.5.x in OS X, windows that were transparent using the following method:

      window.setAttribute(Qt::WA_TranslucentBackground);
      window.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);

      had the property that when the user clicked on an area that was painted to be opaque, the window would receive the click, while if they clicked on a transparent area, the click would pass through the window to whatever UI element was below it, including UI elements in other applications.

      Starting in Qt 5.6, this behavior has changed such that clicks on the transparent parts of the window do not pass through.

      This is a regression because it used to be possible to create windows of non-standard shapes using this method by having the rectangular window be transparent and only painting the parts that the user should be able to click. As far as I can tell this is no longer possible in Qt 5.6 and later and is forcing me to stay on Qt 5.5.1.

      Attached is a simple application demonstrating the problem. Running it will open a window with a black outline and a red box. When built with Qt 5.5.x, clicking on the frame or red box will activate the window, and clicking on the transparent area will click whatever element in under the window. When built with Qt 5.6 and later, clicking anywhere inside the frame of the window will activate the window and not pass through the click.

      Attachments

        1. main.cpp
          0.6 kB
        2. mainwindow.h
          0.2 kB
        3. translucent_fix_5.6.diff
          1 kB
        4. translucent_fix_5.9.diff
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            guygizmo Brian Kendall
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes