当前位置: 动力学知识库 > 问答 > 编程问答 >

python - validate loaded data in QTableView

问题描述:

I got a MVC sytle PyQT UI program, and already got delegates binded to certain column for whatever date or regex validation, when insert manually, everything goes fine, the limits holds on

class IPDelegate(QStyledItemDelegate):

def createEditor(self, parent, option, index):

line_edit.setValidator(regex_ip)

but for loaded data, which I insert by

self.model.appendColumn(

[

QStandardItem(column_value)

for column_value in loaded_line

])

such validation only happens when I manually double click inside some table cell,are their any way to check its value automatically? my idea is to loop get focus of each cell, and simulate the 'press enter' operation, to trigger the check, but did not find any similar APIs

any suggestion?

Thanks, Jack

网友答案:

solved by myself, did not use the misery mvc module, turn all data validation to a set of regex, loop over at both set delegate and raw regex validation

分享给朋友:
您可能感兴趣的文章:
随机阅读: