Skip to content

QML Naming conventions and file structure

mobile-bungalow edited this page Aug 28, 2019 · 2 revisions

Keeping QML Clean


There are three rules to follow when adding Elements or new files to the QML codebase.

  1. Group Subelements into directories with the same name as their parent.

for example SideBar has ConfigBar, ContactView, and SearchBar elements. the hierarchy should look like

├── /
├── Main.qml
├── SideBar.qml
├── SideBar/
│   ├── SearchBar.qml
│   ├── ConfigBar.qml
│   └── ChatView.qml
  1. Keep qml as declarative as possible. JS written by us should be kept to an absolute minimum.

    Try to move complex sub-elements into their own file, and make them work as independently as possible from their parent.

  2. Element ID convention is Component Type Element

    You can omit the element if component and type make the purpose self explanatory or shorter

Clone this wiki locally