Qt 6.11 is out! See what's new in the release
blog
Not displaying image in the window
General and Desktop
5
Posts
5
Posters
1.8k
Views
1
Watching
-
the source code
@QPalette p = palette();
QPixmap pixmap1(":/new/prefix1/BG");QDesktopWidget* desktopWidget = QApplication::desktop(); QRect rect = desktopWidget->availableGeometry(); QSize size(rect.width() , rect.height()); QPixmap pixmap(pixmap1.scaled(size)); p.setBrush(QPalette::Background, pixmap); setPalette(p);@ when the project is built in the output console it displays--QPixmap::scaled: Pixmap is a null pixmap -
yeah, like stuk said; you may have mis-typed the filename :)
Also would like to suggest you use QImage for opening the image which is much faster than using a pixmap for nothing but scaling.
-
I think you should replace
QPixmap pixmap1(":/new/prefix1/BG");
for
QPixmap pixmap1(":/new/prefix1/BG.png");
or
QPixmap pixmap1(":/new/prefix1/BG.jpg");you need to put the image extension in the code.