[Qt-interest] Best container for QObjects in 3.3 considering future port to 4.x

Chris chris1.noreply at googlemail.com
Fri Jan 23 12:41:25 CET 2009


Hi,

I'm working on a legacy application based on QT3.3 but I'm considering
porting to QT4 in the future so I'm trying to follow the guidelines in
the porting document. I need to handle a collection of pointers to
QObjects but I can't figure out what type of collection to use. I was
going to use a QPtrVector but the porting document says to use a
QValueVector of pointers instead. But then the documentation for
QValueVector and all other QT Template Library classes says:

"Some classes cannot be used within a QValueVector: for example, all
classes derived from QObject and thus all classes that implement
widgets. Only values can be used in a QValueVector."

Any ideas on how I can best create a container for pointers to
QObjects, bearing in mind I want to migrate to Qt4 in future?

Thanks, Chris.



More information about the Qt-interest-old mailing list