You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OUR_QML_STYLE_GUIDELINES.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,13 +85,21 @@ width, anchors, x, y} at the outermost scope/braces!
85
85
Item { // THIS CODE SNIPPET USES A *BAD* PATTERN
86
86
id: root
87
87
88
-
anchors.fill: parent // NO NO NO NO!! DO NOT PUT THIS IN YOUR ROOT ITEM.
88
+
anchors.fill: parent // NO NO!! (In general) DO NOT PUT THIS IN YOUR ROOT ITEM.
89
89
```
90
90
91
-
Those types of sizing decisions should ALWAYS be left up to the user (aka at the
92
-
instantiation site).
91
+
Those types of sizing and position decisions should virtually always be left up
92
+
to the user (aka at the instantiation site).
93
93
94
-
However, for ease-of-use with `qmlscene`, we allow an exception, but remember to
94
+
Don't configure size, anchors, position internally. Let outer/external "user
95
+
code" do that work, except:
96
+
97
+
- If your design is indeed built around the idea that a certain button type (or other element) really is in charge of its own size...
98
+
- ... and especially if you use a lot of them and don't want to repeat size/position at each usage site
99
+
- then you probably have a good case for internal/inherent size.
100
+
- In this case, please use named constants for any sizes or proportions. Don't use "magic number" literals. See also: https://github.com/219-design/qt-qml-project-template-with-ci/blob/main/OUR_QML_STYLE_GUIDELINES.md#themes
101
+
102
+
Also, for ease-of-use with `qmlscene`, we allow an exception, but remember to
0 commit comments