属性 | 类型 | 描述 |
alternate-background-color | Brush | QAbstractItemView子类中使用的备用背景颜色。 如果未设置此属性,则默认值为为调色板的AlternateBase角色设置的值。 例: QTreeView { alternate-background-color: blue; background: yellow; } 另请参见background和selection-background-color。 |
background | Background | 用于设置背景的简写表示法。相当于指定background-color,background-image,background-repeat,和/或background-position。 QAbstractItemView子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip和普通QWidget支持此属性。 例: QTextEdit {background:yellow} 通常,需要设置类似于Qt :: BrushStyle中的样式的填充模式。您可以使用Qt :: SolidPattern,Qt :: RadialGradientPattern,Qt :: LinearGradientPattern和Qt :: ConicalGradientPattern的background-color属性。通过创建包含图案的背景图像,可以轻松实现其他图案。 例: QLabel { background-image: url(dense6pattern.png); background-repeat: repeat-xy; } 另请参见background-origin,selection-background-color,background-clip,background-attachment和alternate-background-color。 |
background-color | Brush | 用于窗口小部件的背景颜色。 例子: QLabel { background-color: yellow } QLineEdit { background-color: rgb(255, 0, 0) } |
background-image | Url | 用于窗口小部件的背景图像。图像的半透明部分让background-color光泽透过。 例: QFrame { background-image: url(:/images/hydro.png) } |
background-repeat | Repeat | 是否以及如何重复背景图像以填充background-origin矩形。 如果未指定此属性,则会在两个方向(repeat)重复背景图像。 例: QFrame { background: white url(:/images/ring.png); background-repeat: repeat-y; background-position: left; } |
background-position | Alignment | background-origin矩形内背景图像的对齐方式。 如果未指定此属性,则对齐为top left。 例: QFrame { background: url(:/images/footer.png); background-position: bottom left; } |
background-attachment | Attachment 附件 | 确定QAbstractScrollArea中的背景图像是相对于视口滚动还是固定的。默认情况下,background-image使用视口滚动。 例: QTextEdit { background-image: url("leaves.png"); background-attachment: fixed; } 另见背景 |
background-clip | Origin起源 | 小部件的矩形,在其中background绘制。 此属性指定剪切background-color和background-image剪切的矩形。 QAbstractItemView子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip和普通QWidget支持此属性。 如果未指定此属性,则默认为border。 例: QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; background-clip: padding; } 另请参见background,background-origin和Box Model。 |
background-origin | Origin起源 | 小部件的背景矩形,与background-position和一起使用background-image。 QAbstractItemView子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip和普通QWidget支持此属性。 如果未指定此属性,则默认为padding。 例: QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; } 另见背景和盒子模型。 |
border | Border边界 | 用于设置小部件边框的简写表示法。相当于指定border-color,, border-style和/或border-width。 QAbstractItemView子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip和普通QWidget支持此属性。 例: QLineEdit { border: 1px solid white } |
border-top | Border边界 | 用于设置小部件顶部边框的简写表示法。相当于指定border-top-color,, border-top-style和/或border-top-width。 |
border-right | Border边界 | 用于设置窗口小部件右边框的简写表示法。相当于指定border-right-color,, border-right-style和/或border-right-width。 |
border-bottom | Border边界 | 用于设置小部件底部边框的简写表示法。相当于指定border-bottom-color,, border-bottom-style和/或border-bottom-width。 |
border-left | Border边界 | 用于设置小部件左边框的简写表示法。相当于指定border-left-color,, border-left-style和/或border-left-width。 |
border-color | Box Colors盒子颜色 | 所有边框边缘的颜色。等效于声明border-top-color,border-right-color,border-bottom-color,和border-left-color。 QAbstractItemView子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip和普通QWidget支持此属性。 如果未指定此属性,则默认为颜色(即窗口小部件的前景色)。 例: QLineEdit { border-width: 1px; border-style: solid; border-color: white; } 另请参见border-style,border-width,border-image和Box Model。 |
border-top-color | Brush | 边框顶部边缘的颜色。 |
border-right-color | Brush | 边框右边缘的颜色。 |
border-bottom-color | Brush | 边框底边的颜色。 |
border-left-color | Brush | 边框左边缘的颜色。 |
border-image | Border Image | 用于填充边框的图像。将图像切割成九个部分并在必要时适当拉伸。有关详情,请参见边框图 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 另请参阅border-color,border-style,border-width和Box Model。 |
border-radius | Radius | 边界角的半径。等效于声明border-top-left-radius,border-top-right-radius,border-bottom-right-radius,和border-bottom-left-radius。 border-radius剪切元素的背景。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 如果未指定此属性,则默认为0。 例: QLineEdit { border-width: 1px; border-style: solid; border-radius: 4px; } 另请参见border-width和Box Model。 |
border-top-left-radius | Radius | 边框左上角的半径。 |
border-top-right-radius | Radius | 边框右上角的半径。 |
border-bottom-right-radius | Radius | 边框右下角的半径。将此属性设置为正值会产生圆角。 |
border-bottom-left-radius | Radius | 边框左下角的半径。将此属性设置为正值会产生圆角。 |
border-style | Border Style边框风格 | 所有边框边缘的样式。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 如果未指定此属性,则默认为none。 例: QLineEdit { 边框-宽度:1px ; 边框-风格:固体; 边框-颜色:蓝色; } 另请参阅border-color,border-style,border-image和Box Model。 |
border-top-style | Border Style边框风格 | 边框的顶部边缘的风格。 |
border-right-style | Border Style边框风格 | 边框右边的风格/ |
border-bottom-style | Border Style边框风格 | 边框底边的样式。 |
border-left-style | Border Style边框风格 | 边框左边的样式。 |
border-width | Box Lengths盒子长度 | 边框的宽度。相当于设置border-top-width,border-right-width,border-bottom-width,和border-left-width。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 例: QLineEdit { border-width: 2px; border-style: solid; border-color: darkblue; } 另请参阅border-color,border-radius,border-style,border-image和Box Model。 |
border-top-width | Length | 边框顶边的宽度。 |
border-right-width | Length | 边框右边缘的宽度。 |
border-bottom-width | Length | 边框底边的宽度。 |
border-left-width | Length | 边框左边缘的宽度。 |
bottom | Length | 如果position是relative(默认值),则将子控件移动一定的偏移量; 指定然后相当于指定。bottom: ytop: -y 如果position是absolute,则该bottom属性指定子控件相对于父级底边的底边(另请参阅subcontrol-origin)。 例: QSpinBox::down-button { bottom: 2px } 另见左,右和上。 |
button-layout | Number | QDialogButtonBox或QMessageBox中按钮的布局。可能的值为0(WinLayout),1(MacLayout),2(KdeLayout),3(GnomeLayout)和5(AndroidLayout)。 如果未指定此属性,则默认为SH_DialogButtonLayout样式提示的当前样式指定的值。 例: * { button-layout: 2 } |
color | Brush | 用于渲染文本的颜色。 尊重QWidget :: palette的所有小部件都支持此属性。 如果未设置此属性,则默认值为QWidget :: foregroundRole(通常为黑色)的窗口小部件调色板中设置的内容。 例: QPushButton {color:red} 另请参见background和selection-color。 |
dialogbuttonbox-buttons-have-icons | Boolean | QDialogButtonBox中的按钮是否显示图标 如果此属性设置为1,则QDialogButtonBox的按钮会显示图标; 如果设置为0,则不显示图标。 有关如何设置图标的信息,请参阅“ 图标列表”部分。 QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; } 注意:必须在创建QDialogButtonBox之前应用定义此属性的样式; 这意味着您必须将样式应用于父窗口小部件或应用程序本身。 |
font | Font | 用于设置文本字体的简写表示法。相当于指定font-family,font-size,font-style,和/或font-weight。 尊重QWidget :: font的所有小部件都支持此属性。 如果未设置此属性,则默认为QWidget :: font。 例: QCheckBox { font: bold italic large "Times New Roman" } |
font-family | String | 字体系列。 例: QCheckBox { font-family: "New Century Schoolbook" } |
font-size | Font Size | 字体大小。在此版本的Qt中,仅支持pt和px指标。 例: QTextEdit { font-size: 12px } |
font-style | Font Style字体样式 | 字体样式。 例: QTextEdit { font-style: italic } |
font-weight | Font Weight字体重量 | 字体的重量。 |
gridline-color* | Color | QTableView中网格线的颜色。 如果未指定此属性,则默认为SH_Table_GridLineColor样式提示的当前样式指定的值。 例: * { gridline-color: gray } |
height | Length | 子控件的高度(或在某些情况下,小部件)。 如果未指定此属性,则默认值取决于子控件/窗口小部件和当前样式。 警告:除非另行指定,否则在小组件上设置此属性时无效。如果您想要一个具有固定高度的小部件,请将min-height和max-height设置为相同的值。 例: QSpinBox::down-button { height: 10px } 另见宽度。 |
icon-size | Length | 窗口小部件中图标的宽度和高度。 可以使用此属性设置以下小部件的图标大小。 QCheckBox 而QListView QPushButton QRadioButton QTabBar 在QToolBar QToolBox QTreeView则 |
image* | Url+ | 在子控件的内容矩形中绘制的图像。 image属性接受Url或an 的列表svg。使用与QIcon相同的算法确定绘制的实际图像(即)图像从不按比例放大,但如果需要则始终按比例缩小。如果svg指定了a ,则图像将缩放为内容矩形的大小。 在子控件上设置图像属性会隐式设置子控件的宽度和高度(除非SVG中的图像)。 在Qt 4.3及更高版本中,可以使用图像位置指定矩形内图像的对齐。 此属性仅用于子控件 - 我们不支持其他元素。 警告:本QIcon需要SVG插件来渲染SVG图像。 例: //隐式地设置下行按钮的尺寸与 spindown.png的//大小 QSpinBox::down-button { image: url(:/images/spindown.png) } |
image-position | alignment对准 | 在Qt 4.3及更高版本中,可以使用相对或绝对位置指定图像图像位置的对齐。 |
left | Length | 如果position是relative(默认值),则将子控件向右移动一定的偏移量。 如果position是absolute,则left属性指定子控件的左边缘相对于父边缘的边缘(另请参阅subcontrol-origin)。 如果未指定此属性,则默认为0。 例: QSpinBox::down-button { left: 2px } 另见右,上,下。 |
lineedit-password-character* | Number | 该QLineEdit的密码字符作为Unicode数字。 如果未指定此属性,则默认为SH_LineEdit_PasswordCharacter样式提示的当前样式指定的值。 例: * { lineedit-password-character: 9679 } |
lineedit-password-mask-delay* | Number | 在将lineedit-password-character应用于可见字符之前,QLineEdit密码掩码延迟(以毫秒为单位)。 如果未指定此属性,则默认为SH_LineEdit_PasswordMaskDelay样式提示的当前样式指定的值。 此属性已添加到Qt 5.4中。 例: * { lineedit-password-mask-delay: 1000 } |
margin | Box Lengths | 小部件的边距。等效于声明margin-top,margin-right,margin-bottom,和margin-left。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 如果未指定此属性,则默认为0。 例: QLineEdit { margin: 2px } 另请参见填充,间距和框模型。 |
margin-top | Length | 小部件的上边距。 |
margin-right | Length | 小部件的右边距。 |
margin-bottom | Length | 小部件的底部边距。 |
margin-left | Length | 小部件的左边距。 |
max-height | Length | 小部件或子控件的最大高度。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,了QSplitter,QStatusBar,的QTextEdit和QToolTip。 该值相对于框模型中的内容rect 。 例: QSpinBox { max-height: 24px } 另请参见max-width。 |
max-width | Length | 小部件或子控件的最大宽度。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,了QSplitter,QStatusBar,的QTextEdit和QToolTip。 该值相对于框模型中的内容rect 。 例: QComboBox {max - width: 72px } 另见max-height。 |
messagebox-text-interaction-flags* | Number | 消息框中文本的交互行为。可能的值基于Qt :: TextInteractionFlags。 如果未指定此属性,则默认为SH_MessageBox_TextInteractionFlags样式提示的当前样式指定的值。 例: QMessageBox { messagebox-text-interaction-flags: 5 } |
min-height | Length | 小部件或子控件的最小高度。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,了QSplitter,QStatusBar,的QTextEdit和QToolTip。 如果未指定此属性,则根据窗口小部件的内容和样式派生最小高度。 该值相对于框模型中的内容rect 。 例: QComboBox {min -身高: 24px } 另见min-width。 |
min-width | Length | 小部件或子控件的最小宽度。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,了QSplitter,QStatusBar,的QTextEdit和QToolTip。 如果未指定此属性,则根据窗口小部件的内容和样式派生最小宽度。 该值相对于框模型中的内容rect 。 例: QComboBox {min - width: 72px } 另见min-height。 |
opacity* | Number | 小部件的不透明度。可能的值从0(透明)到255(不透明)。目前,仅支持工具提示。 如果未指定此属性,则默认为SH_ToolTipLabel_Opacity样式提示的当前样式指定的值。 例: QToolTip {不透明度: 223 } |
outline | 围绕对象边框绘制的轮廓。 | |
outline-color | Color | 轮廓的颜色。另请参阅border-color |
outline-offset | Length | 轮廓与窗口小部件边框的偏移量。 |
outline-style | 指定用于绘制轮廓的图案。另见border-style | |
outline-radius | 在轮廓上添加圆角 | |
outline-bottom-left-radius | Radius | 轮廓左下角的半径。 |
outline-bottom-right-radius | Radius | 轮廓右下角的半径。 |
outline-top-left-radius | Radius | 轮廓左上角的半径。 |
outline-top-right-radius | Radius | 轮廓右上角的半径。 |
padding | Box Lengths | 小部件的填充。等效于声明padding-top,padding-right,padding-bottom,和padding-left。 此属性支持QAbstractItemView中的子类,QAbstractSpinBox子类,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit的,QMenu,QMenuBar,QPushButton,QRadioButton,了QSplitter,的QTextEdit和QToolTip。 如果未指定此属性,则默认为0。 例: QLineEdit {padding: 3px } 另请参阅边距,间距和框模型。 |
padding-top | Length | 小部件的顶部填充。 |
padding-right | Length | 小部件的右侧填充。 |
padding-bottom | Length | 小部件的底部填充。 |
padding-left | Length | 小部件的左侧填充。 |
paint-alternating-row-colors-for-empty-area | bool | QTreeView是否为空白区域(即没有项目的区域)绘制交替的行颜色 |
position | relative | 使用left,right,top和bottom指定的偏移是相对坐标还是绝对坐标。 |
| absolute | 如果未指定此属性,则默认为relative。 | |
right | Length | 如果position是relative(默认值),则将子控件移动到左侧的某个偏移量; 指定然后相当于指定。right: xleft: -x 如果position是absolute,则right属性指定子控件相对于父级右边缘的右边缘(另请参阅subcontrol-origin)。 例: QSpinBox::down-button { right: 2px } 另见左,上和下。 |
selection-background-color* | Brush | 选定文本或项目的背景。 所有遵循QWidget :: palette并显示选择文本的小部件都支持此属性。 如果未设置此属性,则默认值为为调色板的Highlight角色设置的值。 例: QTextEdit {选择 -背景 -颜色:darkblue} 另请参见selection-color和background。 |
selection-color* | Brush | 所选文本或项目的前景。 所有遵循QWidget :: palette并显示选择文本的小部件都支持此属性。 如果未设置此属性,则默认值为为调色板的HighlightedText角色设置的值。 例: QTextEdit { selection-color: white } 另请参见selection-background-color和color。 |
show-decoration-selected* | Boolean | 控制QListView中的选择是覆盖整个行还是仅覆盖文本的范围。 如果未指定此属性,则默认为SH_ItemView_ShowDecorationSelected样式提示的当前样式指定的值。 例: * { show-decoration-selected: 1 } |
spacing* | Length | 小部件中的内部间距。 QCheckBox,可检查的QGroupBox es,QMenuBar和QRadioButton支持此属性。 如果未指定此属性,则默认值取决于窗口小部件和当前样式。 例: QMenuBar { spacing: 10 } 另请参见填充和边距。 |
subcontrol-origin* | Origin | 父元素中子控件的原始矩形。 如果未指定此属性,则默认为padding。 例: QSpinBox::up-button { image: url(:/images/spinup.png); subcontrol-origin: content; subcontrol-position: right top; } 另见subcontrol-position。 |
subcontrol-position* | Alignment对准 | subcontrol-origin指定的原始矩形内子控件的对齐方式。 如果未指定此属性,则默认为取决于子控件的值。 例: QSpinBox::down-button { image: url(:/images/spindown.png); subcontrol-origin: padding; subcontrol-position: right bottom; } 另请参见subcontrol-origin。 |
titlebar-show-tooltips-on-buttons} | bool | 是否在窗口标题栏按钮上显示工具提示。 |
widget-animation-duration* | Number | 动画应该持续多少(以毫秒为单位)。值等于零意味着将禁用动画。 如果未指定此属性,则默认为SH_Widget_Animation_Duration样式提示的当前样式指定的值。 此属性已添加到Qt 5.10中。 例: * { widget-animation-duration: 100 } |
text-align | Alignment对准 | 窗口小部件内容中文本和图标的对齐方式。 如果未指定此值,则默认为取决于本机样式的值。 例: QPushButton { text-align: left; } 此属性目前仅由QPushButton和QProgressBar支持。 |
text-decoration | none | 附加文字效果 |
underline | ||
overline | ||
line-through | ||
top | Length | 如果position是relative(默认值),则将子控件向下移动一定的偏移量。 如果position是absolute,则top属性指定子控件与父级的上边缘相关的上边缘(另请参阅subcontrol-origin)。 如果未指定此属性,则默认为0。 例: QSpinBox::up-button { top: 2px } 另见左,右和底。 |
width | Length | 子控件的宽度(或某些情况下的小部件)。 如果未指定此属性,则默认值取决于子控件/窗口小部件和当前样式。 警告:除非另行指定,否则在小组件上设置此属性时无效。如果需要具有固定宽度的窗口小部件,请将min-width和max-width设置为相同的值。 例: QSpinBox::up-button { width: 12px } 另见身高。 |
Pyside 样式属性表
最新推荐文章于 2024-05-30 11:43:13 发布