Qt6/Example-Guideline: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Created page with "''When creating or updating Qt examples, developer should consider the best practises and guidelines listed in this document. ''")
 
mNo edit summary
Line 1: Line 1:
''When creating or updating Qt examples, developer should consider the best practises and guidelines listed in this document.
''When creating or updating Qt examples, developer should consider the best practises and guidelines listed in this document.
''
''
== Evaluate if the example is meaningful or should it be removed/merged ==
'''MANDATORY'''
* Check if there are similar examples for the same topic and consider if both are really needed or should the other one be merged with the other.
* Check also documentation on the topic and if that includes inline code snippet that would be adequate instead of complete example.
== No C++ or qml warnings ==
'''MANDATORY'''
* Example's C++ code should be by minimum compiled with the same compiler warning flags as Qt.
* Use qmllint for qml code: https://doc-snapshots.qt.io/qt6-dev/qtquick-tool-qmllint.html
* Enable compiler warnings and check if the reported issues are fixable with meaningful effort. 
'''RECOMMENDED'''
Consider also the compilation with the more strict warning flags and fix the found issues.
GCC
* Use -Wall and consider -Wextra parameter: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Clang
* Use -Weverything compiler parameter: https://clang.llvm.org/docs/UsersManual.html#diagnostics-enable-everything
Visual Studio
* Use /Wall compiler parameter: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level

Revision as of 08:53, 17 January 2023

When creating or updating Qt examples, developer should consider the best practises and guidelines listed in this document.

Evaluate if the example is meaningful or should it be removed/merged

MANDATORY

  • Check if there are similar examples for the same topic and consider if both are really needed or should the other one be merged with the other.
  • Check also documentation on the topic and if that includes inline code snippet that would be adequate instead of complete example.

No C++ or qml warnings

MANDATORY

RECOMMENDED Consider also the compilation with the more strict warning flags and fix the found issues.

GCC

Clang

Visual Studio