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);
posted on 2018-08-05 23:31  浅塘  阅读(1177)  评论(0编辑  收藏  举报