OS X透明面板在Qt? [英] OS X transparent panels in Qt?

查看:270
本文介绍了OS X透明面板在Qt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有创建透明面板的方法,如 Qt 4.6 (适用于OS X 10.6 / Cocoa)创建/ apple_ref / doc / uid / 20000961-SW24rel =nofollow noreferrer> Apple人机界面指南 )?

Is there a way to create a transparent panel as described by the Apple Human Interface Guidelines in Qt 4.6 (built for OS X 10.6/Cocoa)?

如果没有,在外观和功能上是否有类似的替代?

If not, are there any alternatives similar in look and function?

c $ c> Qt 是一个跨平台工具包,但我希望我的应用程序感觉尽可能原生。

I understand that Qt is a cross platform toolkit, but I want my application to feel as "native" as possible.

推荐答案

我没有在Mac上试过,但这应该是可能的。以下是 QWidget文档说的内容:

I haven't tried on Mac, but this should be possible. Here's what the QWidget docs say:


创建半透明窗口

Creating Translucent Windows

自Qt 4.5起,可以在支持合成的窗口系统上创建具有半透明区域的窗口。

Since Qt 4.5, it has been possible to create windows with translucent regions on window systems that support compositing.

要在顶级窗口小部件中启用此功能,请将 Qt :: WA_TranslucentBackground 属性设置为 setAttribute(),并确保其背景在您想要部分透明的区域中以非透明颜色绘制。

To enable this feature in a top-level widget, set its Qt::WA_TranslucentBackground attribute with setAttribute() and ensure that its background is painted with non-opaque colors in the regions you want to be partially transparent.

平台注释:

X11:此功能依赖于使用支持ARGB视觉效果和合成窗口管理器的X服务器。

X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.

Windows:窗口小部件需要设置 Qt :: FramelessWindowHint 窗口标志以使半透明式工作。

Windows: The widget needs to have the Qt::FramelessWindowHint window flag set for the translucency to work.

我想你的面板是一个顶层的小部件,所以一定要按照上面的指示设置 Qt :: WA_TranslucentBackground

I imagine your panel is a top-level widget, so make sure to set Qt::WA_TranslucentBackground as directed in the above.

这篇关于OS X透明面板在Qt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆