-
Notifications
You must be signed in to change notification settings - Fork 58
Coding style and convention
Alexander Akulich edited this page Sep 23, 2020
·
7 revisions
The general rule is to follow the KDE Frameworks Codings Style.
Other rules in this document extends and supersides Qt and KDE styling guides.
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
- Prefer
QLatin1String
overQStringLiteral
for error messages without arguments (optimize the memory footprint instead of the performance oferror
code paths) - Check Qt version with
#if QT_VERSION < QT_VERSION_CHECK(x, y, z)
with the old/legacy code going first and the modern code in#else
.
In addition to the official QML Coding Convention:
- Object
id
names should end with an underscore.
- 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
Follow the seven rules by Chris Beams.