7

我想创建一个不妨碍用户其他活动的半透明信息窗口。窗口上的任何点击都应该像窗口不存在一样通过。

你会如何建议实施这种行为?有没有一种简单的方法可以做到这一点,还是我必须遵循一个笨拙的解决方法?我正在考虑隐藏窗口,重新执行单击,然后使窗口再次可见。但这仍然会搞砸拖放手势。

4

2 回答 2

7

Take a look at an enum value of Qt::WidgetAttribute: Qt::WA_TransparentForMouseEvents:

When enabled, this attribute disables the delivery of mouse events to the widget and its children. Mouse events are delivered to other widgets as if the widget and its children were not present in the widget hierarchy; mouse clicks and other events effectively "pass through" them. This attribute is disabled by default.

于 2012-04-06T11:38:54.793 回答
0

我对“鼠标事件透明度”做了更多研究(不知道确切的术语),我发现了这个

我认为您的问题没有通用且简单的方法。您可能必须深入研究本机 API。一旦事件到达一个应用程序,它们就不会自行转发到其他应用程序。

你们有什么感想?我注定要使用每个操作系统的原生 API 吗?

于 2012-04-06T17:18:36.930 回答