Skip to content

Coding style and convention

Alexander Akulich edited this page Sep 19, 2020 · 7 revisions

Coding Style

The general rule is to follow the KDE Frameworks Codings Style.

Other rules in this document extends and supersides Qt and KDE styling guides.

Line Breaks

Try to keep lines shorter than 100 characters, inserting line breaks as necessary.

  • Consider 100 as the hard limit for header files
  • Consider 120 as the hard limit for source files

Coding Convention

  • Prefer QLatin1String over QStringLiteral for error messages without arguments (optimize the memory footprint instead of the performance of error code paths)

QML Coding Convention

In addition to the official QML Coding Convention:

  • Object id names should end with an underscore.

CMake Coding Convention

  • Leave no space between the command and its opening parenthesis
  • 4 spaces are used for indentation
  • Tabs are not allowed
  • Always use lower-case for commands

Git-related conventions

Follow the seven rules by Chris Beams.

Clone this wiki locally