QT中css样式

QLabel

字体左对齐:

QLabel {
    qproperty-alignment: AlignLeft;
}

字体居中

QLabel {
    qproperty-alignment: AlignCenter;
}

字体右对齐

QLabel {
    qproperty-alignment: AlignRight;
}

QGroupBox

QGroupBox标题居中及标题位置

QGroupBox#groupBox_name {
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                      stop: 0 #DEF0FE, stop: 1 #DEF0FE);
    border: 1px solid #B2B6B9;
    border-radius: 6px;
    font: normal 16px;
    margin-top: 1ex; /* leave space at the top for the title */
}


QGroupBox#groupBox_name::title {
    subcontrol-origin: margin;
    subcontrol-position: top center; /* position at the top center */
    padding: 0 3px;
    font: normal 16px;
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DEF0FE, stop: 1 #DEF0FE);
}

indicator

indicator是指示器,如CheckBox的选择框,RadioButton的选择按钮…
设置指示器的大小

QRadioButton::indicator{
	width:15px;
	height:15px;
}

你可能感兴趣的:(QT应用程序开发,QT)