【发布时间】:2017-05-24 18:07:42
【问题描述】:
在下面的代码中,我想使用透明矩形隐藏图像。请给我一些解决方案。我使用了 z 值,但它不起作用。图像仍然可见。
main.qml
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Image
{
id:underlyingImage
width: 400
height: 400
x:0;
y:0;
source:"qrc:/Jellyfish.jpg"
z:1
}
Rectangle
{
id:hiding_rect
width: 400
height: 400
x:0;
y:0;
color:"transparent"
z:100
}
}
【问题讨论】:
-
由于矩形是透明的,所以会看到下图。我想你想看看这个区域的图像背后是什么,但你最好解释一下。我认为这很难实现。
-
其实我想通过剪裁部分隐藏图像。