Important: Please read the Qt Code of Conduct -

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

  • I'm developing an OS X app that utilizes frameless windows which have areas that are fully transparent. This is done by setting the flag Qt::FramelessWindowHint and setting the attribute Qt::WA_TranslucentBackground on my top level QWidget.

    When built using Qt 5.5, clicking on any portion of the window that was transparent would have the click pass through the window to whatever screen element was underneath it. This is an important feature of the application: only portions of the window that are opaque should receive clicks, while clicking transparent portions should behave like the window is not there.

    I recently updated to the beta of Qt 5.6 since it has some important bug fixes I need. However, now clicks on transparent portions of my windows do not pass through.

    Is there anything I can do to get the behavior I want in Qt 5.6? Is this possibly a new bug?

  • Lifetime Qt Champion


    Shouldn't you also set the Qt::WA_TransparentForMouseEvents attribute for that ?

  • @SGaist That would make clicks pass through for the entire window. I just want the transparent parts of the window to have clicks pass through.

  • Lifetime Qt Champion

    Then I'd ask on the interest mailing list about that behavior change. You'll find there Qt's developers/maintainers (this forum is more user oriented)

  • @SGaist et al,
    I tried the mailing list but haven't gotten any response so far. Can anyone recommend anything else to try?

    I'm finding myself stuck with Qt related issues in my app. So far, 5.3.x, 5.5.x, and 5.6 all have different, mutually exclusive bugs that are serious enough that I need to fix them. I suppose I could try 5.4.x and hope it works out. But it'd be much better if I could stay up to date with the latest stable Qt.

  • This is old but I'm bumping again, as I'm still stuck with this problem. I just tried Qt 5.7.0 and (not unexpectedly) it has the same behavior.

    I'd really like to make use of the features of Qt 5.6 and later, especially since 5.6 is a version with long term support. But as long as I can't find a workaround for this issue, I'm stuck with 5.5.1.

  • Lifetime Qt Champion

    If you can create a minimal compilable application that shows the behavior problem then you should take a look at the bug report system and see if something known. If not please consider opening a new report providing your sample application.

  • @SGaist Here is the bug report.

    In case you or anyone else is interested, here is a minimal sample application that demonstrates the

    // mainwindow.h
    #include <QMainWindow>
    class MainWindow : public QMainWindow
    	MainWindow(QWidget *parent = 0);
    	void paintEvent(QPaintEvent *);
    // main.cpp
    #include <QApplication>
    #include <QPainter>
    #include "mainwindow.h"
    MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
    	setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    void MainWindow::paintEvent(QPaintEvent *)
    	QPainter windowPainter(this);
    int main(int argc, char *argv[])
    	QApplication a(argc, argv);
    	MainWindow window;;
    	return a.exec();

    The app creates a transparent window that includes a frame outlining the window 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.

  • Lifetime Qt Champion

    Thanks for sharing !