在派生类中重载QDialog的void paintEvent(QPaintEvent *)事件,在这个函数中加入以下代码

QPainter painter(this);
    QLinearGradient grad(0, 0, width(), height());
    QGradientStops gs;
    
    gs << QGradientStop(0.0, QColor(0, 0, 0 , 100))
        << QGradientStop(0.5, QColor(0, 0, 0, 100))
        << QGradientStop(1.0, QColor(0, 0, 0, 100));
    grad.setStops(gs);
    painter.fillRect(0, 0, width(), height(), grad);

http://blog.csdn.net/itjobtxq/article/details/8766721

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-06-15
  • 2021-06-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-10-18
  • 2021-10-01
  • 2022-12-23
相关资源
相似解决方案