Results 1 to 2 of 2

Thread: Is there a difference between the two types of coding(for Header File)??

  1. #1
    Join Date
    Jul 2014
    Posts
    95
    Thanks
    67

    Default Is there a difference between the two types of coding(for Header File)??

    Hello

    Is using the code below

    Qt Code:
    1. #include <QtWidgets>
    To copy to clipboard, switch view to plain text mode 

    There are certain differences with the following code????:

    Qt Code:
    1. #include <QWidget>
    2. #include <QLabel>
    3. #include <QTextEdit>
    4. #include <QMenu>
    5. .......
    6. .......
    To copy to clipboard, switch view to plain text mode 

    thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Is there a difference between the two types of coding(for Header File)??

    The first one is a module include, it indirectly includes all headers of the respective module, in this case QtWidgets.
    The second option is including each type individually.

    I wouldn't recommend using the frist one outside of small test programs or prototyping.
    Including all headers means that the compiler will have to parse a lot of declarations that it then doesn't need, i.e. a waste of build time.


    Cheers,
    _

  3. The following 2 users say thank you to anda_skoa for this useful post:

    8Observer8 (18th August 2014), rezas1000 (18th August 2014)

Similar Threads

  1. Replies: 4
    Last Post: 2nd October 2013, 13:57
  2. Replies: 2
    Last Post: 4th January 2012, 13:26
  3. Replies: 0
    Last Post: 18th July 2009, 13:07
  4. How to set default icons of different file types?
    By merry in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2008, 15:24
  5. what will be the coding for Menu->File->open
    By jyoti in forum Qt Programming
    Replies: 3
    Last Post: 10th November 2006, 12:16

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.