QT設定ToolButton按鈕的樣式
阿新 • • 發佈:2019-02-03
- QToolButton{
- min-width:80px;
- min-height:32px;
- }
- QToolButton{
- color:rgb(255, 255, 255);
- min-height:20;
- border-style:solid;
- border-top-left-radius:2px;
- border-top-right-radius:2px;
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
-
stop: 0.3 rgb(160,160,160),
- stop: 1 rgb(140,140,140));
- border:1px;
- border-radius:5px;padding:2px 4px;/*border-radius控制圓角大小*/
- }
- QToolButton:hover{ /*滑鼠放上後*/
- color:rgb(255, 255, 255);
- min-height:20;
- border-style:solid;
- border-top-left-radius:2px;
- border-top-right-radius:2px;
-
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
- stop: 0.3 rgb(160,160,160),
- stop: 1 rgb(120,120,120));
- border:1px;
- border-radius:5px;padding:2px 4px;
- }
- QToolButton:pressed{ /*按下按鈕後*/
- color:rgb(255, 255, 255);
- min-height:20;
- border-style:solid;
- border-top-left-radius:2px;
-
border-top-right-radius:2px;
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
- stop: 0.3 rgb(190,190,190),
- stop: 1 rgb(160,160,160));
- border:1px;
- border-radius:5px;padding:2px 4px;
- }
- QToolButton:checked{ /*選中後*/
- color:rgb(255, 255, 255);
- min-height:20;
- border-style:solid;
- border-top-left-radius:2px;
- border-top-right-radius:2px;
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
- stop: 0.3 rgb(190,190,190),
- stop: 1 rgb(160,160,160));
- border:1px;
- border-radius:5px;padding:2px 4px;
- }
FROM: http://blog.csdn.net/qcontriver/article/details/45037823