void MainWindow::paintEvent(QPaintEvent *) { qDebug() << "paintEvent"; QPainter painter(this); //上半部分背景 QPixmap banner(":/login/banner_5"); banner.setDevicePixelRatio(2.0); painter.drawPixmap(0, 0, banner); //下班部分背景 QPixmap bg(":/login/bg_login"); bg.setDevicePixelRatio(2.0); painter.drawPixmap(0, banner.height()/2, bg); }