在 Qt 的 GUI 中可以选择夜间模式 [英] Have option of Night Mode in GUI in Qt

查看:78
本文介绍了在 Qt 的 GUI 中可以选择夜间模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Qt 的帮助下制作了一个 GUI.现在我想添加一个按钮来启用夜间模式.单击此按钮,我希望屏幕看起来类似于通过夜间护目镜看到的屏幕.我尝试使用 this.setStylesheet("color code here");但问题是我的按钮没有按预期响应它们的样式表,并且中央堆叠的小部件没有显示任何颜色.谁能建议我如何在 Qt 中完成这种颜色变化?

I have made a GUI with the help of Qt. Now I want to add a button which will enable night mode. On this button click I want that the screen will look something similar to that seen through night goggles. I tried using this.setStylesheet("color code here"); but the problem is my buttons dont respond to their stylesheets as expected and the central stacked widget doesn't show any colors. Can anyone suggest me how this color change can be done in Qt?

推荐答案

请看一下 Qt 样式表,因为它描述了 此处.

Please, take a look at Qt Style Sheets as it described here.

这篇关于在 Qt 的 GUI 中可以选择夜间模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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