title: Qt: resize MainWindow and its contents according to the resolution of monitor
body: <p>I want to display MainWindow, in full screen and its contents should resize accordingly to the size of the monitor:</p>
  
  <p>My <code>MainWindow.ui</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ui version="4.0"&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class="QMainWindow" name="MainWindow"&gt;
    &lt;property name="geometry"&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;820&lt;/width&gt;
      &lt;height&gt;651&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name="windowTitle"&gt;
     &lt;string&gt;metaio SDK – Qt Tutorials&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class="QWidget" name="centralwidget"&gt;
     &lt;property name="layoutDirection"&gt;
      &lt;enum&gt;Qt::LeftToRight&lt;/enum&gt;
     &lt;/property&gt;
     &lt;layout class="QHBoxLayout" name="horizontalLayout_4"&gt;
      &lt;item&gt;
       &lt;layout class="QVBoxLayout" name="mainLayout"&gt;
        &lt;item alignment="Qt::AlignHCenter"&gt;
         &lt;widget class="QGraphicsView" name="graphicsView"&gt;
          &lt;property name="sizePolicy"&gt;
           &lt;sizepolicy hsizetype="Fixed" vsizetype="Fixed"&gt;
            &lt;horstretch&gt;0&lt;/horstretch&gt;
            &lt;verstretch&gt;0&lt;/verstretch&gt;
           &lt;/sizepolicy&gt;
          &lt;/property&gt;
          &lt;property name="minimumSize"&gt;
           &lt;size&gt;
            &lt;width&gt;1300&lt;/width&gt;
            &lt;height&gt;768&lt;/height&gt;
           &lt;/size&gt;
          &lt;/property&gt;
          &lt;property name="resizeAnchor"&gt;
           &lt;enum&gt;QGraphicsView::NoAnchor&lt;/enum&gt;
          &lt;/property&gt;
         &lt;/widget&gt;
        &lt;/item&gt;
        &lt;item&gt;
         &lt;layout class="QHBoxLayout" name="buttonLayout"&gt;
          &lt;item&gt;
           &lt;widget class="QPushButton" name="quitTutorialButton"&gt;
            &lt;property name="font"&gt;
             &lt;font&gt;
              &lt;weight&gt;75&lt;/weight&gt;
              &lt;bold&gt;true&lt;/bold&gt;
             &lt;/font&gt;
            &lt;/property&gt;
            &lt;property name="text"&gt;
             &lt;string&gt;« Back&lt;/string&gt;
            &lt;/property&gt;
           &lt;/widget&gt;
          &lt;/item&gt;
         &lt;/layout&gt;
        &lt;/item&gt;
       &lt;/layout&gt;
      &lt;/item&gt;
     &lt;/layout&gt;
    &lt;/widget&gt;
   &lt;/widget&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
   &lt;slots&gt;
    &lt;slot&gt;on_load_arel()&lt;/slot&gt;
    &lt;slot&gt;on_load_file()&lt;/slot&gt;
    &lt;slot&gt;on_close_tab(int)&lt;/slot&gt;
    &lt;slot&gt;on_save_and_preview()&lt;/slot&gt;
    &lt;slot&gt;on_preview_channel()&lt;/slot&gt;
   &lt;/slots&gt;
  &lt;/ui&gt;
  </code></pre>
  
  <p>some code of my <code>MainWindow.cpp</code>:</p>
  
  <pre><code>...
  setupUi(this);
  
  quitTutorialButton-&gt;setVisible(false);
  
  QObject::connect(quitTutorialButton, SIGNAL(clicked()), this, SLOT(onQuitTutorialButtonClicked()));
  
  m_pMenu = new Menu(this, this);
  
  // Init the main view for the scene using OpenGL
  QGLWidget *glWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers));
  m_pGraphicsView = graphicsView;
  m_pGraphicsView-&gt;setScene(m_pMenu);
  m_pGraphicsView-&gt;setViewport(glWidget);
  m_pGraphicsView-&gt;setFrameShape(QFrame::NoFrame);
  </code></pre>
  
  <p>some code in my <code>Menu.cpp</code>:</p>
  
  <pre><code>m_pWebView = new QGraphicsWebView();
  addItem(m_pWebView);
  m_pWebView-&gt;resize(1300, 768); // dont want this to be static
  
  QObject::connect(m_pWebView, SIGNAL(linkClicked(const QUrl&amp;)), this, SLOT(linkClicked(const QUrl&amp;)));
  
  QTimer::singleShot(20, this, SLOT(loadContent()));
  </code></pre>
  
  <p>Please help me out.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>If you see, i have added <code>QGraphicsWebView</code> programatically. I am running this solution on my notebook, with 1366 x 768 resolution. If i want to use entire screen space, i have to give size to my <code>QGraphicsWebView</code> (line with comment added at the end) and to my <code>QGraphicsView</code> that lies in my <code>MainWindow.ui</code>. I want to remove this static part, and make it dynamic.</p>