- 1、本文档共17页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Qt编程习惯(国外英文资料)
Qt编程习惯(国外英文资料)
Qt programming practice
/wiki/Coding_Conventions
Wd007 XChinux
Trial school: qi liang
C + + feature
Dont use exceptions
Dont use rtti (runtime type recognition; mainly, the typeinfo structure, dynamic or typeid operator, including throwing exceptions, etc.)
The use of the template class is carefully used only when required, not just because you have mastered the method.
Tip: use the compilers automated test capability to determine whether a c + + feature is supported.
The practice of writing the Qt source code
All of the code is only in ASCII (seven characters, if youre not sure, run man ASCII)
Principle: we already have too many new languages and the unrobust systems of utf-8 and Latin1. When you use a system that is more than 127 in a favorite editor, the system breaks down before you can save it.
Low for string: use/NNN (NNN is octal character here, you should input in any system can represent the characters) or use the/XNN (XNN here is hexadecimal characters).
For example:
reference
QString s = QString: : fromUtf8 ( / 213/005 );
For metaphones in documents, or other non-ascii characters, or using qdocs unicode command or using the appropriate macros; Example: use/uuml for u.
All subclasses of QObject must contain a Q_OBJECT macro, even if it does not use a signal or a slot, otherwise the qobject_cast will fail.
S in the connection statement, the parameters in the normalized signals and slots (can see QMetaObject: : normalizedSignature for standardization of information) to make a fast signal/slot traversal. You can also standardize existing code using $QTDIR/util/normalize
Contains the header file
In the common header file, the header file contains the form that is always used:
reference
# include QtCore/q.h
For the Mac OS X system framework, a library prefix such as QtCore is required, which is also very convenient for non-qmake projects
In the source file, it contains a specific header file and contains the usual header files (such as system fi
文档评论(0)