QT样式表学习一

`1、多个属性必须要用;分开
・2、background-image:url(:/new/prefix1/images/icon_num_1.png);设置背景图片
     background-position: center 设置背景图片居中显示
`3、QToolButton:pressed{background-image:url(:/new/prefix1/images/shortdial_press.png);}
    QToolButton{background-image:url(:/new/prefix1/images/shortdial_normal.png);}
    QToolButton{background-position: center;}多个特征属性的描述方法,按钮按下去的背景图片切换
    注意,如果用QPushButton做的话,控件界面上会有一些虚线,用QToolButton的话就不会有你。
・4、圆形按钮的制作
     QToolButton{border-radius:8px;}
・5、按钮去掉边框  border-style:flat;(属性)
・6、实现两幅图片的叠加 QToolButton{image:url(:/new/prefix1/images/search_IconSpace.png);} 通过image属性可以再叠加一个图片背景上来
・7、改变组合框的各种属性
QComboBox::drop-down { image: url(:/new/prefix1/images/search_btnInput_normal.png); }
QComboBox::drop-down:pressed { image: url(:/new/prefix1/images/search_btnInput_pressed.png); } 改变组合框的下拉表的背景图片
・8、label 加载边框属性
border-image: url(:/new/prefix1/images/search_InputBG_N.png);
     label透明化属性
    padding:2px:在label中光标位置处填充多少个字符
    border: 2px solid green 改变边框的粗细程度。
・9、qlistview相关属性的设置例子
QListView{background-image:url(:/new/prefix1/images/search_list_bkg.png);}  加载一般的背景图片
QListView{border-style:flat;} 去掉边框
QListView{font:  50px; }设置显示的字体的大小
QListView::item:selected{image:url(:/new/prefix1/images/search_list_pressed.png);}设置点击item时item的背景图片
・10、字体相关属性的设置
font-size:30px;color:white;设置字体的大小和颜色

你可能感兴趣的:(qt,QT样式表)