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 | |
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')
-rw-r--r-- | examples/quick/imageelements/content/ImageCell.qml | 2 | ||||
-rw-r--r-- | examples/quick/imageelements/image.qml | 34 |
2 files changed, 28 insertions, 8 deletions
diff --git a/examples/quick/imageelements/content/ImageCell.qml b/examples/quick/imageelements/content/ImageCell.qml index 4b147633c3..7804346bd4 100644 --- a/examples/quick/imageelements/content/ImageCell.qml +++ b/examples/quick/imageelements/content/ImageCell.qml @@ -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 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" + } } } |