ListView in subwindow triggers immediate close, or whilst scrolling

前端 未结 1 653
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 17:36

I have rather strange scenario whereby if I launch a subwindow that contains a ListView with a moderately complex delegate and enough items to comfortably exceed th

相关标签:
1条回答
  • 2021-01-25 18:15

    As noted by @BaCaRoZzo the changing of behaviour by modifying the delegate code seems to be an unrelated side-issue.

    The real cause is because it turns out you cannot create new root contexts (i.e. top-level windows) from QML. This was hinted at being resolved when Qt Quick Components were released, but the blog post boasting of Window doesn't explicitly state this. Creating a new Window and passing null for the parent technically works but the result seems to be very unstable.

    Thankfully in my circumstance I'm creating a QML/C++ application so I've solved the issue by creating new root contexts from Q_INVOKABLE methods on the C++ side. But if you're developing a pure QML application, it seems that you are out of luck.

    0 讨论(0)
提交回复
热议问题