Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
Description
This code contains a simple mistake that is not obvious to many:
import QtQuick import QtQuick.Layouts Window { width: 640 height: 480 visible: true ColumnLayout { width: 50 height: 50 Image { width: 50 height: 50 sourceSize.width: 100 sourceSize.height: 100 source: "circle.svg" } } }
The resulting image will be 100x100, even though the layout's width and height are equal to the Image's specified width and height.
It would be good for tooling to point out that width/height are ignored, and suggest using Layout.preferredWidth/Layout.preferredHeight instead.
Update
qmllint does provide this warning, but it needs to be manually run as it is currently not integrated with Qt Creator or qmlcachegen/qmlsc. It would be helpful for users to get these warnings at edit-time and/or compile-time.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-17224 Integration of QML Lint in Qt Creator
- Closed
- resulted from
-
QTBUG-109080 Image in ColumnLayout ignores width and height
- Closed