Skip to content

[问题] qtreeview + qfilesystemmodel + QSortFilterProxyModel 异常不报错. #108

@625781186

Description

@625781186

Environment : / 环境

  • OS: [e.g. Win 10]
  • Python [e.g. 3.6.4 X64]
  • PyQt5 [e.g. 5.10.1]

描述:

qtreeview + qfilesystemmodel + QSortFilterProxyModel 实现过滤效果 。
但是当我把qtreeview实例.enpandAll() 之后 ,
调用QSortFilterProxyModel实例的.maptoSource() 或者 .hasChildren() 都会崩溃 .
后来测试qtreeview的.hasChildren() 也会.
而且不抛异常 , 是这个错误
Windows fatal exception: access violation
(遇见过很多次了 ,一直不知道是啥意思 , 好像是内存啥的.)

没找到什么特别有效的办法 , 有个比较偏门的办法 .

解决办法 :

重新实例一个 QSortFilterProxyModel ,
旧的用来视图展示 ,
这个来获取数据,
因为这2个ProxyModel的sourcemodel都是qfilesystemmodel ,
所以数据都是一样的.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions