Skip to content

编码风格 ​

The canonical style guide is CODING_STYLE.md in the source tree. 高级样式信息:

  • Indent with 4 spaces (no tabs); lines are at most 120 columns.
  • PascalCase class names, camelCase methods and variables, _leadingUnderscore private members.
  • C++20 and Qt 6 idioms: always null-check Vehicle*/activeVehicle(), use categorized logging (qCDebug/qCWarning), and no Q_ASSERT in production code.
  • QML uses QGC controls, ScreenTools sizes and QGCPalette colors instead of hardcoded values, and wraps user-visible strings in qsTr().

The style itself is demonstrated in the following example files:

Formatting and linting are enforced by pre-commit hooks (clang-format, qmllint, and QGC-specific checks); run just lint before you push. Only format the lines you change: whole-file reformatting of existing files creates unrelated diffs that make pull requests harder to review.