window.setAutoFillBackground(true);

    QPalette palette = window.palette();
    palette.setBrush(QPalette::Window,
            QBrush(QPixmap("background.jpg").scaled(// 缩放背景图.
                window.size(),
                Qt::IgnoreAspectRatio,
                Qt::SmoothTransformation)));             // 使用平滑的缩放方式
    window.setPalette(palette);

相关文章:

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