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

 

相关文章:

  • 2021-08-13
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-03-08
  • 2022-12-23
  • 2021-10-20
猜你喜欢
  • 2022-12-23
  • 2021-06-24
  • 2021-11-26
  • 2021-11-23
  • 2021-05-01
  • 2021-06-05
相关资源
相似解决方案