customcompleter.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:examples 作者: pyqt 项目源码 文件源码
def modelFromFile(self, fileName):
        f = QFile(fileName)
        if not f.open(QFile.ReadOnly):
            return QStringListModel(self.completer)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        words = []
        while not f.atEnd():
            line = f.readLine().trimmed()
            if line.length() != 0:
                try:
                    line = str(line, encoding='ascii')
                except TypeError:
                    line = str(line)

                words.append(line)

        QApplication.restoreOverrideCursor()

        return QStringListModel(words, self.completer)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号