From 417d82ed74559fcbe921dbabc51495dae43e55ec Mon Sep 17 00:00:00 2001 From: ovari123 Date: Sat, 18 Jan 2025 00:12:49 -0400 Subject: [PATCH] developer/new-developers/qt-qml-coding-style: linkify Change-Id: I3fdd81f7463aa2100aa9192c0b1708934810dcfb --- .../new-developers/qt-qml-coding-style.md | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/developer/new-developers/qt-qml-coding-style.md b/developer/new-developers/qt-qml-coding-style.md index 0f26e1d..b07f724 100644 --- a/developer/new-developers/qt-qml-coding-style.md +++ b/developer/new-developers/qt-qml-coding-style.md @@ -1,10 +1,14 @@ -Qt and QML coding style -======================= +# Qt and QML coding style + + +## Qt/C++ + -## Qt/c++ ### Signal and slot naming Both signals and slots should use camelCase. -A signal should use the simple past tense or past participle of some verb, likely prefixed by a short subject. A corresponding slot should be the signal prefixed with the word "on" and not the word "slot". Here are some examples: +A signal should use the simple past tense or past participle of some verb, likely prefixed by a short subject. +A corresponding slot should be the signal prefixed with the word "on" and not the word "slot". +Here are some examples: ```c // correct signal: @@ -25,14 +29,16 @@ slot: void slotNavigateToHomeView(); ``` ---- + ## QML -## Code formatting -The Qt 5.15.0 version of qmlformat has some issues dealing with comment sections and currently does not discriminate against max columns, so we will continue to format using these guidelines for now. -The following is a comprehensive sample component, adapted from https://doc.qt.io/qt-5/qml-codingconventions.html, that attempts to illustrate the ideally formatted component. + + +### Code formatting +The Qt 5.15.0 version of qmlformat has some issues dealing with comment sections and currently does not discriminate against max columns, so this formatting style will continue to be used in the guidelines. +The following is a comprehensive sample component, adapted from , that attempts to illustrate the ideally formatted component. ```javascript /* - * authored by/copyright ... + * authored by/copyright … */ // Id always on the first line, and always present and called root @@ -45,11 +51,11 @@ Rectangle { id: root // property declarations - property bool thumbnail: false + property bool thumbnail: false property alias image: photoImage.source // signal declarations - signal clicked + signal clicked // javascript functions function doSomething(x) {