QT帮助文档风格设置
来源:互联网 发布:logo设计软件手机版 编辑:程序博客网 时间:2024/06/05 00:38
http://doc.qt.io/qt-5/qwidget.html#styleSheet-prop
http://doc.qt.io/qt-5/stylesheet.html
http://doc.qt.io/qt-5/stylesheet-syntax.html
http://doc.qt.io/qt-5/stylesheet-designer.html
http://doc.qt.io/qt-5/stylesheet-customizing.html
http://doc.qt.io/qt-5/stylesheet-reference.html
http://doc.qt.io/qt-5/stylesheet-examples.html
Qt Style Sheets
Qt Style Sheets are a powerful mechanism that allows you to customize the appearance of widgets, in addition to what is already possible by subclassing QStyle. The concepts, terminology, and syntax of Qt Style Sheets are heavily inspired by HTML Cascading Style Sheets (CSS) but adapted to the world of widgets.
Topics:
- Overview
- The Style Sheet Syntax
- Qt Designer Integration
- Customizing Qt Widgets Using Style Sheets
- Qt Style Sheets Reference
- Qt Style Sheets Examples
Overview
Styles sheets are textual specifications that can be set on the whole application using QApplication::setStyleSheet() or on a specific widget (and its children) using QWidget::setStyleSheet(). If several style sheets are set at different levels, Qt derives the effective style sheet from all of those that are set. This is called cascading.
For example, the following style sheet specifies that all QLineEdits should use yellow as their background color, and all QCheckBoxes should use red as the text color:
QLineEdit { background: yellow }QCheckBox { color: red }
For this kind of customization, style sheets are much more powerful than QPalette. For example, it might be tempting to set the QPalette::Button role to red for a QPushButton to obtain a red push button. However, this wasn't guaranteed to work for all styles, because style authors are restricted by the different platforms' guidelines and (on Windows XP and macOS) by the native theme engine.
Style sheets let you perform all kinds of customizations that are difficult or impossible to perform using QPalette alone. If you want yellow backgrounds for mandatory fields, red text for potentially destructive push buttons, or fancy check boxes, style sheets are the answer.
Style sheets are applied on top of the current widget style, meaning that your applications will look as native as possible, but any style sheet constraints will be taken into consideration. Unlike palette fiddling, style sheets offer guarantees: If you set the background color of a QPushButton to be red, you can be assured that the button will have a red background in all styles, on all platforms. In addition, Qt Designer provides style sheet integration, making it easy to view the effects of a style sheet in different widget styles.
In addition, style sheets can be used to provide a distinctive look and feel for your application, without having to subclass QStyle. For example, you can specify arbitrary images for radio buttons and check boxes to make them stand out. Using this technique, you can also achieve minor customizations that would normally require subclassing several style classes, such as specifying a style hint. The Style Sheet example depicted below defines two distinctive style sheets that you can try out and modify at will.
When a style sheet is active, the QStyle returned by QWidget::style() is a wrapper "style sheet" style, not the platform-specific style. The wrapper style ensures that any active style sheet is respected and otherwise forwards the drawing operations to the underlying, platform-specific style (e.g., QWindowsXPStyle on Windows XP).
Since Qt 4.5, Qt style sheets fully supports macOS.
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
- QT帮助文档风格设置
- Qt帮助文档设置
- QMimeData 【Qt帮助文档】
- QT帮助文档使用说明
- Qt主题风格设置
- Qt设置风格表单
- 利用qt制作帮助文档
- Qt帮助文档使用教程
- Qt——帮助文档
- Python帮助文档的设置
- Python帮助文档的设置
- Qt Creator 设置黑色风格
- Qt中文帮助文档,非常之方便
- 基于Qt Assistant制作软件帮助文档
- Qt 5 帮助文档的使用
- 学会使用QT的帮助文档
- 基于Qt Assistant制作软件帮助文档
- Qt下创建应用程序的帮助文档
- MySQL官方手册
- 最全Java面试题(一)面试时这些问题你早晚都会遇到
- maven创建web项目详解
- Java中获取日期函数应用
- 一起Talk Android吧(第二十回:Java常用类之Date续)
- QT帮助文档风格设置
- css伪元素属性content用法场景
- C# Cookie帮助类
- Atom使用
- 日志记录方法总结
- java 数字格式转换
- springmvc从入门到精通
- IntelliJ IDEA SVN无法正常使用问题
- 学习资料