Avoid access to properties of parent in imagelements example
ImageCell's parent is not guaranteed to have these properties. Therefore, rather pass them from the outside. Change-Id: Ib42d1b9087d8757633b14c3a25cb638abb70fb21 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
461ecc535a
commit
b5a6b4c938
|
@ -53,8 +53,6 @@ Item {
|
|||
property alias mode: image.fillMode
|
||||
property alias caption: captionItem.text
|
||||
|
||||
width: parent.cellWidth; height: parent.cellHeight
|
||||
|
||||
Image {
|
||||
id: image
|
||||
width: parent.width; height: parent.height - captionItem.height
|
||||
|
|
|
@ -65,12 +65,34 @@ Rectangle {
|
|||
rows: 3
|
||||
spacing: 30
|
||||
|
||||
ImageCell { mode: Image.Stretch; caption: "Stretch" }
|
||||
ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" }
|
||||
ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" }
|
||||
component SizedImageCell: ImageCell {
|
||||
width: parent.cellWidth
|
||||
height: parent.cellHeight
|
||||
}
|
||||
|
||||
ImageCell { mode: Image.Tile; caption: "Tile" }
|
||||
ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" }
|
||||
ImageCell { mode: Image.TileVertically; caption: "TileVertically" }
|
||||
SizedImageCell {
|
||||
mode: Image.Stretch
|
||||
caption: "Stretch"
|
||||
}
|
||||
SizedImageCell {
|
||||
mode: Image.PreserveAspectFit
|
||||
caption: "PreserveAspectFit"
|
||||
}
|
||||
SizedImageCell {
|
||||
mode: Image.PreserveAspectCrop
|
||||
caption: "PreserveAspectCrop"
|
||||
}
|
||||
SizedImageCell {
|
||||
mode: Image.Tile
|
||||
caption: "Tile"
|
||||
}
|
||||
SizedImageCell {
|
||||
mode: Image.TileHorizontally
|
||||
caption: "TileHorizontally"
|
||||
}
|
||||
SizedImageCell {
|
||||
mode: Image.TileVertically
|
||||
caption: "TileVertically"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue