«

»

十二 03 2011

Print this 文章

转载:Styling QProgressBar and QScrollBar

- 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;
}

关于作者

admin

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2011/12/%e8%bd%ac%e8%bd%bd%ef%bc%9astyling-qprogressbar-and-qscrollbar/

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>