我希望ParticleSystem能够胜过所有QML。但是一些QML项目似乎不是正常z排序的一部分。与下面的示例一样,PopUp始终位于particleSystem的顶部。
获取帮助和建议
[10:50:45] I/launcher - Running 1 instances of WebDriver
[10:50:45] I/hosted - Using the selenium server at http://localhost:4723/wd/hub
[10:51:19] E/runner - Unable to start a WebDriver session.
[10:51:22] E/launcher - Error: WebDriverError: Not implemented yet for script.
at Object.checkLegacyResponse (C:\Users\JWA\Documents\Projekte\MAPP\mapp-app\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\JWA\Documents\Projekte\MAPP\mapp-app\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\JWA\Documents\Projekte\MAPP\mapp-app\node_modules\selenium-webdriver\lib\http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
[10:51:22] E/launcher - Process exited with error code 100
答案 0 :(得分:0)
只需使用Item
代替Popup
这很容易......
或者你可以制作第二个粒子系统,然后让它与第一个粒子系统或某种控制器进行通信,控制器指示它制作什么粒子以及在哪里制作它们......然后让Popup拥有自己的粒子在它下面复制的系统,所以看起来你有弹出窗口上方的粒子,但实际上,它们将停在Popup的边缘并继续在它下面
ParticleController {
id: ctrl
signal createEmitter(width, size, height, etc, etc)
}
Rectangle {
id: mainArea
ParticleSystem {
id: sys1
onCompleted: {
ctrl.createEmitter.connect(sys1.createEmitter)
}
function createEmitter(size, width, height, rate, etc, etc) {
sys1.createQmlObject(/* etc etc */)
}
}
}
Popup {
contentItem: Rectangle {
ParticleSystem {
id: sys2
onCompleted: {
ctrl.createEmitter.connect(sys2.createEmitter)
}
function createEmitter(size, width, height, rate, etc, etc) {
var obj = sys2.createQmlObject( /* etc etc */)
obj.x = mapToItem(sys1, x, y).x
/* etc etc */
}
}
}
}
答案 1 :(得分:0)
因为App有几十个Dialogs / PopUps,而且Particles应该 也可以在PopUp关闭后绘制
使用QML States
ApplicationWindow {
id: mainWindow
visible: true
Row {
Button {
text: "popUp1"
onClicked: popUp1.open();
}
Button {
text: "popUp2"
onClicked: popUp2.open();
}
}
Popup {
id: popUp1
x: ( mainWindow.width - width ) / 2
y: ( mainWindow.height - height ) / 2
width: mainWindow.width * 0.8
height: mainWindow.height * 0.8
modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
}
Popup {
id: popUp2
x: ( mainWindow.width - width ) / 2
y: ( mainWindow.height - height ) / 2
width: mainWindow.width * 0.8
height: mainWindow.height * 0.8
modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
}
ParticleSystem {
id: particleSystem
states: [
State {
when: popUp1.visible
ParentChange{ target: particleSystem; parent: popUp1.contentItem;}
},
State {
when: popUp2.visible
ParentChange{ target: particleSystem; parent: popUp2.contentItem;}
}
]
anchors.fill: parent
ImageParticle {
source: "flower.png"
}
Attractor {
pointX: mainWindow.width / 2
pointY: 0
strength: 1000
affectedParameter: Attractor.Velocity
proportionalToDistance: Attractor.Constant
}
Emitter {
x: mainWindow.width / 2
y: mainWindow.height
lifeSpan: 3000
velocity: AngleDirection { angleVariation: 180; magnitude: 100 }
}
}
}