Hello, could someone tell me how to block signal for QTableWidget?<br><br>I have a class called CustomTable. CustomTable inherents QTableWidget. I hope to block the signal of CustomTable when I load data into it. <br><br>I first used the following line to create a CustomTable object, called, self.table. <br>
self.table = CustomTable(self.ProjectName,self.header)<br><br>Then I tried <br> self.table.blockSignal(True)<br>or <br> self.table.BlockSignals()<br>Both of them do not work. <br><br>The error says:<br>
AttributeError: 'CustomTable' object has no attribute 'blockSignal'<br><br>How could I call the inherented blockSignal? Thanks. <br><br>Below is my CustomTable code.<br><br><br><br>class CustomTable(QTableWidget):<br>
def __init__(self,ProjectName,header,*args):<br> QTableWidget.__init__(self,*args)<br><br> self.setColumnHidden(0,True)<br> self.header=header<br> self.ProjectName=ProjectName<br> self.dbFilename=self.ProjectName+'.db'<br>
self.__initActions__()<br> self.__initContextMenus__()<br><br> def BlockSignals(self):<br> self.blockSignal(True)<br> <br> def EmitSignals(self):<br> self.blockSignal(False)<br><br>
def __initContextMenus__(self):<br> self.setContextMenuPolicy(Qt.CustomContextMenu)<br> self.connect(self, SIGNAL("customContextMenuRequested(QPoint)"), self.tableWidgetContext)<br> self.connect(self, SIGNAL('cellChanged(int, int)'), self.onCellChanged)<br>
<br><br><br clear="all">---------------------------<br>He Jibo<br>Department of Psychology,<br>Beckman Institute for Advanced Science and Technology<br>University of Illinois, Urbana Champaign,<br>603 East Daniel St.,<br>
Champaign, IL 61820<br>website: <a href="http://www.hejibo.info">www.hejibo.info</a><br><br>