一、如何在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);