【发布时间】:2013-11-22 15:59:04
【问题描述】:
我不知道为什么或如何发生,但 Z 顺序完全搞砸了。这是显示我的问题的最小示例。测试机器在 Windows 8 x64,Qt 5.1 上运行。
import QtQuick 2.0
Item {
id: root;
width: 800;
height: 800;
Background {
id: background;
anchors.fill: root;
imageSource: "backgrounds/1.jpg";
}
MainView {
id: mainView;
anchors.fill: root;
}
BottomBar {
id: bottomBar;
anchors.bottom: root.bottom;
anchors.left: root.left;
anchors.right: root.right;
height: 75;
}
这是背景:
import QtQuick 2.0
import QtGraphicalEffects 1.0
Item {
id: root;
property alias imageSource: imageItem.source;
Image {
id: imageItem;
anchors.fill: root;
fillMode: Image.PreserveAspectCrop;
visible: false;
}
GaussianBlur {
anchors.fill: root;
source: imageItem;
radius: 12;
samples: 12;
deviation: 5;
cached: true;
}
}
主视图:
import QtQuick 2.0
Item {
id: root;
Rectangle {
anchors.centerIn: root;
width: 500;
height: 500;
color: "red";
}
}
和底部栏:
import QtQuick 2.0
Item {
id: root;
Rectangle {
anchors.fill: root;
color: Qt.rgba(.07, .07, .07, .95);
}
应该是红色正方形,以 1.jpg 的中间为中心,底部有一条 75px 的高度线,但看不到正方形。
但是如果我删除背景元素,一切都很好。
提前感谢您的帮助。
【问题讨论】: