title: Set (or initialize) window size when creating window
body: <p>I'm trying to initialize the window size when I creating a new window, what I learned to do is to use a constructor to create a window, then use <strong>resize()</strong> to change the size and main source file. Is there a way to initialize the size while constructing the window? (Initialize list, etc.)
  <strong>main.cxx</strong></p>
  <pre><code>#include &lt;QApplication&gt;
  
  #include &quot;MainWindow.hxx&quot;
  
  int main(int argc, char** argv){
          QApplication GUI(argc, argv);
          MainWindow window;
          window.LineEditLogin();
          window.resize(500,300);
          window.setFont(QFont(&quot;宋体&quot;,16));
          window.show();
  
          return GUI.exec();
  }
  </code></pre>
  <p><strong>MainWindow.cxx</strong></p>
  <pre><code>#include&lt;iostream&gt;
  
  #include &quot;MainWindow.hxx&quot;
  
  MainWindow::MainWindow(QWidget *Main)
       : QMainWindow(Main)
  {
  
  }
  
  MainWindow::~MainWindow()
  {
  
  }
  
  void MainWindow::LineEditLogin(){
          this-&gt;EditUser = new QLineEdit(this);
          EditUser-&gt;move(100,100);
          EditUser-&gt;setPlaceholderText(&quot;请输入账号。。。&quot;);
  
          this-&gt;EditPass = new QLineEdit(this);
          EditPass-&gt;move(100,150);
          EditPass-&gt;setPlaceholderText(&quot;请输入密码。。。&quot;);
          EditPass-&gt;setEchoMode(QLineEdit::Password);
  }
  </code></pre>