title: Using QApplication with command line arguments
body: <pre><code>QApplication::QApplication ( int &amp; argc, char ** argv )
  </code></pre>
  
  <blockquote>
    <p>Initializes the window system and <strong>constructs an application object
    with argc command line arguments in argv.</strong></p>
    
    <p>Warning: The data referred to by argc and argv must stay valid for the
    entire lifetime of the QApplication object. <strong>In addition, argc must be
    greater than zero and argv must contain at least one valid character
    string.</strong></p>
  </blockquote>
  
  <p>From this link: <a href="http://doc.qt.io/qt-4.8/qapplication.html#QApplication" rel="nofollow">http://doc.qt.io/qt-4.8/qapplication.html#QApplication</a></p>
  
  <p>What can be the arguments to the executable file? Any examples?</p>
  
  <p>I tried specifying something like:</p>
  
  <pre><code>anisha@linux-dopx:~/Desktop/notes/qt&gt; make
  g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../qtsdk-2010.05/qt/mkspecs/linux-g++-64 -I. -I../../../qtsdk-2010.05/qt/include/QtCore -I../../../qtsdk-2010.05/qt/include/QtGui -I../../../qtsdk-2010.05/qt/include -I. -I. -o widgets.o widgets.cpp
  g++ -m64 -Wl,-O1 -Wl,-rpath,/home/anisha/qtsdk-2010.05/qt/lib -o qt widgets.o    -L/home/anisha/qtsdk-2010.05/qt/lib -lQtGui -L/home/anisha/qtsdk-2010.05/qt/lib -L/usr/X11R6/lib64 -lQtCore -lpthread 
  
  anisha@linux-dopx:~/Desktop/notes/qt&gt; ./qt 2 f g
  anisha@linux-dopx:~/Desktop/notes/qt&gt; 
  </code></pre>
  
  <p>Nothing <em>special</em> happened, nor I knew what I was doing or what I was supposed to do.</p>
  
  <p><strong>EDIT 1:</strong> The code on which I tried the <code>./qt -style=windows</code>.</p>
  
  <pre><code>#include &lt;QtGui&gt;
  
   int main (int argc, char *argv[])
   {
      QApplication app (argc, argv);
  
      QWidget objQWidget;
      objQWidget.show                 ();     
      objQWidget.resize               (320, 240);     
      objQWidget.setWindowTitle ("Text to be shown on the title bar\n");
  
      // Adding a "child" widget.
      QPushButton *objQPushButton = new QPushButton ("Text to be shown on the button", &amp;objQWidget);
      objQPushButton-&gt;move         (100, 100);
      objQPushButton-&gt;show         ();
  
      return app.exec                   ();
   }
  </code></pre>