小工具知识网

当前位置: 首页 > 行业知识 > 【QML】QML StackView: pop: unknown argument: QQmlComponent(0x4e912e0)报错,pop(item)

行业知识

【QML】QML StackView: pop: unknown argument: QQmlComponent(0x4e912e0)报错,pop(item)

2026-11-12 18:37:52 来源:互联网转载

1. 问题

Qtindex.php/tags-41973.html" >���本: Qt 5.15.2

()
Item pop(item, operation)

StackView的pop(item, operation)方法,当带参数item的时候会报错:

QML StackView: pop: unknown argument: QQmlComponent(0x4e912e0)

2. 问题代码

_mStackView.pop(_mLoginPage) //_mLoginPage是Component的id

3. 解决方法

_mStackView.pop(_mStackView.get(1))//1是页面的index

4. 总结

pop(item, operation)中的item不能是组件的id,必须是StackView已经压栈的通过get(index, behavior)返回的item,这一点与push(item, properties, operation)和replace(target, item, properties, operation) 中item的含义不同。

()

上一篇:远程关掉服务器怎么关闭?

下一篇:方舟怎么租赁服务器?