Results 1 to 12 of 12

Thread: why we have need of QApplication

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: why we have need of QApplication

    do the following:
    1. Read the docs
    2. I feel your constructors are not in the correct form:
    Qt Code:
    1. QFont ( const QString & family, int pointSize = -1, int weight = -1, bool italic = false )
    2. QFont ( const QFont & font, QPaintDevice * pd )
    3. QFont ( const QFont & font )
    To copy to clipboard, switch view to plain text mode 

    These are from my qt4 doc...i don't think this has changed since qt3...but you can confirm

    3. Read a Qt book...whenever you create a QApplication obj, you also need to call show and exec functions:

    Qt Code:
    1. //include files
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6.  
    7. // your code...
    8.  
    9. app.show() //actually shows the app window on screen!
    10.  
    11. return app.exec(); //you don't return 0, when using Qt!!
    12. }
    To copy to clipboard, switch view to plain text mode 

    4. you are creating font etc objs on the stack....thus you need to pass them by reference to the constructors above and not by value.

    5. You "seldom" need to use C++ in its true form with Qt...eg when you wish to use "cout" etc...try understanding qt and recoding ur prog...

    6. If there is no harm upgrade to qt4! please

    7. enclose your code in [ code] [ / code] blocks

    8. comment your code!!
    Last edited by nupul; 12th April 2006 at 05:51.

Similar Threads

  1. Replies: 1
    Last Post: 8th January 2009, 13:36
  2. Must construct QApplication before QPaintDevice
    By sekatsim in forum Qt Programming
    Replies: 16
    Last Post: 8th June 2008, 00:00
  3. QApplication instance
    By nile.one in forum Qt Programming
    Replies: 9
    Last Post: 5th October 2007, 12:06
  4. Replies: 2
    Last Post: 16th March 2007, 09:04
  5. qapplication with open(/dev/name,O_RDWR) crashed???
    By ttbug in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 16th September 2006, 07:56

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
  •  
Qt is a trademark of The Qt Company.