[英]Stackview calling slots for previous screen
I am implementing stackview in my application. 我在我的应用程序中实现stackview。
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: showfooter.currentIndex
DashboardListView{
id:dashboard
}
Settings{
id:setting
}
Cart{
id:cart
}
}
StackView {
id: stackView
initialItem: Pane {
id: pane
}
}
When i am loading some other screen(like SightDescription.qml) from DashboardListView using push method and cliking somewhere on that screen its calling slots for DashboardListView. 当我使用push方法从DashboardListView加载其他屏幕(例如SightDescription.qml)时,在该屏幕上的某个位置单击DashboardListView的调用槽。 DashboardListView Screen controls are getting onclick signal. DashboardListView屏幕控件正在收到onclick信号。 Is there any setting related to stack view that I need to do, I read stackview's documentation but did not find anything to restrict this behavior. 我需要做一些与堆栈视图相关的设置吗,我阅读了stackview的文档,但没有发现任何限制这种行为的方法。
It seems like the Pane
is usually intercepting the mouse events, so the lower Item
s cannot receive them. 似乎Pane
通常是在拦截鼠标事件,因此较低的Item
无法接收它们。
When you push the new item on the StackView
the Pane
becomes visible: false
and therefore does not care for input anymore. 当您在StackView
上推送新项目时, Pane
将visible: false
,因此不再需要输入。 If the new Item
does not handle the mouse events, they will propagate to the lower Item
. 如果新的Item
不处理鼠标事件,它们将传播到较低的Item
。
To prevent that, you have various options: 为防止这种情况,您可以选择以下几种方法:
Item
s pushed on the StackView
will handle mouse events, eg by making a Pane
or a MouseArea
the root item. 确保在StackView
上推送的所有Item
StackView
将处理鼠标事件,例如通过将Pane
或MouseArea
为根项目。 MouseArea
directly below the StackView
that is only enabled when there are Item
s on the StackView
将MouseArea
放在StackView
正下方,仅当StackView
上有Item
时才启用 EventFilter
s in C++ etc but I think 1 and 2 should be suffice and be easy to implement. 还有更多...例如在C ++中安装EventFilter
,但我认为1和2应该足够并且易于实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.