代码:

QPushButton { border: 1px solid #000000; border-radius: 5px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dedede, stop: 0.5 #434343, stop: 0.51 #000000, stop: 1 #656a6d); color: #FFFFFF; font: bold 14px; min-width: 80px; } QPushButton:pressed { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cfcccc, stop: 0.5 #333232, stop: 0.51 #000000, stop: 1 #585c5f); color: #00CC00; } QPushButton:flat { border: none; }
界面效果:
2 代码:

QPushButton { /* Let's make the size of the button 1,5 times of font size. */ min-height: 1.5em; /* Font size just 1.*/ font: 1em; /* Margins so that we get a little space on the left and right. */ margin: 0 1px 0 1px; /* The font color */ color: white; /* Here's the background gradient with start point, end point, stop "percentage" and color, stop percentage and color. */ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2198c0, stop: 1 #0d5ca6); /* We'll round the borders. */ border-style: outset; /* Round radius will be 3px */ border-radius: 3px; /* Border is only one pixel */ border-width: 1px; /* Border color is now set */ border-color: #0c457e; } /* This is style when button is pressed */ QPushButton:pressed { /* We'll just invert the gradient by changing the colors around. */ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #0d5ca6, stop: 1 #2198c0); }
界面效果: