StupidBeauty
Read times:1424Posted at:Fri Dec 2 18:19:46 2011
- no title specified

转载:Styling QProgressBar and QScrollBar

Qt的进度条里的trunk(进度块)指的是用来填充已完成进度的小块。比如这個进度条里有1个trunk:

而这個进度条里有6个trunk:

http://labs.qt.nokia.com/2007/06/12/styling-qprogressbar-and-qscrollbar/

亮点:

QProgressBar

QProgressBar:horizontal {
border: 1px solid gray;
border-radius: 3px;
background: white;
padding: 1px;
}
QProgressBar::chunk:horizontal {
background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);
}

Here’s what you get:

You say “Oh sweet, but I want WindowsXP like progress bars. And the label needs to be outside since its easier to read”. Yeah, sure.

QProgressBar:horizontal {
border: 1px solid gray;
border-radius: 3px;
background: white;
padding: 1px;
text-align: right;
margin-right: 4ex;
}
QProgressBar::chunk:horizontal {
background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);
margin-right: 2px; /* space */
width: 10px;
}

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands