Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1684185
  • 博文数量: 584
  • 博客积分: 13857
  • 博客等级: 上将
  • 技术积分: 11883
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-16 09:34

分类: WINDOWS

2011-06-23 12:11:35


背景图片九宫格
border-width: 5px;
border-image: url(./run/images/news/group_normal.png) 5 5 5 5 stretch stretch;

border-width必须要加上,用border-image来自动根据大小扩展,而不用background-image

字体颜色
color: white;

按钮3种状态:正常,鼠标置上,按下
QPushButton
QPushButton:hover
QPushButton:checked
对于checked,要把QPushButton设置为可checkable。(setCheckable(true))



实例:http://blog.csdn.net/xuhongtao123459/archive/2010/09/10/5875614.aspx

  1. 01.*{
  2. 02. font-size:13px;
  3. 03. color:white;
  4. 04. font-family:"宋体";
  5. 05.}
  6. 06.CallWidget QLineEdit#telEdt
  7. 07.{
  8. 08. font-size:24px;
  9. 09.}
  10. 10.QMainWindow,QDialog{
  11. 11. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  12. 12. stop: 0 #1B2534, stop: 0.4 #010101,
  13. 13. stop: 0.5 #000101, stop: 1.0 #1F2B3C);
  14. 14.}
  15. 15.QWidget{
  16. 16. background:#121922;
  17. 17.}
  18. 18.QLabel{
  19. 19. background:transparent;
  20. 20.}
  21. 21.DailForm QLineEdit#phoneLineEdt{
  22. 22. font-size:36px;
  23. 23. font-weight: bold;
  24. 24.}
  25. 25.QPushButton,QToolButton{
  26. 26. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  27. 27. stop: 0 #5B5F5F, stop: 0.5 #0C2436,
  28. 28. stop: 1.0 #27405A);
  29. 29. border-style: outset;
  30. 30. border-width: 1px;
  31. 31. border-radius: 5px;
  32. 32. border-color: #11223F;
  33. 33. padding: 1px;
  34. 34.}
  35. 35.QPushButton::hover,QToolButton::hover{
  36. 36. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  37. 37. stop: 0 #758385, stop: 0.5 #122C39,
  38. 38. stop: 1.0 #0E7788);
  39. 39. border-color: #11505C;
  40. 40.}
  41. 41.QPushButton::pressed,QToolButton::pressed{
  42. 42. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  43. 43. stop: 0 #969B9C, stop: 0.5 #16354B,
  44. 44. stop: 1.0 #244F76);
  45. 45. border-color: #11505C;
  46. 46.}
  47. 47.QPushButton::disabled,QToolButton::disabled{
  48. 48. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  49. 49. stop: 0 #282B2C, stop: 0.5 #09121A,
  50. 50. stop: 1.0 #111D29);
  51. 51. border-color: #0A1320;
  52. 52. color:#6A6864;
  53. 53.}
  54. 54.QDialog QPushButton,QDialog QToolButton{
  55. 55. min-width:30px;
  56. 56. min-height:23px;
  57. 57.}
  58. 58.QToolButton[objectName="minimizeToolBtn"] {
  59. 59. background: transparent;
  60. 60. border:none;
  61. 61. image:url(qss/minimize.png)
  62. 62.}
  63. 63.QToolButton[objectName="minimizeToolBtn"]:hover,QToolButton[objectName="minimizeToolBtn"]:pressed {
  64. 64. image:url(qss/minimize_hover.png)
  65. 65.}
  66. 66.QToolButton[objectName="maximizeToolBtn"] {
  67. 67. background: transparent;
  68. 68. border:none;
  69. 69. image:url(qss/maximize.png)
  70. 70.}
  71. 71.QToolButton[objectName="maximizeToolBtn"]:hover,QToolButton[objectName="maximizeToolBtn"]:pressed {
  72. 72. image:url(qss/maximize_hover.png)
  73. 73.}
  74. 74.QToolButton[objectName="closeToolBtn"],QToolButton[objectName="customCloseWindow"] {
  75. 75. background: transparent;
  76. 76. border:none;
  77. 77. image:url(qss/close.png)
  78. 78.}
  79. 79.QToolButton[objectName="closeToolBtn"]:hover,QToolButton[objectName="closeToolBtn"]:pressed{
  80. 80. image:url(qss/close_hover.png)
  81. 81.}
  82. 82.QToolButton[objectName="customCloseWindow"]:hover,QToolButton[objectName="customCloseWindow"]:pressed{
  83. 83. image:url(qss/close_hover.png)
  84. 84.}
  85. 85.QToolButton[objectName="titleSetUpToolBtn"]{
  86. 86. background: transparent;
  87. 87. border:none;
  88. 88. image:url(qss/setup.png)
  89. 89.}
  90. 90.DailForm QToolButton#oneToolBtn,QToolButton#OneToolBtn,QToolButton#twoToolBtn,QToolButton#threeToolBtn,
  91. 91. QToolButton#fourToolBtn,QToolButton#fiveToolBtn,QToolButton#sixToolBtn,
  92. 92. QToolButton#sevenToolBtn,QToolButton#eightToolBtn,QToolButton#nineToolBtn,
  93. 93. QToolButton#starToolBtn,QToolButton#zeroToolBtn,QToolButton#sharpToolBtn {
  94. 94. font-size:36px;
  95. 95. border-radius: 10px;
  96. 96.}
  97. 97.DailForm QToolButton#delToolBtn{
  98. 98. border-radius: 10px;
  99. 99.}
  100. 100.QFrame{
  101. 101. border-color:#32435E;
  102. 102. border-width:1px;
  103. 103. border-radius: 3px;
  104. 104.}
  105. 105.QLineEdit,QTextEdit {
  106. 106. border: 1px solid #32435E;
  107. 107. border-radius: 3px;
  108. 108. /* padding: 0 8px; */
  109. 109. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  110. 110. stop: 0 #080B10,
  111. 111. stop: 1.0 #212C3F);
  112. 112. selection-background-color: #0A246A;
  113. 113.}
  114. 114.QLineEdit::hover{
  115. 115. border-color:#5D8B9E;
  116. 116.}
  117. 117.QLineEdit[echoMode="3"] {
  118. 118. lineedit-password-character: 9679;
  119. 119.}
  120. 120.#QLineEdit:read-only {
  121. 121. background: #543F7C;
  122. 122.}
  123. 123.QTabWidget::pane { /* The tab widget frame */
  124. 124. border: 0px solid #32435E;
  125. 125. position: absolute;
  126. 126. left: -0.1em;
  127. 127.}
  128. 128.QTabWidget#MainTabWidget::tab-bar {
  129. 129. left: -3px; /* move to the right by 5px */
  130. 130.}
  131. 131.QTabWidget#MainTabWidget QTabBar::tab {
  132. 132. height: 14ex;
  133. 133. width: 14ex;
  134. 134.}
  135. 135.QTabBar::tab {
  136. 136. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  137. 137. stop: 0 #292F31, stop: 1 #0C131E);
  138. 138.}
  139. 139.QTabBar::tab:selected{
  140. 140. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  141. 141. stop: 0 #113845, stop: 1.0 #15A8FF);
  142. 142.}
  143. 143.QTabBar::tab:hover {
  144. 144. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  145. 145. stop: 0 #113845, stop: 1.0 #0E6F80);
  146. 146.}
  147. 147.#QTabBar::tab:selected {
  148. 148. border-color: #32435E;
  149. 149. border-right-color: #32435E; /* same as pane color */
  150. 150.}
  151. 151.#QTabBar::tab:!selected {
  152. 152. margin-left: 2px; /* make non-selected tabs look smaller */
  153. 153.}
  154. 154.#QTabBar:tab:first:selected {
  155. 155. margin-top: 0;
  156. 156.}
  157. 157.QTabBar:tab:last:selected {
  158. 158. margin-right: 0;
  159. 159.}
  160. 160.QTabBar:tab:only-one {
  161. 161. margin: 0;
  162. 162.}
  163. 163.QListWidget{
  164. 164. border: 1px solid #32435E;
  165. 165. background:#050609;
  166. 166.}
  167. 167.QListWidget::item:selected {
  168. 168. /*border: 0px solid #33CCFF;*/
  169. 169. border:none;
  170. 170. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  171. 171. stop: 0 #6A848C, stop: 1.0 #0F9EAF);
  172. 172. padding:0px;
  173. 173. margin:0px;
  174. 174.}
  175. 175.#QListWidget::item:selected:!active {
  176. 176. border-width: 0px ;
  177. 177.}
  178. 178.#QListWidget::item:selected:active {
  179. 179. border-width: 1px;
  180. 180.}
  181. 181.
  182. 182.QComboBox {
  183. 183. border: 1px solid #32435E;
  184. 184. border-radius: 3px;
  185. 185. padding: 1px 18px 1px 3px;
  186. 186. min-width: 6em;
  187. 187.}
  188. 188.QComboBox::hover{
  189. 189. border-color:#5D8B9E;
  190. 190.}
  191. 191.QComboBox:editable {
  192. 192. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  193. 193. stop: 0 #080B10,
  194. 194. stop: 1.0 #212C3F);
  195. 195.}
  196. 196.QComboBox:!editable, QComboBox::drop-down:editable {
  197. 197. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  198. 198. stop: 0 #080B10,
  199. 199. stop: 1.0 #212C3F);
  200. 200.}
  201. 201./* QComboBox gets the "on" state when the popup is open */
  202. 202.QComboBox:!editable:on, QComboBox::drop-down:editable:on {
  203. 203. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  204. 204. stop: 0 #080B10,
  205. 205. stop: 1.0 #212C3F);;
  206. 206.}
  207. 207.QComboBox:on { /* shift the text when the popup opens */
  208. 208. padding-top: 3px;
  209. 209. padding-left: 4px;
  210. 210.}
  211. 211.QComboBox::drop-down {
  212. 212. subcontrol-origin: padding;
  213. 213. subcontrol-position: top right;
  214. 214. width: 15px;
  215. 215. border-left-width: 1px;
  216. 216. border-left-color: 32435E;
  217. 217. border-left-style: solid; /* just a single line */
  218. 218. border-top-right-radius: 3px; /* same radius as the QComboBox */
  219. 219. border-bottom-right-radius: 3px;
  220. 220.}
  221. 221.QComboBox::down-arrow {
  222. 222. image: url(qss/downarrow.png);
  223. 223.}
  224. 224.QComboBox::down-arrow:on { /* shift the arrow when popup is open */
  225. 225. top: 1px;
  226. 226. left: 1px;
  227. 227.}
  228. 228.QComboBox QAbstractItemView {
  229. 229. border: 2px solid #32435E;
  230. 230. selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  231. 231. stop: 0 #506B79,
  232. 232. stop: 1.0 #0D95A6);
  233. 233. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  234. 234. stop: 0 #1B2534, stop: 0.4 #010101,
  235. 235. stop: 0.5 #000101, stop: 1.0 #1F2B3C);
  236. 236.}

阅读(2906) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~