Results 1 to 3 of 3

Thread: Why does Qt use Private classes?

  1. #1
    Join Date
    Oct 2006
    Location
    Raleigh, NC
    Posts
    11
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Why does Qt use Private classes?

    Hi,

    Reading through the source I see a lot QClassPrivate and private data. I can understand the need to keep some of the function private but I don't understand why they went to the extent of creating a whole set of QClassPrivate classes... it makes the source more confusing to read.

    Would someone enlighten me?
    Thanks,
    Hua-Ying

  2. The following user says thank you to hyling for this useful post:

    No-Nonsense (14th December 2006)

  3. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why does Qt use Private classes?

    In short: to retain backward binary compatibility and still be able to introduce new features.

    For longer answer check the links in this article.

  4. The following 2 users say thank you to jacek for this useful post:

    hyling (12th December 2006), No-Nonsense (14th December 2006)

  5. #3
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Why does Qt use Private classes?

    Slightly longer answer: to keep implementation details out of the API. A good example that Qt end users frequently run across are *.ui files. They create a Designer UI class for their layout, but don't want it in their API. So they create a "d-pointer" to the private implementation. Thus, one includes only "mydialog.h", and not "ui_mydialog.h" as well.

    For additional info, see http://en.wikipedia.org/wiki/Opaque_pointer

  6. The following user says thank you to Brandybuck for this useful post:

    hyling (15th December 2006)

Similar Threads

  1. [custom widget] What about private headers ?
    By lauranger in forum Qt Programming
    Replies: 3
    Last Post: 19th November 2006, 00:14
  2. How to search a string in xml file with Qt Dom classes
    By doganay44 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2006, 21:16
  3. We'll need a QT Jambi section!
    By GreyGeek in forum General Discussion
    Replies: 23
    Last Post: 30th September 2006, 01:38
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 23:04
  5. Replies: 2
    Last Post: 4th May 2006, 20:17

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.