1 控件变量命名实例
以下控件命名方法来自与Qt5.2.1版本的教程“application”
QMenu *fileMenu;
QToolBar *fileToolBar;
QAction *newAct;
QString curFile;
QPlainTextEdit *textEdit;
总结:一般在命名后面说明控件的类型,但是QString是个例外。
以下是Qt5.2.1示例“completer”的命名
QComboBox *caseCombo;
QSpinBox *maxVisibleSpinBox;
QCheckBox *wrapCheckBox;
QCompleter *completer;
QLabel *contentsLabel;
QLineEdit *lineEdit;
以下是Qt5.2.1实例“extension”的命名
QLabel *label;
QCheckBox *caseCheckBox;
QDialogButtonBox *buttonBox;
QPushButton *findButton;
以下是Qt5.2.1实例“Fortune Client”的命名
QLineEdit *portLineEdit;
参考资料
[1]Qt风格的编程规范
[2]C/C++命名规则