5

I have a simplest test case application:

TransWidget.cpp:

TransWidget::TransWidget(QWidget *parent) :
    QWidget(parent, Qt::Window | Qt::FramelessWindowHint)
{
    setAttribute(Qt::WA_ShowWithoutActivating);
    setAttribute(Qt::WA_TransparentForMouseEvents);
    setAttribute(Qt::WA_TranslucentBackground);
}

void TransWidget::paintEvent(QPaintEvent *)
{
    // some code to mark the presence of the window
}

void TransWidget::wheelEvent(QWheelEvent * ev)
{
    ev->ignore(); // keeps getting here no matter what I try!
}

main.cpp:

#include "TransWidget.h"
#include "OpaqueWidget.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    OpaqueWidget o;
    auto t = new TransWidget(&o);

    o.show();
    t->show();

    return a.exec();
}

Opaque widget simply reports when it gets mouse clicks and wheel events. Transparent widget overlays the opaque widget.

Mouse clicks work as expected:

  • fall through transparent regions to the opaque widget;
  • get caught by transparent widget when clicked in its painted (thus opaque) areas.

Wheel events get caught by the transparent widget no matter where they occur. The same setup used to work with Qt4.8. Is it a bug in Qt5? Any workarounds possible?

The solution to a similar question doesn't seem to work also: How to create a semi transparent window in WPF that allows mouse events to pass through

(Qt 5.6.1, Windows 10)

Community
  • 1
  • 1
vines
  • 5,160
  • 1
  • 27
  • 49

1 Answers1

1

Accepted as a Qt bug, see https://bugreports.qt.io/browse/QTBUG-53418 for details.

vines
  • 5,160
  • 1
  • 27
  • 49