Skip to content

Commit 2ba86bf

Browse files
committed
readme: minor updates to OUR_QML_STYLE_GUIDELINES.md
1 parent 2fe4b5a commit 2ba86bf

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

OUR_QML_STYLE_GUIDELINES.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,21 @@ width, anchors, x, y} at the outermost scope/braces!
8585
Item { // THIS CODE SNIPPET USES A *BAD* PATTERN
8686
id: root
8787
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.
8989
```
9090

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).
9393

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
95103
clearly label it with a comment:
96104

97105
```
@@ -206,7 +214,8 @@ Item {
206214

207215
Extra help:
208216

209-
- https://doc.qt.io/qt-5/qtquick-layouts-example.html
217+
- https://doc.qt.io/qt-6/qtquick-layouts-example.html
218+
- https://doc.qt.io/qt-6/qtquick-responsivelayouts-example.html
210219
- https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/layouts
211220

212221
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)