[PyQt] [Help] blockSignal for QTableWidget

He Jibo hejibo at gmail.com
Thu Jun 24 14:24:06 BST 2010


Hello, could someone tell me how to block signal for QTableWidget?

I have a class called CustomTable. CustomTable inherents QTableWidget. I
hope to block the signal of CustomTable when I load data into it.

I first used  the following line to create a CustomTable object, called,
self.table.
      self.table = CustomTable(self.ProjectName,self.header)

Then I tried
        self.table.blockSignal(True)
or
        self.table.BlockSignals()
Both of them do not work.

The error says:
AttributeError: 'CustomTable' object has no attribute 'blockSignal'

How could I call the inherented blockSignal? Thanks.

Below is my CustomTable code.



class CustomTable(QTableWidget):
    def __init__(self,ProjectName,header,*args):
        QTableWidget.__init__(self,*args)

        self.setColumnHidden(0,True)
        self.header=header
        self.ProjectName=ProjectName
        self.dbFilename=self.ProjectName+'.db'
        self.__initActions__()
        self.__initContextMenus__()

    def BlockSignals(self):
        self.blockSignal(True)

    def EmitSignals(self):
        self.blockSignal(False)

    def __initContextMenus__(self):
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.connect(self, SIGNAL("customContextMenuRequested(QPoint)"),
self.tableWidgetContext)
        self.connect(self, SIGNAL('cellChanged(int, int)'),
self.onCellChanged)



---------------------------
He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820
website: www.hejibo.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100624/bf854c11/attachment.html>


More information about the PyQt mailing list