PDA

View Full Version : Design Patterns in Qt



bits
20th June 2006, 12:44
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.

TheRonin
20th June 2006, 13:26
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:


QList<Type> list; //the list

QList<Type>::iterator i;
for (i = list.begin(); i != list.end(); i++)
Type item = *i;

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


QList<Type> list; //the list
QListIterator<Type> i(list);
while (i.hasNext()){
Type item = i.next();
}

:D

e8johan
20th June 2006, 13:35
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.

brcain
28th June 2006, 23:23
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.

Brandybuck
29th June 2006, 05:09
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.

bits
29th June 2006, 07:09
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?

bits
29th June 2006, 07:17
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.

sunil.thaha
30th June 2006, 08:03
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/RealtimeMantra/Patterns/publish_subscribe_patterns.htm

rajesh
9th May 2007, 15:10
is the ebook of "Introduction to Design Patterns in C++ with Qt 4" available?

wysota
11th May 2007, 00:28
Yes.

http://www.amazon.com/Introduction-Design-Patterns-Perens-Source/dp/0131879057

rajesh
11th May 2007, 07:06
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.

wysota
11th May 2007, 10:13
Oh, I missed the 'e' character in your post :) You can access parts of the books online, AFAIR, but not all of it.