PDA

View Full Version : STL or Qt



pkirk25
16th November 2006, 21:29
Hi all,

Just got Qt and I see that there are loads of classes like QString and QFile. I only need a GUI to read a file created by a console application written in C++ with STL. The GUI calls the executable with a system("query_db.exe") and then reads the file and shows it contents in a spreadsheet.

Would I be better off to learn the QString and QFile classes or to stick with the STL ones I am familiar with?

wysota
16th November 2006, 21:33
It really depends on what you like. Qt is STL compatible, but you might want to get rid of STL dependency in favour of using Qt classes which in many cases are much faster than their STL counterparts.

BTW. You might want to replace the "system()" call with QProcess. Using system() will cause your GUI to be irresponsive during the life of that child process. Using QProcess you can avoid that.

pkirk25
16th November 2006, 21:42
I think you are right and learning the Qt framework and mindset makes sense. No point in fighting against your own toolkit when you chose it because its nice ;-)

Thanks for the performance tip as well.

sunil.thaha
17th November 2006, 06:13
in many cases are much faster than their STL counterparts.

Such as. or Could you point me to some links, where is it mentioned ?

jpn
17th November 2006, 07:26
Generic Containers (http://doc.trolltech.com/4.2/containers.html)


These container classes are designed to be lighter, safer, and easier to use than the STL containers. If you are unfamiliar with the STL, or prefer to do things the "Qt way", you can use these classes instead of the STL classes.

The container classes are implicitly shared, they are reentrant, and they are optimized for speed, low memory consumption, and minimal inline code expansion, resulting in smaller executables.

wysota
17th November 2006, 09:51
http://blogs.qtdeveloper.net/archives/2006/10/16/atomic-reference-counting-is-it-worth-it-2/