Hi, I have a window with a Qwt barchart and I need to display a background image that fills all the window.

The best I could get was:
img.JPG

As you can see, the image isn't displayed correctly. I've overridden MainWindow's resizeEvent() method this way in main.c:

Qt Code:
  1. void MainWindow::resizeEvent(QResizeEvent*)
  2. {
  3. QPixmap bkgnd(":/files/image.png");
  4. bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
  5. QPalette palette;
  6. palette.setBrush(QPalette::Background, bkgnd);
  7. this->setPalette(palette);
  8. }
To copy to clipboard, switch view to plain text mode 

And commented in barchart.cpp:
Qt Code:
  1. //setAutoFillBackground( true );
  2. //setPalette( Qt::white );
  3. //canvas()->setPalette( QColor( "LemonChiffon" ) );
To copy to clipboard, switch view to plain text mode 

The original image is:
image.png

Using bkgnd = bkgnd.scaled(this->size(), Qt::KeepAspectRatioByExpanding); produces the same output.

How can I solve it?