title: How do I add a background image to the QMainWindow?
body: <p>Hi I am new to QT creator. I have tried a bunch of things to set my background image for the Q mainwindow. I added a resource folder with my image. I tried to add the by using setstylesheet in the UI and tried coding it. When I use the UI I can see the image, but when I run it nothing shows. I want put an image of a poker table that I have as the background and be able to put pushbuttons, etc on top. </p>
  
  <p>main.cpp:</p>
  
  <pre><code>#include "mainwindow.h"
  #include &lt;QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();
  
  
      return a.exec();
  }
  </code></pre>
  
  <p>mainwindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      this-&gt;setStyleSheet("{background-image: url(:/images/images/PokerTableBackground.jpg);}");
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  </code></pre>
  
  <p>Like I said I tried doing this, and putting the image through the UI and neither one of them work. I want the image set as the background for the whole thing. </p>
  
  <p>I also tried using this:</p>
  
  <pre><code>QWidget *pic = new QWidget(ui-&gt;tab);
      pic-&gt;setStyleSheet("background-image: url(:/images/images/PokerTableBackground.jpg)");
      pic-&gt;setGeometry(QRect(10,10,220,48)); // your location and size.
  </code></pre>