QT5 + X11实现半透明弹窗

xx说就叫这个名字 2017-10-10 08:24:58
如题,想在X11上面实现半透明效果,但是设置透明度都不行,背景变成黑色。
网上搜索发现也有人类似情况,但是无人回复,那位大神请指点下,谢谢。
...全文
2228 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
张小飞Official 2017-10-13
  • 打赏
  • 举报
回复
参考http://blog.csdn.net/tian_110/article/details/42402021
张小飞Official 2017-10-13
  • 打赏
  • 举报
回复
X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager. X11(linux):此特性依赖于能提供支持ARGB视觉效果和复合式视窗管理的X服务的功能开启。
  • 打赏
  • 举报
回复
windowOpacity : double This property holds the level of opacity for the window. The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent). By default the value of this property is 1.0. This feature is available on Embedded Linux, Mac OS X, Windows, and X11 platforms that support the Composite extension. This feature is not available on Windows CE. Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using. Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows. x11的区别在这里: Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
  • 打赏
  • 举报
回复
引用 1 楼 qqwangfan 的回复:
说一下你设置不行的方法,看看是不是哪里有问题。
ui->setupUi(this); setAutoFillBackground(false); setAttribute(Qt::WA_TranslucentBackground, true); setWindowOpacity(0.5); 就这样,在Ubuntu上面跑可以半透明,但是放在x11+qt5的arm板子上面就不行,背景黑的。
  • 打赏
  • 举报
回复
说一下你设置不行的方法,看看是不是哪里有问题。
  • 打赏
  • 举报
回复
引用 5 楼 year2002 的回复:
你可以参考一下“CentOS下Qt窗口透明效果失效,成黑色背景的问题” http://http://blog.csdn.net/taiyang1987912/article/details/37037657 应该是需要X服务的支持才行
感谢。 具体是什么服务呢,怎么启动?
  • 打赏
  • 举报
回复
你可以参考一下“CentOS下Qt窗口透明效果失效,成黑色背景的问题” http://http://blog.csdn.net/taiyang1987912/article/details/37037657 应该是需要X服务的支持才行
  • 打赏
  • 举报
回复
引用 3 楼 qqwangfan 的回复:
windowOpacity : double This property holds the level of opacity for the window. The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent). By default the value of this property is 1.0. This feature is available on Embedded Linux, Mac OS X, Windows, and X11 platforms that support the Composite extension. This feature is not available on Windows CE. Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using. Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows. x11的区别在这里: Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
非常感谢您的回复。 那我现在怎么确认x11的两个问题呢? 1、怎么让composite manager 跑起来以及怎么确认已经跑起来呢? 2、怎么确认_NET_WM_WINDOW_OPACITY atom我是不是支持呢? 多谢。
内容概要:本文围绕“光伏-储能-数据中心”系统的容量优化配置展开研究,旨在通过构建数学模型并结合Matlab编程实现,对园区内光伏发电、储能设备与数据中心算力负荷之间的多能互补关系进行协同优化。研究综合考虑可再生能源出力的波动性、储能系统的充放电特性以及数据中心的动态用电需求与算力调度特性,建立以最小化综合成本、降低碳排放强度、提升能源自给率等为目标的多目标优化模型,并采用先进的智能优化算法(如粒子群、灰狼、鲸鱼等)进行求解,从而确定光伏装机容量与储能系统配置的最优方案。文中提供了完整的Matlab代码实现流程,涵盖数据预处理、模型构建、算法求解与结果可视化全过程,属于综合能源系统与信息基础设施深度融合的前沿交叉课题。; 适合人群:具备电力系统、能源工程、自动化或计算机等相关专业背景,熟悉Matlab编程与基本优化算法原理,从事新能源利用、绿色数据中心、综合能源系统规划与低碳调度等方向的研究生、科研人员及工程技术人员。; 使用场景及目标:① 掌握光伏-储能-数据中心耦合系统的建模思路与多能流协同机制;② 学习基于Matlab的多目标容量优化配置方法与智能算法应用技巧;③ 为工业园区、数字经济园区及绿色数据中心的能源系统规划、节能减排与可持续运行提供科学决策依据和技术解决方案。; 阅读建议:建议结合所提供的Matlab代码,深入理解目标函数设计、约束条件设定及算法实现细节,可通过调整负荷参数、改变气候数据、引入新的优化目标或约束条件等方式进行拓展性实验,以深化对系统特性的认知并提升实际科研与工程应用能力。

21,498

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧