3.Qt -QSS

一、如何在Widget中利用代码添加背景图片

    this->setAutoFillBackground(true); //
    QPalette palette = this->palette();
    palette.setBrush(QPalette::Window,
               QBrush(QPixmap(":/images/bg2.jpg").scaled(// 缩放背景图.
                           this->size(),
                           Qt::IgnoreAspectRatio,
                           Qt::SmoothTransformation)));
    this->setPalette(palette);

  

猜你喜欢

转载自www.cnblogs.com/nyqm/p/9009136.html
今日推荐