QPixmap pic("../image.jpg");
setAutoFillBackground(true);
QPalette palette;
QPixmap scaled=pic.scaled (800, 480, Qt::IgnoreAspectRatio, Qt::FastTransformation);
palette.setBrush(QPalette::Window, QBrush(scaled));
//this->setPalette(palette);
QWidget *w= new QWidget(this);
w->setGeometry(0,0,800,480);
w->show();
w->setPalette(palette);
그러나 위젯에는 이미지가 표시되지 않습니다.이미지를 다시 크기 조정하고 QWidget으로 어떻게 설정할 수 있습니까?
대신 QPalette :: Background를 사용하면 어떻게됩니까? – Bart
이미지를 축척하지 않을 때 작동합니까? –
기본 창 – Thorin