python - PyQt4 Widgets 的样式表组件名称

标签 python qt pyqt pyqt4 stylesheet

我正在尝试学习为我的 python 程序创建外部 qss 文件(样式表),该程序是用 PyQt 编写的,外观更漂亮。

enter image description here

在Qt样式表的例子中,它使用了这个

 QTableView QTableCornerButton::section {
 background: red;
 border: 2px outset red;

}

指定QTableWidget connerbutton(红色矩形)的样式属性。 但是,它没有说明应该如何处理其他组件名称。例如,我不知道如何更改 horizo​​ntalheaderlabelverticalheader 样式。

当我使用样式表而不使用像这样的任何组件名称(如 QTableCornerButton)时

    QTableWidget {
     selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
                                 stop: 0 #579599, stop: 1 #39B4BD);
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #D1DBEB, stop: 0.4 #C0D1EB,stop: 0.5 #ABBEDB, stop: 1.0 #95ABCC);
border:1px solid #7286A3;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
border-bottom-left-radius: 9px;
border-bottom-right-radius: 9px;
padding:0px;

 }

它将样式应用于整个小部件而不是特定区域。

我在哪里可以在线找到样式表支持的小部件组件的名称(例如,QTableCornerButton)?

Qt Stylesheet example很好,但它没有提供我可以使用的所有名称和属性。

最佳答案

你看过文档了吗here

关于python - PyQt4 Widgets 的样式表组件名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19265669/

相关文章:

qt - 获取 QTextDocument 的确切高度(以像素为单位)

python - PySide6 中 QTimer() 函数的问题该函数不循环

qt - QPushbutton 如何删除 setDefault(True) 创建的颜色

python - 尝试初始化环境时出错(Pipenv))

c++ - Qt 应用程序无法加载自定义插件调试库

c++ - 小部件未正确显示

Qt 简单的发布请求

python - 将参数作为 HTML 属性传递

python - 将与打印命令相同的内容保存到 .csv 文件

python - 检查 pandas 数据框日期列的日期格式是否正确?