【发布时间】:2019-11-29 00:08:58
【问题描述】:
我正在尝试将https://doc.qt.io/qt-5/model-view-programming.html#using-model-indexes 中的以下 C++ 示例转换为 Python:
C++:
QFileSystemModel *model = new QFileSystemModel;
QModelIndex parentIndex = model->index(QDir::currentPath());
int numRows = model->rowCount(parentIndex);
Python:
import os
from PySide2.QtWidgets import *
model = QFileSystemModel()
parent_index = model.index(os.getcwd())
nb_row = model.rowCount(parent_index)
print(nb_row)
但我的程序因退出代码而崩溃:
Process finished with exit code -1073741819 (0xC0000005)
【问题讨论】:
标签: python indexing pyside2 qfilesystemmodel