Qt : Style Sheet

news2024/9/25 3:21:42

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.coloradmin.cn/o/1415170.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Centos9使用chrony服务同步时间

安装chrony命令 Centos9里是预安装的,没有安装的话执行以下命令: yum install -y chronyCentos9 时间同步要使用chrony命令,ntp命令没有了 查看状态 #启用chronyd服务 systemctl enable chronyd#重启chronyd服务 systemctl restart chron…

【Docker】nacos集群搭建Nginx负载均衡

目录 一、mysql安装与基操 1.1 数据准备 1.2 创建mysql与数据表 二、Nacos集群部署 2.1 创建nacos及配置 2.2 创建Nginx容器 一、mysql安装与基操 1.1 数据准备 拉取mysql docker pull mysql:5.7(版本) 定义挂载目录 mkdir -p /mysql/{conf,data,script} 配置my.c…

金盘移动图书管理系统doUpload.jsp接口存在文件上传漏洞

指纹特征 app"金盘软件-金盘移动图书馆系统"漏洞复现 POST /pages/admin/tools/uploadFile/doUpload.jsp HTTP/1.1 Host: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0 Accept: text/html,application/xhtmlxm…

LLM - Transformer 的 Q/K/V 详解

目录 一.引言 二.传统 Q/K/V 三.Transformer Q/K/V - Input Query - Q/K/V 获取 - Q/K 相似度计算 - 注意力向量 - Multi Head 四.代码测试 - 初始化 - Attention - Main 五.总结 一.引言 Transformer 的输入是我们的一个 query 句子,例如 "我爱…

二叉搜索树,穷举(全排列)

力扣230.二叉搜索树中第K小的元素 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeN…

Doris安装部署文档

简介 网址:Apache Doris: Open-Source Real-Time Data Warehouse - Apache Doris Apache Doris 是一个基于 MPP 架构的高性能、实时的分析型数据库,以极速易用的特点被人们所熟知,仅需亚秒级响应时间即可返回海量数据下的查询结果&#xff…

mac配置L2TP连接公司内网

1. 打开系统设置 2. 打开网络 3. 点击网络页面其他服务右下角三个点,添加VPN配置中的L2TP 4. 配置VPN,服务器填写公司的服务器ip,共享密钥没有可以随便填写 5. 打开终端编辑文件 sudo vim /etc/ppp/opt…

Java笔记 --- 三、方法引用

三、方法引用 概述 分类 引用静态方法 引用成员方法 本类中注意,静态方法中没有this,需要创建本类的对象 引用构造方法 其他的调用方式 使用类名引用成员方法 引用数组的构造方法

spring整合mybatis的底层原理

spring整合mybatis的底层原理 原理: FactoryBean的自定义对象jdk动态代理Mapper接口对象 一、手写一个spring集成mybatis 目录结构: 1.1 入口类 public class Test {public static void main(String[] args) {AnnotationConfigApplicationContext co…

Java基于 SpringBoot+Vue 的高校心理教育辅导系统的研究与实现

博主介绍:✌程序员徐师兄、7年大厂程序员经历。全网粉丝30W、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 🍅文末获取源码联系🍅 👇🏻 精彩专栏推荐订阅👇…

智能工厂4G无线设备预测维护云端联动的DI、AI、DO混合信号处理单元

在现代工业智能化进程中,一款集成了丰富I/O接口并能与各大云平台无缝对接的智能设备显得尤为重要。比如最近推出的这款创新产品,它集合了8路数字输入通道,涵盖了干湿节点的识别功能,适用于多种开关量信号的读取;同时&a…

B端系统优化:用好卡片式设计,效果立竿见影翻倍。

B端系统中,卡片式设计是一种常见的界面设计风格,它将信息和功能组织成一系列独立的卡片,每个卡片通常包含一个特定的信息块或功能模块。 一、卡片式设计的特点包括: 模块化和可重用性:卡片可以被独立设计和开发&#…

svg 属性详解:填充与边框

svg 属性详解:填充与边框 1 颜色和透明度2 填充规则 fill-rule3 边框样式3.1 stroke-width3.2 stroke-linecap3.3 stroke-linejoin3.4 stroke-dasharray 1 颜色和透明度 图像都有颜色,svg 中可以使用属性 fill 和 stroke 来修改图形的颜色。fill 属性设置…

第十六讲_HarmonyOS应用程序包介绍

HarmonyOS应用程序包介绍 1. 应用程序包概述1.1 多 Module 设计的好处1.2 Module 的类型 2. 应用程序包结构2.1 应用的配置文件2.2 资源目录 3. 应用程序编译后包结构 1. 应用程序包概述 官方推荐基于Stage模型开发HarmonyOS应用程序,一个应用可以包含一个或多个Mo…

计算机基础之微处理器简介

微处理器 微处理器定义 微型计算机的CPU也被称为微处理器,是将运算器、控制器和高速缓存集成在一起的超大规模集成电路芯片,是计算机的核心部件。能完成取指令、执行指令,以及与外界存储器和逻辑部件交换信息等操作。 微处理器发展 CPU从…

研发日记,Matlab/Simulink避坑指南(七)——数据溢出钳位Bug

文章目录 前言 背景介绍 问题描述 分析排查 解决方案 总结归纳 前言 见《研发日记,Matlab/Simulink避坑指南(二)——非对称数据溢出Bug》 见《研发日记,Matlab/Simulink避坑指南(三)——向上取整Bug》 见《研发日记,Matlab/Simulink避坑…

【CSS】实现鼠标悬停图片放大的几种方法

1.背景图片放大 使用css设置背景图片大小100%&#xff0c;同时设置位置和过渡效果&#xff0c;然后使用&#xff1a;hover设置当鼠标悬停时修改图片大小&#xff0c;实现悬停放大效果。 <!DOCTYPE html> <html lang"en"> <head><meta charset…

C++大学教程(第九版)7.19 将7.10节vector对象的例子转换成array对象

文章目录 题目代码运行截图 题目 (将7.10节vector 对象的例子转换成array 对象)将图7.26中 vector 对象的例子转换成使用array 对象。请消除任何 vector 对象仅有的特性。 分析&#xff1a; vector对象独有的特性&#xff1a; 1.vector对象长度可变 2.长度不同的vector对象可…

基于springboot校友社交系统源码和论文

校友社交系统提供给用户一个校友社交信息管理的网站&#xff0c;最新的校友社交信息让用户及时了解校友社交动向,完成校友社交的同时,还能通过论坛中心进行互动更方便。本系统采用了B/S体系的结构&#xff0c;使用了java技术以及MYSQL作为后台数据库进行开发。系统主要分为系统…

为什么选择快速应用开发:提高业务响应速度与竞争力的关键

如今&#xff0c;企业想要持续蓬勃发展&#xff0c;就需要具备快速满足客户期望的能力。无论是十几年历史的重要市场占有者推出新的APP&#xff0c;还是在疫情期间从线下转向线上电商营销&#xff0c;企业都需要主动适应市场。随着为客户提供新的服务方式&#xff0c;员工也需要…