Results 1 to 12 of 12

Thread: Design Patterns in Qt

  1. #1
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Design Patterns in Qt

    Lately I have been learning some Design Patterns. And I was wondering where all its used in Qt.

    For example,
    1. Observer Pattern in Signals and Slots.
    2. Iterator in QList.

    Could anyone tell me about other patterns.
    The Keyboard Is Mightier Than The Sword!

  2. #2
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Design Patterns in Qt

    Not really sure about the observer, but i just finished reading up on iterators for QList...

    QList has an STL-style iterator, accessible like so:

    Qt Code:
    1. QList<Type> list; //the list
    2.  
    3. QList<Type>::iterator i;
    4. for (i = list.begin(); i != list.end(); i++)
    5. Type item = *i;
    To copy to clipboard, switch view to plain text mode 

    There is also a QListIterator-class which is more Java-style...like so:

    Qt Code:
    1. QList<Type> list; //the list
    2. QListIterator<Type> i(list);
    3. while (i.hasNext()){
    4. Type item = i.next();
    5. }
    To copy to clipboard, switch view to plain text mode 


  3. #3
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Design Patterns in Qt

    All of Interview is written using the Model - View pattern. There are quite a few patterns out there and signals/slots makes it easy to interconnect Qt classes according to different patterns with minimal fuzz.

  4. #4
    Join Date
    Feb 2006
    Location
    US
    Posts
    173
    Thanks
    16
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Design Patterns in Qt

    Quote Originally Posted by bits
    Lately I have been learning some Design Patterns. And I was wondering where all its used in Qt.

    For example,
    1. Observer Pattern in Signals and Slots.

    Signals/Slots is more of a Publish/Subscribe pattern ... using an intermediary ... such that there is no coupling between the sender and receiver. The Observer pattern requires the sender and receiver to know more about each other.

  5. The following user says thank you to brcain for this useful post:

    bits (29th June 2006)

  6. #5
    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: Design Patterns in Qt

    Apropos this topic, there is a new Qt book coming out in September called "An Introduction to Design Patterns in C++ with Qt 4", by Alan and Paul Ezust.

  7. #6
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Design Patterns in Qt

    Quote Originally Posted by brcain
    Signals/Slots is more of a Publish/Subscribe pattern ... using an intermediary ... such that there is no coupling between the sender and receiver. The Observer pattern requires the sender and receiver to know more about each other.
    I couldn't find much information over this Publish/Subscribe pattern.
    Can any one recommend any link where we can find more about this?
    The Keyboard Is Mightier Than The Sword!

  8. #7
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Design Patterns in Qt

    Quote Originally Posted by Brandybuck
    Apropos this topic, there is a new Qt book coming out in September called "An Introduction to Design Patterns in C++ with Qt 4", by Alan and Paul Ezust.
    Thanks for the info. I assume it will be a great book to start with.
    I think that this book will definitely help us make our designs better.
    The Keyboard Is Mightier Than The Sword!

  9. #8
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Design Patterns in Qt

    Quote Originally Posted by bits
    I couldn't find much information over this Publish/Subscribe pattern.
    Can any one recommend any link where we can find more about this?
    http://www.eventhelix.com/RealtimeMa...e_patterns.htm
    We can't solve problems by using the same kind of thinking we used when we created them

  10. The following user says thank you to sunil.thaha for this useful post:

    bits (30th June 2006)

  11. #9
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Design Patterns in Qt

    is the ebook of "Introduction to Design Patterns in C++ with Qt 4" available?

  12. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

  13. #11
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Design Patterns in Qt

    wysota,
    the link you given is a hard copy of book, I dont think that is e-book.

    have any one read "Introduction to Design Patterns in C++ with Qt 4"?
    is this book are really good?
    I read sample chapter 9.

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Design Patterns in Qt

    Oh, I missed the 'e' character in your post You can access parts of the books online, AFAIR, but not all of it.

Similar Threads

  1. Three Tier Database Programming - Design Pattern
    By sunil.thaha in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2011, 04:00
  2. Replies: 10
    Last Post: 2nd December 2010, 07:10
  3. A Design Issue...
    By nupul in forum Qt Programming
    Replies: 6
    Last Post: 4th May 2006, 17:41

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.