如何通过Qt样式表自定义Qt应用程序的标题栏? [英] How to customize the title bar of a Qt app through Qt stylesheet?

查看:1800
本文介绍了如何通过Qt样式表自定义Qt应用程序的标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Qt样式表中自定义Qt应用程序的控件。但是,我找不到自定义标题栏的方法。我发现一些解决方案,但这需要修改应用程序本身的代码。有没有反正你可以自定义它只使用Qt样式表?

I'm able to customize the controls of a Qt app in a Qt stylesheet. However, I couldn't find a way to customize the title bar. I found some solutions but that requires modifying the code of the app itself. Is there anyway you could customize it using just the Qt stylesheet?

推荐答案

标题栏不是您的应用程序或Qt的一部分,它不能配置样式表。标题栏由窗口管理器提供。在某些WM中,根本没有标题栏。大多数WM支持窗口装饰的可定制主题。通常,您可以配置您的WM以显示特定主题的特定窗口。

Title bar isn't a part of your application or Qt and it cannot be configured with stylesheet. Title bar is provided by Window manager. In some WMs there is no title bar at all. Most WMs support customisable themes for window decoration. Usualy you can configure you WM to display specific window with specific theme.

在Qt只有QDockWidget的标题栏可以通过样式表配置。

In Qt only QDockWidget's title bar can be configured by stylesheet.

PS某些应用程序禁用窗口管理器中的装饰,并绘制标题栏本身(示例Chromium)。

这篇关于如何通过Qt样式表自定义Qt应用程序的标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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