tags:

views:

1207

answers:

2

I am interested in learning Qt. I am fairly good with C++, STL and Boost. I like STL/Boost style very much, and I use them with C++ whenever I can in uni projects. However, I always miss the GUI. It seems that Qt is the best solution in my case. Qt does have a good collection of containers, but I am greatly familiar with STL/Boost stuff.

What should I take care of when learning Qt and using it side by side with STL/Boost?

+19  A: 

Yes, Qt works just fine with both Boost and the STL. Most of the STL functionality is duplicated in Qt to ensure that such features are supported on all of the platforms that support Qt. However, nothing prohibits you from using STL/boost counterparts of the Qt constructs or functionality therein that Qt lacks.

Although Qt has its own string, container and algorithm objects, it also contains a great deal of functions for compatability with STL. For example, a QString can be converted to a std::string and a QVector can be used with std::for_each. Qt also contains some features that overlap with boost such as QPointer (compare/contrast with std:auto_ptr and boost:shared_ptr).

The Creating Custom Qt Types article may provide some insight into using advanced features with boost objects such as transmitting custom objects between threads with queued connections.

See also:

Judge Maygarden
+6  A: 

Qt does work fairly well alongside STL, although like any framework they've had to replace some STL structures out of necessity (the only one you'll find yourself forced to use is string/unicode). Everything from Boost works great - in fact it's a great pair of toolkits to use together, but you'll need to be careful with boost::signals, since Qt also has a signals implementation and the names can overlap. Boost covers this in an FAQ and there's some info on the trolltech site as well for how to avoid the problem.

Nick Bastin
Qt documentation also addresses the signal/slots problem here: http://doc.trolltech.com/4.5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots
Judge Maygarden