Results 1 to 2 of 2

Thread: Qt Source Macros

  1. #1
    Join Date
    Jan 2006
    Thanked 1 Time in 1 Post
    Qt products
    Unix/X11 Windows

    Default Qt Source Macros

    In the Qt GUI sources, what do the macros like Q_D & Q_Q do?

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Unix/X11 Windows

    Default Re: Qt Source Macros

    Qt Code:
    1. #define Q_D(Class) Class##Private * const d = d_func()
    2. #define Q_Q(Class) Class * const q = q_func()
    To copy to clipboard, switch view to plain text mode 
    First one obtains a "d-pointer" that points to the private part of the implementation.
    From "Data Sharing with Class" by Jasmin Blanchette
    The term "d-pointer" was coined by Arnt Gulbrandsen and later adopted by Qt and KDE programmers. It is called "Pimpl" (Pointer to implementation) in the book Exceptional C++, and "Cheshire Cat" in Design Patterns.
    The second one obtains a pointer to the public part of the implemention.

Similar Threads

  1. problem in installing qt4.4.3 source
    By wagmare in forum Qt-based Software
    Replies: 0
    Last Post: 18th February 2009, 06:48
  2. An Editor for source view - help
    By QuTe in forum Newbie
    Replies: 2
    Last Post: 19th November 2008, 07:11
  3. Source code in qt-win-eval
    By Max Yaffe in forum Newbie
    Replies: 3
    Last Post: 12th April 2007, 14:17
  4. out of source qtopiamake???
    By izico in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 20th March 2007, 18:31
  5. Replies: 11
    Last Post: 24th March 2006, 06:40


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.