title: Qt - How to get the sidebar in MainWindow
body: <p>I amk new to qt. I tried to create a window with a widget. The widget contains a picture(a chess board). Now, If I tried to show the window it is showing a part of that picture. Here the code</p>
  
  <pre><code>#include&lt;QApplication&gt;
  #include&lt;QMainWindow&gt;
  #include&lt;QWidget&gt;
  #include&lt;QMenu&gt;
  #include&lt;QMenuBar&gt;
  #include&lt;QPainter&gt;
  #include&lt;QFrame&gt;
  #include&lt;QHBoxLayout&gt;
  #include&lt;iostream&gt;
  
  using namespace std;
  
  class MyWindow:public QMainWindow
  {
  public:
  MyWindow();
  };
  
  class MyWidget:public QWidget
  {
  public:
  MyWidget();
  void paintEvent(QPaintEvent * event);
  };
  
  int main(int argc,char *argv[])
  {
  Q_INIT_RESOURCE(puzzle);
  
  QApplication app(argc,argv);
  
  MyWindow mainWindow;
  
  mainWindow.show();
  
  return app.exec();
  }
  
  MyWindow::MyWindow():QMainWindow()
  {
  setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
  
  QMenu * fileMenu=menuBar()-&gt;addMenu(QObject::tr("Options"));
  
  QAction * restartAction = fileMenu-&gt;addAction(tr("NewGame"));
  
  QAction * exitAction = fileMenu-&gt;addAction(tr("Exit"));
  exitAction-&gt;setShortcuts(QKeySequence::Quit);
  
  QWidget * tempWidget=new MyWidget();
  
  QFrame * newFrame=new QFrame();
  QHBoxLayout * horizontal= new QHBoxLayout(newFrame);
  
  horizontal-&gt;addWidget(tempWidget);
  setCentralWidget(newFrame);
  }
  
  MyWidget::MyWidget():QWidget()
  {
  setMinimumSize(100,100);
  setMaximumSize(1000,1000);
  }
  
  void MyWidget::paintEvent(QPaintEvent * event)
  {
  QPainter painter;
  painter.begin(this);
  painter.drawPixmap(QRect(0,0,500,600),QPixmap("Board").scaled(QSize(500,600),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation));
  painter.end();
  }
  </code></pre>