Results 1 to 5 of 5

Thread: QApplication(argc, argv)

  1. #1
    Join Date
    Apr 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question QApplication(argc, argv)

    I noticed that the main.cpp in a Qt application has to contain the following line:

    QApplication app(argc, argv);

    I know that argc is the number of command-line arguments, and argv is that array list of command-line arguments. But, the question in my mind is: what are those arguments I'm passing to the constructor and at the same time cannot explicitly see? What is working behind the scences out there?

    Thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication(argc, argv)

    See the documentation: http://doc.qt.nokia.com/latest/qappl...l#QApplication

    You can see Qt supports several command line parameters common to all Qt applications.

  3. #3
    Join Date
    Apr 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication(argc, argv)

    Quote Originally Posted by squidge View Post
    See the documentation: http://doc.qt.nokia.com/latest/qappl...l#QApplication

    You can see Qt supports several command line parameters common to all Qt applications.
    Thanks for your reply. I mean, how can I know what is being passed? I'm mentioning that there are arguments to be passed, but, what are they, and how many arguments are being passed?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication(argc, argv)

    Read this chapter 11. This is rudiments of C/C++.

  5. #5
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: QApplication(argc, argv)

    Quote Originally Posted by SWEngineer View Post
    Thanks for your reply. I mean, how can I know what is being passed? I'm mentioning that there are arguments to be passed, but, what are they, and how many arguments are being passed?
    It's passing as many arguments as were on the "command line". In many cases there will be nothing beyond the first element (which is by convention the executable name).

Similar Threads

  1. Qt without QApplication
    By jakebman in forum Newbie
    Replies: 6
    Last Post: 25th July 2008, 00:38
  2. Restart QApplication
    By Svaths in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th February 2007, 11:54
  3. how to use "argc" and "argv" ?
    By probine in forum Qt Programming
    Replies: 5
    Last Post: 9th December 2006, 19:03
  4. why we have need of QApplication
    By Krishnacins in forum Qt Programming
    Replies: 11
    Last Post: 12th April 2006, 16:37
  5. <QtGui/QApplication> vs. <QApplication>
    By seneca in forum Qt Programming
    Replies: 5
    Last Post: 25th January 2006, 10:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.