Qt-Qss 样式表属性大全

2024-03-03 16:44
文章标签 qt 属性 大全 qss 样式表

本文主要是介绍Qt-Qss 样式表属性大全,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

前言

源码文件信息

QSS属性大全

1.控件常用的属性

2.控件常用属性值 

3.控件常用状态 

4.其他 


前言

相信很大一部分开发者真的被Qt样式表的属性搞挺头痛的!

一方面Qss的示例Demo太过简单,

另一方面,Qss的所有属性在Qt的官方文档Aaasist中也描述的不清晰,

自己不得不从Qt源码里找了下所有的Qss关联属性的最确切的名称,在此记录如下!

源码文件信息

源码文件名:

        qcssparser.cpp

源码路径:

        Src\qtbase\src\gui\text

QSS属性大全

1.控件常用的属性


static const QCssKnownValue properties[NumProperties - 1] = {{ "-qt-background-role", QtBackgroundRole },{ "-qt-block-indent", QtBlockIndent },{ "-qt-fg-texture-cachekey", QtForegroundTextureCacheKey },{ "-qt-line-height-type", QtLineHeightType },{ "-qt-list-indent", QtListIndent },{ "-qt-list-number-prefix", QtListNumberPrefix },{ "-qt-list-number-suffix", QtListNumberSuffix },{ "-qt-paragraph-type", QtParagraphType },{ "-qt-style-features", QtStyleFeatures },{ "-qt-table-type", QtTableType },{ "-qt-user-state", QtUserState },{ "alternate-background-color", QtAlternateBackground },{ "background", Background },{ "background-attachment", BackgroundAttachment },{ "background-clip", BackgroundClip },{ "background-color", BackgroundColor },{ "background-image", BackgroundImage },{ "background-origin", BackgroundOrigin },{ "background-position", BackgroundPosition },{ "background-repeat", BackgroundRepeat },{ "border", Border },{ "border-bottom", BorderBottom },{ "border-bottom-color", BorderBottomColor },{ "border-bottom-left-radius", BorderBottomLeftRadius },{ "border-bottom-right-radius", BorderBottomRightRadius },{ "border-bottom-style", BorderBottomStyle },{ "border-bottom-width", BorderBottomWidth },{ "border-collapse", BorderCollapse },{ "border-color", BorderColor },{ "border-image", BorderImage },{ "border-left", BorderLeft },{ "border-left-color", BorderLeftColor },{ "border-left-style", BorderLeftStyle },{ "border-left-width", BorderLeftWidth },{ "border-radius", BorderRadius },{ "border-right", BorderRight },{ "border-right-color", BorderRightColor },{ "border-right-style", BorderRightStyle },{ "border-right-width", BorderRightWidth },{ "border-style", BorderStyles },{ "border-top", BorderTop },{ "border-top-color", BorderTopColor },{ "border-top-left-radius", BorderTopLeftRadius },{ "border-top-right-radius", BorderTopRightRadius },{ "border-top-style", BorderTopStyle },{ "border-top-width", BorderTopWidth },{ "border-width", BorderWidth },{ "bottom", Bottom },{ "color", Color },{ "float", Float },{ "font", Font },{ "font-family", FontFamily },{ "font-kerning", FontKerning },{ "font-size", FontSize },{ "font-style", FontStyle },{ "font-variant", FontVariant },{ "font-weight", FontWeight },{ "height", Height },{ "icon", QtIcon },{ "image", QtImage },{ "image-position", QtImageAlignment },{ "left", Left },{ "letter-spacing", LetterSpacing },{ "line-height", LineHeight },{ "list-style", ListStyle },{ "list-style-type", ListStyleType },{ "margin" , Margin },{ "margin-bottom", MarginBottom },{ "margin-left", MarginLeft },{ "margin-right", MarginRight },{ "margin-top", MarginTop },{ "max-height", MaximumHeight },{ "max-width", MaximumWidth },{ "min-height", MinimumHeight },{ "min-width", MinimumWidth },{ "outline", Outline },{ "outline-bottom-left-radius", OutlineBottomLeftRadius },{ "outline-bottom-right-radius", OutlineBottomRightRadius },{ "outline-color", OutlineColor },{ "outline-offset", OutlineOffset },{ "outline-radius", OutlineRadius },{ "outline-style", OutlineStyle },{ "outline-top-left-radius", OutlineTopLeftRadius },{ "outline-top-right-radius", OutlineTopRightRadius },{ "outline-width", OutlineWidth },{ "padding", Padding },{ "padding-bottom", PaddingBottom },{ "padding-left", PaddingLeft },{ "padding-right", PaddingRight },{ "padding-top", PaddingTop },{ "page-break-after", PageBreakAfter },{ "page-break-before", PageBreakBefore },{ "position", Position },{ "right", Right },{ "selection-background-color", QtSelectionBackground },{ "selection-color", QtSelectionForeground },{ "spacing", QtSpacing },{ "subcontrol-origin", QtOrigin },{ "subcontrol-position", QtPosition },{ "text-align", TextAlignment },{ "text-decoration", TextDecoration },{ "text-indent", TextIndent },{ "text-transform", TextTransform },{ "text-underline-style", TextUnderlineStyle },{ "top", Top },{ "vertical-align", VerticalAlignment },{ "white-space", Whitespace },{ "width", Width },{ "word-spacing", WordSpacing }
};

2.控件常用属性值 

static const QCssKnownValue values[NumKnownValues - 1] = {{ "active", Value_Active },{ "alternate-base", Value_AlternateBase },{ "always", Value_Always },{ "auto", Value_Auto },{ "base", Value_Base },{ "bold", Value_Bold },{ "bottom", Value_Bottom },{ "bright-text", Value_BrightText },{ "button", Value_Button },{ "button-text", Value_ButtonText },{ "center", Value_Center },{ "circle", Value_Circle },{ "dark", Value_Dark },{ "dashed", Value_Dashed },{ "decimal", Value_Decimal },{ "disabled", Value_Disabled },{ "disc", Value_Disc },{ "dot-dash", Value_DotDash },{ "dot-dot-dash", Value_DotDotDash },{ "dotted", Value_Dotted },{ "double", Value_Double },{ "groove", Value_Groove },{ "highlight", Value_Highlight },{ "highlighted-text", Value_HighlightedText },{ "inset", Value_Inset },{ "italic", Value_Italic },{ "large", Value_Large },{ "left", Value_Left },{ "light", Value_Light },{ "line-through", Value_LineThrough },{ "link", Value_Link },{ "link-visited", Value_LinkVisited },{ "lower-alpha", Value_LowerAlpha },{ "lower-roman", Value_LowerRoman },{ "lowercase", Value_Lowercase },{ "medium", Value_Medium },{ "mid", Value_Mid },{ "middle", Value_Middle },{ "midlight", Value_Midlight },{ "native", Value_Native },{ "none", Value_None },{ "normal", Value_Normal },{ "nowrap", Value_NoWrap },{ "oblique", Value_Oblique },{ "off", Value_Off },{ "on", Value_On },{ "outset", Value_Outset },{ "overline", Value_Overline },{ "pre", Value_Pre },{ "pre-line", Value_PreLine },{ "pre-wrap", Value_PreWrap },{ "ridge", Value_Ridge },{ "right", Value_Right },{ "selected", Value_Selected },{ "shadow", Value_Shadow },{ "small" , Value_Small },{ "small-caps", Value_SmallCaps },{ "solid", Value_Solid },{ "square", Value_Square },{ "sub", Value_Sub },{ "super", Value_Super },{ "text", Value_Text },{ "top", Value_Top },{ "transparent", Value_Transparent },{ "underline", Value_Underline },{ "upper-alpha", Value_UpperAlpha },{ "upper-roman", Value_UpperRoman },{ "uppercase", Value_Uppercase },{ "wave", Value_Wave },{ "window", Value_Window },{ "window-text", Value_WindowText },{ "x-large", Value_XLarge },{ "xx-large", Value_XXLarge }
};

3.控件常用状态 


static const QCssKnownValue pseudos[NumPseudos - 1] = {{ "active", PseudoClass_Active },{ "adjoins-item", PseudoClass_Item },{ "alternate", PseudoClass_Alternate },{ "bottom", PseudoClass_Bottom },{ "checked", PseudoClass_Checked },{ "closable", PseudoClass_Closable },{ "closed", PseudoClass_Closed },{ "default", PseudoClass_Default },{ "disabled", PseudoClass_Disabled },{ "edit-focus", PseudoClass_EditFocus },{ "editable", PseudoClass_Editable },{ "enabled", PseudoClass_Enabled },{ "exclusive", PseudoClass_Exclusive },{ "first", PseudoClass_First },{ "flat", PseudoClass_Flat },{ "floatable", PseudoClass_Floatable },{ "focus", PseudoClass_Focus },{ "has-children", PseudoClass_Children },{ "has-siblings", PseudoClass_Sibling },{ "horizontal", PseudoClass_Horizontal },{ "hover", PseudoClass_Hover },{ "indeterminate" , PseudoClass_Indeterminate },{ "last", PseudoClass_Last },{ "left", PseudoClass_Left },{ "maximized", PseudoClass_Maximized },{ "middle", PseudoClass_Middle },{ "minimized", PseudoClass_Minimized },{ "movable", PseudoClass_Movable },{ "next-selected", PseudoClass_NextSelected },{ "no-frame", PseudoClass_Frameless },{ "non-exclusive", PseudoClass_NonExclusive },{ "off", PseudoClass_Unchecked },{ "on", PseudoClass_Checked },{ "only-one", PseudoClass_OnlyOne },{ "open", PseudoClass_Open },{ "pressed", PseudoClass_Pressed },{ "previous-selected", PseudoClass_PreviousSelected },{ "read-only", PseudoClass_ReadOnly },{ "right", PseudoClass_Right },{ "selected", PseudoClass_Selected },{ "top", PseudoClass_Top },{ "unchecked" , PseudoClass_Unchecked },{ "vertical", PseudoClass_Vertical },{ "window", PseudoClass_Window }
};

4.其他 


static const QCssKnownValue origins[NumKnownOrigins - 1] = {{ "border", Origin_Border },{ "content", Origin_Content },{ "margin", Origin_Margin }, // not in css{ "padding", Origin_Padding }
};static const QCssKnownValue repeats[NumKnownRepeats - 1] = {{ "no-repeat", Repeat_None },{ "repeat-x", Repeat_X },{ "repeat-xy", Repeat_XY },{ "repeat-y", Repeat_Y }
};static const QCssKnownValue tileModes[NumKnownTileModes - 1] = {{ "repeat", TileMode_Repeat },{ "round", TileMode_Round },{ "stretch", TileMode_Stretch },
};static const QCssKnownValue positions[NumKnownPositionModes - 1] = {{ "absolute", PositionMode_Absolute },{ "fixed", PositionMode_Fixed },{ "relative", PositionMode_Relative },{ "static", PositionMode_Static }
};static const QCssKnownValue attachments[NumKnownAttachments - 1] = {{ "fixed", Attachment_Fixed },{ "scroll", Attachment_Scroll }
};static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = {{ "background-color", StyleFeature_BackgroundColor },{ "background-gradient", StyleFeature_BackgroundGradient },{ "none", StyleFeature_None }
};

总结 

        以上为自己跟踪Qt源码的结果,不确定是否还有遗漏,后续有新的发现继续补充!

这篇关于Qt-Qss 样式表属性大全的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/770246

相关文章

在Java中使用ModelMapper简化Shapefile属性转JavaBean实战过程

《在Java中使用ModelMapper简化Shapefile属性转JavaBean实战过程》本文介绍了在Java中使用ModelMapper库简化Shapefile属性转JavaBean的过程,对比... 目录前言一、原始的处理办法1、使用Set方法来转换2、使用构造方法转换二、基于ModelMapper

JavaScript中的isTrusted属性及其应用场景详解

《JavaScript中的isTrusted属性及其应用场景详解》在现代Web开发中,JavaScript是构建交互式应用的核心语言,随着前端技术的不断发展,开发者需要处理越来越多的复杂场景,例如事件... 目录引言一、问题背景二、isTrusted 属性的来源与作用1. isTrusted 的定义2. 为

Kubernetes常用命令大全近期总结

《Kubernetes常用命令大全近期总结》Kubernetes是用于大规模部署和管理这些容器的开源软件-在希腊语中,这个词还有“舵手”或“飞行员”的意思,使用Kubernetes(有时被称为“... 目录前言Kubernetes 的工作原理为什么要使用 Kubernetes?Kubernetes常用命令总

Java如何通过反射机制获取数据类对象的属性及方法

《Java如何通过反射机制获取数据类对象的属性及方法》文章介绍了如何使用Java反射机制获取类对象的所有属性及其对应的get、set方法,以及如何通过反射机制实现类对象的实例化,感兴趣的朋友跟随小编一... 目录一、通过反射机制获取类对象的所有属性以及相应的get、set方法1.遍历类对象的所有属性2.获取

基于Qt Qml实现时间轴组件

《基于QtQml实现时间轴组件》时间轴组件是现代用户界面中常见的元素,用于按时间顺序展示事件,本文主要为大家详细介绍了如何使用Qml实现一个简单的时间轴组件,需要的可以参考下... 目录写在前面效果图组件概述实现细节1. 组件结构2. 属性定义3. 数据模型4. 事件项的添加和排序5. 事件项的渲染如何使用

基于Qt开发一个简单的OFD阅读器

《基于Qt开发一个简单的OFD阅读器》这篇文章主要为大家详细介绍了如何使用Qt框架开发一个功能强大且性能优异的OFD阅读器,文中的示例代码讲解详细,有需要的小伙伴可以参考一下... 目录摘要引言一、OFD文件格式解析二、文档结构解析三、页面渲染四、用户交互五、性能优化六、示例代码七、未来发展方向八、结论摘要

python与QT联合的详细步骤记录

《python与QT联合的详细步骤记录》:本文主要介绍python与QT联合的详细步骤,文章还展示了如何在Python中调用QT的.ui文件来实现GUI界面,并介绍了多窗口的应用,文中通过代码介绍... 目录一、文章简介二、安装pyqt5三、GUI页面设计四、python的使用python文件创建pytho

vue如何监听对象或者数组某个属性的变化详解

《vue如何监听对象或者数组某个属性的变化详解》这篇文章主要给大家介绍了关于vue如何监听对象或者数组某个属性的变化,在Vue.js中可以通过watch监听属性变化并动态修改其他属性的值,watch通... 目录前言用watch监听深度监听使用计算属性watch和计算属性的区别在vue 3中使用watchE

QT实现TCP客户端自动连接

《QT实现TCP客户端自动连接》这篇文章主要为大家详细介绍了QT中一个TCP客户端自动连接的测试模型,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录版本 1:没有取消按钮 测试效果测试代码版本 2:有取消按钮测试效果测试代码版本 1:没有取消按钮 测试效果缺陷:无法手动停

基于Qt实现系统主题感知功能

《基于Qt实现系统主题感知功能》在现代桌面应用程序开发中,系统主题感知是一项重要的功能,它使得应用程序能够根据用户的系统主题设置(如深色模式或浅色模式)自动调整其外观,Qt作为一个跨平台的C++图形用... 目录【正文开始】一、使用效果二、系统主题感知助手类(SystemThemeHelper)三、实现细节