Qt-Qss 樣式表屬性大全

目錄

前言

源碼文件信息

QSS屬性大全

1.控件常用的屬性

2.控件常用屬性值?

3.控件常用狀態?

4.其他?


前言

相信很大一部分開發者真的被Qt樣式表的屬性搞挺頭痛的!

一方面Qss的示例Demo太過簡單,

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

自己不得不從Qt源碼里找了下所有的Qss關聯屬性的最確切的名稱,在此記錄如下!

源碼文件信息

源碼文件名:

  • ????????qcssparser.cpp
  • ????????qstylesheetstyle.cpp

源碼路徑:

  • ????????Src\qtbase\src\gui\text
  • ????????Src\qtbase\src\widgets\styles

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.控件常用狀態(Pseudo-States)?


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.控件子部件(sub-controls)

static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {{ QStyle::SC_None, "" },{ QStyle::SC_None, "down-arrow" },{ QStyle::SC_None, "up-arrow" },{ QStyle::SC_None, "left-arrow" },{ QStyle::SC_None, "right-arrow" },{ QStyle::SC_None, "indicator" },{ QStyle::SC_None, "indicator" },{ QStyle::SC_None, "menu-indicator" },{ QStyle::SC_ComboBoxArrow, "drop-down" },{ QStyle::SC_ComboBoxArrow, "down-arrow" },{ QStyle::SC_None, "item" },{ QStyle::SC_SpinBoxUp, "up-button" },{ QStyle::SC_SpinBoxUp, "up-arrow" },{ QStyle::SC_SpinBoxDown, "down-button" },{ QStyle::SC_SpinBoxDown, "down-arrow" },{ QStyle::SC_GroupBoxLabel, "title" },{ QStyle::SC_GroupBoxCheckBox, "indicator" },{ QStyle::SC_ToolButtonMenu, "menu-button" },{ QStyle::SC_ToolButtonMenu, "menu-arrow" },{ QStyle::SC_None, "menu-indicator" },{ QStyle::SC_None, "tab" },{ QStyle::SC_ScrollBarSlider, "handle" },{ QStyle::SC_ScrollBarAddPage, "add-page" },{ QStyle::SC_ScrollBarSubPage, "sub-page" },{ QStyle::SC_ScrollBarAddLine, "add-line" },{ QStyle::SC_ScrollBarSubLine, "sub-line" },{ QStyle::SC_ScrollBarFirst, "first" },{ QStyle::SC_ScrollBarLast, "last" },{ QStyle::SC_ScrollBarSubLine, "up-arrow" },{ QStyle::SC_ScrollBarAddLine, "down-arrow" },{ QStyle::SC_ScrollBarSubLine, "left-arrow" },{ QStyle::SC_ScrollBarAddLine, "right-arrow" },{ QStyle::SC_None, "handle" },{ QStyle::SC_None, "handle" },{ QStyle::SC_None, "separator" },{ QStyle::SC_None, "scroller" },{ QStyle::SC_None, "tearoff" },{ QStyle::SC_None, "indicator" },{ QStyle::SC_None, "separator" },{ QStyle::SC_None, "icon" },{ QStyle::SC_None, "right-arrow" },{ QStyle::SC_None, "branch" },{ QStyle::SC_None, "section" },{ QStyle::SC_None, "down-arrow" },{ QStyle::SC_None, "up-arrow" },{ QStyle::SC_None, "chunk" },{ QStyle::SC_None, "tab" },{ QStyle::SC_None, "scroller" },{ QStyle::SC_None, "tear" },{ QStyle::SC_SliderGroove, "groove" },{ QStyle::SC_SliderHandle, "handle" },{ QStyle::SC_None, "add-page" },{ QStyle::SC_None, "sub-page"},{ QStyle::SC_SliderTickmarks, "tick-mark" },{ QStyle::SC_None, "pane" },{ QStyle::SC_None, "tab-bar" },{ QStyle::SC_None, "left-corner" },{ QStyle::SC_None, "right-corner" },{ QStyle::SC_None, "title" },{ QStyle::SC_None, "close-button" },{ QStyle::SC_None, "float-button" },{ QStyle::SC_None, "separator" },{ QStyle::SC_MdiCloseButton, "close-button" },{ QStyle::SC_MdiMinButton, "minimize-button" },{ QStyle::SC_MdiNormalButton, "normal-button" },{ QStyle::SC_TitleBarLabel, "title" },{ QStyle::SC_TitleBarCloseButton, "close-button" },{ QStyle::SC_TitleBarMinButton, "minimize-button" },{ QStyle::SC_TitleBarMaxButton, "maximize-button" },{ QStyle::SC_TitleBarShadeButton, "shade-button" },{ QStyle::SC_TitleBarUnshadeButton, "unshade-button" },{ QStyle::SC_TitleBarNormalButton, "normal-button" },{ QStyle::SC_TitleBarContextHelpButton, "contexthelp-button" },{ QStyle::SC_TitleBarSysMenu, "sys-menu" },{ QStyle::SC_None, "item" },{ QStyle::SC_None, "icon" },{ QStyle::SC_None, "text" },{ QStyle::SC_None, "indicator" },{ QStyle::SC_None, "corner" },{ QStyle::SC_None, "close-button" },
};

5.其他


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源碼的結果,不確定是否還有遺漏,后續有新的發現繼續補充!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/718334.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/718334.shtml
英文地址,請注明出處:http://en.pswp.cn/news/718334.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

軟考高級:逆向工程相關概念和例題

作者:明明如月學長, CSDN 博客專家,大廠高級 Java 工程師,《性能優化方法論》作者、《解鎖大廠思維:剖析《阿里巴巴Java開發手冊》》、《再學經典:《Effective Java》獨家解析》專欄作者。 熱門文章推薦&am…

Deeplearning4j【基礎 01】初識Java深度學習框架DL4J

初識Java深度學習框架DL4J 1.起因2.簡介3.組件3.1 Deeplearning4j/ScalNet3.1.1 Deeplearning4jf(Java)3.1.2 ScalNet(Scala) 3.2 ND4J/LibND4J3.3 SameDiff3.4 DataVec3.5 Arbiter3.6 RL4J 4.總結 內容來自網絡,基于官…

Redis--線程模型詳解

Redis線程模型 Redis內部使用的文件事件處理器(基于Reactor模式開發的)file event handler是單線程的,所以Redis線程模型才叫單線程模型,它采用IO多路復用機制同時監聽多個socket,當被監聽的socket準備好執行accep、r…

072:vue+cesium 實現下雪效果

第072個 點擊查看專欄目錄 本示例的目的是介紹如何在vue+cesium中實現下雪效果,這里使用著色器來實現實例特效。 直接復制下面的 vue+cesium源代碼,操作2分鐘即可運行實現效果. 文章目錄 示例效果配置方式示例源代碼(共120行)著色代碼實現心得:專欄目標示例效果

Python世界之附加

一、數據類型轉換 1.隱式類型轉換 在隱式類型轉換中,Python 會自動將一種數據類型轉換為另一種數據類型。 對兩種不同類型的數據進行運算,較低數據類型就會轉換為較高數據類型以避免數據丟失。 2.顯式類型轉換 在顯式類型轉換中,用戶將對…

Linux設置靜態IP地址

在Linux系統中設置靜態IP地址的步驟如下: 1.使用管理員權限登錄系統。 2.編輯網卡配置文件: 網卡配置文件通常位于 /etc/sysconfig/network-scripts/ 目錄下,可以使用命令 cd /etc/sysconfig/network-scripts 切換到該目錄。 …

Wifi技術知識

參考文章 https://www.163.com/dy/article/FDFT60T70550I80C.html https://www.zhihu.com/tardis/bd/art/485711752?source_id1001 wifi代數 以前大家看電腦手機路由器參數,WiFi都是802.11a/b/n/g/ac/ax,這學名讀起來有些麻煩,現在好了&…

第12屆智能計算與無線光通信國際會議(ICWOC 2024)即將召開!

2024年第12屆智能計算與無線光通信國際會議(ICWOC 2024)將于2024年6月21-23日在中國重慶召開。隨著深度學習等人工智能技術的不斷進步,以自動化、自治為特征的智能應用預計將激增。本屆會議主題為“光通信智能鏈接”,旨在為相關技…

ubuntu環境下docker容器詳細安裝使用

文章目錄 一、簡介二、ubuntu安裝docker1.刪除舊版本2.安裝方法一3. 安裝方法二(推薦使用)4.運行Docker容器5. 配置docker加速器 三、Docker鏡像操作1. 拉取鏡像2. 查看本地鏡像3. 刪除鏡像4. 鏡像打標簽5. Dockerfile生成鏡像 四、Docker容器操作1. 獲取…

Qt | TCP服務器端框架搭建

文章目錄 server.hserver.cppmain.cpptcpclientsocket.htcpclientsocket.cpptcpserver.htcpserver.cpp提示運行QTcpServer 是 Qt 框架中的一個類,用于實現 TCP 服務器。它提供了一種方便的方式來創建和管理 TCP 服務器,以便與客戶端進行通信。QTcpServer 類屬于 QtNetwork 模…

Webserver(1): C++實現線程池

在實現線程池之前,首先對線程池中所需要用到的互斥鎖、條件變量和信號量進行了簡單的封裝。 互斥鎖、條件變量和信號量封裝 locker.h頭文件如下(已詳細注釋) /* 這里面對互斥鎖,條件變量和信號量進行了封裝 保證工作隊列的線程…

微服務架構的流行框架之:Dubbo Spring Cloud

Dubbo Dubbo是一個高性能、輕量級的開源Java RPC(Remote Procedure Call,遠程過程調用)框架,由阿里巴巴開發并貢獻給了Apache基金會,成為Apache的頂級項目。Dubbo提供了RPC通信和服務治理的解決方案,使得構…

深入理解C語言中的變量和常量

變量和常量 1. 前言2. 預備知識2.1 printf和%d2.2 \n2.3 scanf2.4 scanf在vs中報錯2.5 extern2.6 數組的初始化 3. 變量和常量的區別4. 變量4.1 定義變量的方法4.2 變量的分類4.2.1 局部優先 4.3 變量的使用4.4 變量的作用域4.4.1 局部變量的作用域4.4.2 全局變量的作用域 4.5 …

機器學習|KNN和Kmeans

KNN和Kmeans KNN KNN-K個最近的鄰居,而K是可人先預設出來的。 所謂近朱者赤,近墨者黑。 可以選取離當前最近的K個樣本來作為輔助判斷,因為本樣本和最近的K個樣本應該是處于一種相似的狀態。 以下是一個蘋果和梨的識別任務。 圖上會出現一個未…

深入Spring Boot核心技術:代碼實戰解析

第一章:揭開Spring Boot自動配置的面紗 自動配置原理 讓我們首先通過一個簡化的Spring Boot應用啟動類來直觀感受自動配置的工作原理: java import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.Sprin…

【軟件設計師】通俗易懂的去了解算法的時間復雜度

🐓 時間復雜度 常用排序的時間復雜度 時間頻度 算法需要花費的時間,和它語句執行的次數是成正比的,所以會把一個算法種語句執行次數稱為語句頻度和時間頻度、記作T(n)。 定義 時間復雜度就是找到一個無限接近時間頻度T(n)同數量級的函數&am…

小腦萎縮患者生活指南:守護你的每一步

親愛的讀者朋友們,今天我們要聊一聊一個特殊但非常重要的群體——小腦萎縮患者。在這個充滿挑戰的旅程中,我們將一起探索如何用愛和智慧為患者打造一個更加安全、舒適的生活環境。 小腦萎縮是指小腦細胞逐漸減少,導致小腦體積縮小的一種病癥…

全量知識系統問題及SmartChat給出的答復 之16 幣圈生態鏈和行為模式

Q.42 幣圈生態鏈和行為模式 我認為,上面和“幣”有關的一系列概念和技術,按設計模式的劃分 ,整體應該都屬于行為模式,而且應該囊括行為模式的所有各個方面。 而行為又可以按照三種不同的導向(以目的或用途為導向、過…

互聯網摸魚日報(2024-03-04)

互聯網摸魚日報(2024-03-04) 36氪新聞 Sora來了,你又焦慮了嗎? 最前線|安踏首家球鞋集合店落地北京三里屯 一位中國遙感科學家,決定“跨界”拯救瀕危動物野駱駝 | 最前線 本周雙碳大事:工信部等七部門發文推動制造…

mirthConnect忽略HTTPS SSL驗證

mirthConnect SSL忽略驗證 1、下載https網站證書 點擊不安全---->證書無效 2、查看mirth 秘鑰庫口令 在mirthConnect 的conf目錄下面keystore.storepass 3、導入證書到本地 在jdk的bin目錄下面執行 keytool -importcert -file "下載的網站證書路徑" -keysto…