views:

179

answers:

2

A large amount of functionality is duplicated between standard c++ and Qt. At some point it seems logical but many times it looks foolish. Like I feel like doing a new programming language, learning things which I already know. e.g. using QFile.

Also if I do it all Qt way and suppose now I want to move out of Qt framework it will be too much tedious to rewrite that code. OTOH I like Qt because it provides me with libraries which otherwise I would have to fish myself like webkit, database connectivity, dbus etc.

What do you suggest mix standard C++ or do it pure Qt way?

+3  A: 

I do all the collection classes in std:: it's clearer for non Qt developers and more portable.

Strings and stringlists I use the Qt ones inside a purely Qt function that is doing something GUI-ish but otherwise use std::String. Although the Qt .arg() formatting is a lot nicer than stringstream

Martin Beckett
Containers provided with Qt have lighter footprint since they leverage [implicit sharing](http://doc.qt.nokia.com/4.6/implicit-sharing.html), moreover they provide [Java-style iterators](http://doc.qt.nokia.com/4.6/containers.html#java-style-iterators). Thus I'd recommend using them instead of STL ones.
Ihor Kaharlichenko
+5  A: 

As there is no GUI in C++ you should abstract the GUI code from the rest of the real code.

Then within your QT implementation of your GUI abstraction feel free to use QT code.
You will also then be able to write Wx/Quartz GUI abstraction without affecting the real code.

In the real code (were the work is done) stick to standard stuff (or cross platform libs that are nearly standard (boost)). One could argue that QT is cross platform. Just remember that that using a lib here will be tightly coupling your code the lib, thus extracting it latter date will be non trivial. (see the previous question about removing Rouge Wave from a legacy application)

Martin York