[Qt-interest] Qt coding guidelines/conventions

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Mar 25 13:53:58 CET 2010


Hi All,

Me again.

What coding convention/guidelines do you guys follow while writing your Qt apps?

I come from Java world :) so am familiar with the camel notation.
Other than that I wanted to know if there's a std that ppl usually
follow while writing code.
eg I've seen in Qt, member variables have a "m_" prefixed to
them...something similar is mentioned in the MythTV guidelines which
uses Qt (http://www.mythtv.org/wiki/Coding_Standards)

Also, since I no longer have the luxury of automatic garbage
collection (ah...I miss java! :P) and guidelines on how to protect
yourself from those nefarious memory leaks?

Some helpful stuff I found was using QPointer, which makes the task of
checking for dangling pointers easy.
http://doc.trolltech.com/4.6/qpointer.html
http://doc.trolltech.com/4.6/qobjectcleanuphandler.html

I'm also looking at other 3rd party C++ libs which help in this job.

Any other tips/suggestions?

Thanks,
-mandeep



More information about the Qt-interest-old mailing list