diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-18 15:47:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-06 12:11:03 +0100 |
commit | b5a6b4c938660d0cd6eae8a8b36b43b1795d584d (patch) | |
tree | 3337a5d33462bf7b763dc46374c6b0f6adbc5d9f /examples/quick/imageelements/image.qml | |
parent | 461ecc535ad203f7c11b1898a16053aebf50cfc1 (diff) |
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>
Diffstat (limited to 'examples/quick/imageelements/image.qml')
-rw-r--r-- | examples/quick/imageelements/image.qml | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/examples/quick/imageelements/image.qml b/examples/quick/imageelements/image.qml index d414f59629..0750ea3b79 100644 --- a/examples/quick/imageelements/image.qml +++ b/examples/quick/imageelements/image.qml @@ -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" + } } } |