带指针的分段错误11

时间:2016-11-06 22:02:28

标签: c arrays

为什么当尝试使用函数NI得到一个分段错误11 ..我对malloc新的所以我不知道在哪里寻找我的错误..我试图从文件中读取并通过fscanf将某些行放到我的双阵列..

class FileSystemModel(QtGui.QFileSystemModel):
    def __init__(self, *args, **kwargs):
        super(FileSystemModel, self).__init__(*args, **kwargs)
        self.condition = None

    def setCondition(self, condition):
        self.condition = condition
        self.dataChanged.emit(QtCore.QModelIndex(), QtCore.QModelIndex())

    def data(self, index, role=QtCore.Qt.DisplayRole):
        if self.condition and role == QtCore.Qt.TextColorRole:
            text = index.data(QtCore.Qt.DisplayRole)
            if self.condition in text:
                return QtGui.QColor("#58cd1c")
        return super(FileSystemModel, self).data(index, role)

class MainWidget(QtGui.QWidget):
    def __init__(self, parent=None, useDelegate = False):
        super(MainWidget, self).__init__(parent)
        ...
        self.FileModel = FileSystemModel(self)
        ...

    def changeCondition(self, text):
        self.FileModel.setCondition(text)

0 个答案:

没有答案