您的位置:首页 > 其它

QWidget可以设置QStyle,它可以绘制很多东西(具体内容没研究,待续)

2016-07-25 02:33 344 查看

QStyle * QWidget::style() const

See also QWidget::setStyle(), QApplication::setStyle(), and QApplication::style().

它可以绘制很多东西,比如设置背景色:

void CustomWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);

QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

http://doc.qt.io/qt-4.8/qstyle.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: