<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Le 24/06/10 15:24, He Jibo a &eacute;crit&nbsp;:
<blockquote
 cite="mid:AANLkTinoI7sPTPe87fJb9K-0kh8e7qsnZ3rylwTsKsHb@mail.gmail.com"
 type="cite">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&nbsp; the following line to create a CustomTable object,
called, self.table.&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.table = CustomTable(self.ProjectName,self.header)<br>
  <br>
Then I tried <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.table.blockSignal(True)<br>
or <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp; def __init__(self,ProjectName,header,*args):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QTableWidget.__init__(self,*args)<br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setColumnHidden(0,True)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.header=header<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.ProjectName=ProjectName<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.dbFilename=self.ProjectName+'.db'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.__initActions__()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.__initContextMenus__()<br>
  <br>
&nbsp;&nbsp;&nbsp; def BlockSignals(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.blockSignal(True)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; def EmitSignals(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.blockSignal(False)<br>
  <br>
&nbsp;&nbsp;&nbsp; def __initContextMenus__(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setContextMenuPolicy(Qt.CustomContextMenu)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.connect(self,
SIGNAL("customContextMenuRequested(QPoint)"), self.tableWidgetContext)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 moz-do-not-send="true" href="http://www.hejibo.info">www.hejibo.info</a><br>
  <br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
Hi,<br>
<br>
Try :&nbsp; blockSignals(bool)<br>
<br>
<div class="moz-signature">-- <br>
Vincent V.V.<br>
<a href="https://launchpad.net/oqapy">Oqapy</a></div>
</body>
</html>