Qt : Style Sheet

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., QWindowsVistaStyle on Windows).

A style rule is made up of a selector and a declaration.

Qt Style Sheet is generally case insensitive (i.e., color, Color, COLOR, and cOloR refer to the same property). The only exceptions are class names, object names, and Qt property names, which are case sensitive.
Several selectors can be specified for the same declaration, using commas (,) to separate the selectors. For example, the rule
QPushButton, QLineEdit, QComboBox { color: red }
is equivalent to this sequence of three rules:
QPushButton { color: red }
QLineEdit { color: red }
QComboBox { color: red }

The declaration part of a style rule is a list of property: value pairs, enclosed in braces ({}) and separated with semicolons. For example:
QPushButton { color: red; background-color: white }

The background of any QAbstractScrollArea (Item views, QTextEdit and QTextBrowser) can be set using the background properties. For example, to set a background-image that scrolls with the scroll bar:
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: scroll;
}
在这里插入图片描述

If the background-image is to be fixed with the viewport:
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: fixed;
}
在这里插入图片描述

SelectorExampleExplanation
Universal Selector*Matches all widgets.
Type SelectorQPushButtonMatches instances of QPushButton and of its subclasses.
Property SelectorQPushButton[flat=“false”]Matches instances of QPushButton that are not flat. You may use this selector to test for any Qt property that supports QVariant::toString() (see the toString() function documentation for details). In addition, the special class property is supported, for the name of the class.This selector may also be used to test dynamic properties. For more information on customization using dynamic properties, refer to Customizing Using Dynamic Properties.
Class Selector.QPushButtonMatches instances of QPushButton, but not of its subclasses.
This is equivalent to *[class~=“QPushButton”].
ID SelectorQPushButton#okButtonMatches all QPushButton instances whose object name is okButton.
Descendant SelectorQDialog QPushButtonMatches all instances of QPushButton that are descendants (children, grandchildren, etc.) of a QDialog.
Child SelectorQDialog > QPushButtonMatches all instances of QPushButton that are direct children of a QDialog.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/353538.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Linux 系统相关的命令

目录 一. 系统用户相关1.1 查看当前访问的主机和用户1.2 切换用户1.2.1 设置root用户密码1.2.2 普通用户和root用户切换 1.4 系统状态1.4.1 vmstat 查看当前系统的状态1.4.2 history 查看系统中输入过的命令 二. 系统文件相关2.1 权限修改2.2 磁盘占用2.2.1 每秒钟监视当前磁盘…

在 VUE 项目中,使用 Axios 请求数据时,提示跨域,该怎么解决?

在 VUE 项目开发时,遇到个问题,正常设置使用 Axios 库请求数据时,报错提示跨域问题。 那在生产坏境下,该去怎么解决呢? 其可以通过以下几种方式去尝试解决: 1、设置允许跨域请求的响应头 1.1 在响应头中…

LINUX基础培训十九之常见服务nfs介绍

前言、本章学习目标 了解nfs服务用途掌握nfs服务器的配置掌握nfs客户端的配置使用 一、NFS简介 NFS(Network File System)即网络文件系统,它允许网络中的计算机之间通过TCP/IP网络共享资源。在NFS的应用中,本地NFS的客户端应用…

机器学习第一个项目-----鸢尾花数据集加载及报错解决

项目步骤 如刚开始做,从 “项目开始” 看; 如遇到问题从 “问题” 开始看; 问题 报错如下 ModuleNotFoundError: No module named sklearn解决过程 查看官网,感觉可能是python版本和skilearn版本不匹配,更新一下p…

使用vue_cli脚手架创建Vue项目(cmd和图形化方式)

使用vue_cli脚手架创建Vue项目(cmd和图形化方式) 创建项目(cmd方式) vue create vue_cli1.方向键选择manually select feature(手动选择方式创建),回车 2.按空格键选择需要的组件:Babel、PWA、Router、Vuex、CSS,回…

【GitHub项目推荐--游戏模拟器(switch)】【转载】

01 任天堂模拟器 yuzu 是 GitHub 上斩获 Star 最多的开源 Nintendo Switch 模拟器 ,使用 C 编写,考虑到了可移植性,该模拟器包括 Windows 和 Linux 端。 如果你的 PC 满足必要的硬件要求,该模拟器就能够运行大多数商业游戏&…

Django实战

一、开发登录表单 def login_form(request):html <html><body><form method"post">用户名:<input name "username" type"text"></input></br>密码&#xff1a;<input name "password" type…

破解Windows系统密码(保姆级教学)

前言: 本篇博客只是技术分享并非非法传播知识,实验内容均是在虚拟机中进行,并非真实环境 正文: 看到题目大家都已经晓得这篇博客是干嘛了,我也不废话了,直接上win7素材 需要windows10破解过程的关注后在下面评论"已关注,请私聊"我会私发给你 一.windows7电脑密码破解…

C++17中lambda表达式新增加支持的features

C17中对lambda表达式新增加了2种features&#xff1a;lambda capture of *this和constexpr lambda 1.lambda capture of *this: *this:拷贝当前对象,创建副本&#xff1a;捕获*this意味着该lambda生成的闭包将存储当前对象的一份拷贝 。 this:通过引用捕获。 当你需…

C语言-指针的基本知识(下)

四、指针的分类 按指针指向的数据的类型来分 1:字符指针 字符型数据的地址 char *p;//定义了一个字符指针变量&#xff0c;只能存放字符型数据的地址编号 char ch; p &ch; 2&#xff1a;短整型指针 short int *p;//定义了一个短整型的指针变量p&#xff0c…

[Raspberry Pi]如何利用ssh將樹莓派切換連接至陌生的wifi基地台?

當已習慣使用VNC遠端控制樹莓派後&#xff0c;原用來設定樹莓派的電腦螢幕和鍵盤也逐漸挪為它用。此次攜帶樹莓派外出&#xff0c;同時又希望使樹莓派連接當地的wifi AP&#xff0c;利用VNC遠端桌面切換新的wifi AP需要重新設定wifi密碼&#xff0c;但卻無法在VNC遠端桌面看到密…

响应式Web开发项目教程(HTML5+CSS3+Bootstrap)第2版 例5-2 JavaScript 获取HTML元素对象

代码 <!doctype html> <html> <head> <meta charset"utf-8"> <title>JavaScript 获取 HTML 元素对象</title> </head><body> <input type"text" value"admin" /> <br> <input …

代码随想录算法训练DAY29|回溯5

算法训练DAY29|回溯5 491.递增子序列 力扣题目链接 给定一个整型数组, 你的任务是找到所有该数组的递增子序列&#xff0c;递增子序列的长度至少是2。 示例: 输入: [4, 6, 7, 7] 输出: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7, 7], [7,7], [4,7,7]] 说…

canvas绘制旋转的大风车

查看专栏目录 canvas实例应用100专栏&#xff0c;提供canvas的基础知识&#xff0c;高级动画&#xff0c;相关应用扩展等信息。canvas作为html的一部分&#xff0c;是图像图标地图可视化的一个重要的基础&#xff0c;学好了canvas&#xff0c;在其他的一些应用上将会起到非常重…

Android Handler完全解读

一&#xff0c;概述 Handler在Android中比较基础&#xff0c;本文笔者将对此机制做一个完全解读。读者可简单参考上述类图与时序图&#xff0c;便于后续理解。 二&#xff0c;源码解读 1&#xff0c;主线程伊始 众所周知&#xff0c;通过Zygote的fork方式&#xff0c;新创建…

Unity应用在车机上启动有概率黑屏的解决方案

问题描述 最近将游戏适配到车机上&#xff08;Android系统&#xff09;&#xff0c;碰到了一个严重bug&#xff0c;启动的时候有概率会遇到黑屏&#xff0c;表现就是全黑&#xff0c;无法进入Unity的场景。 经过查看LogCat日志&#xff0c;也没有任何报错&#xff0c;也没有任…

DLL劫持之IAT类型(Loadlibrary)

Loadlibrary Loadlibrary的底层是LoadLibraryEx 第三个参数&#xff1a; DONT_RESOLVE_DLL_REFERENCES : 这个标志用于告诉系统将DLL映射到调用进程的地址空间中&#xff0c;但是不调用DllMain并且不加载依赖Dll&#xff08;只映射自己本身&#xff09;。 LOAD_LIBRARY_AS_DA…

LVGL v9学习笔记 | 12 - 弧形控件的使用方法(arc)

一、arc控件 arc控件的API在lvgl/src/widgets/arc/lv_arc.h 中声明,以lv_arc_xxx命名。 arc控件由背景圆弧和前景圆弧组成,前景圆弧的末端有一个旋钮,前景圆弧可以被触摸调节。 1. 创建arc对象 /*** Create an arc object* @param parent pointer to an object, it w…

(N-141)基于springboot,vue网上拍卖平台

开发工具&#xff1a;IDEA 服务器&#xff1a;Tomcat9.0&#xff0c; jdk1.8 项目构建&#xff1a;maven 数据库&#xff1a;mysql5.7 系统分前后台&#xff0c;项目采用前后端分离 前端技术&#xff1a;vueelementUI 服务端技术&#xff1a;springbootmybatis-plusredi…

利用STM32CubeMX和Keil模拟器,3天入门FreeRTOS(5.2) —— 互斥量

前言 &#xff08;1&#xff09;FreeRTOS是我一天过完的&#xff0c;由此回忆并且记录一下。个人认为&#xff0c;如果只是入门&#xff0c;利用STM32CubeMX是一个非常好的选择。学习完本系列课程之后&#xff0c;再去学习网上的一些其他课程也许会简单很多。 &#xff08;2&am…