The MaskedItem element allows you to compose an Item with an alpha mask. More...
Inherits Item
The MaskedItem element reveals portion of your picture or item by composing this item with a mask element. The mask element will be used as an alpha mask.
The following example shows how to apply an alpha mask in a rectangle.
MaskedItem { width: 100 height: 100 mask: Image { source: "mask.png" } Rectangle { anchors.fill: parent color: "red" } }
Internally MaskedItem needs to cache their children in a pixmap in order to compose the final result with the mask. So, some cautions are needed while using this item:
1. MaskedItem is clipped by default. It's recommended to not set clip to false, since this may lead to high memory consumption depending on the children geometries; behind the scenes, a pixmap with the size of the final bounding rect is needed. So clipping guarantees that this final bounding rect will not be greater than the element itself.
2. Avoid resizing the MaskedItem element in animations. When the element is resized a new pixmap is created according to the new size, and this will have performance impact. You can resize the children though, if clip is not changed.
3. Try to minimize children updates (like child resize, move, ...), this will reduce cache repaints. You can change mask item size with no additional cost though.
1. Currently just the mask element contents is used to create the alpha mask. So do not place any children inside its declaration, as they will not be used.
mask : Component |
The mask item defines the image of the masking effect applied over the children. Only the root item of the mask component will be painted to create the mask.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.