[PyQt] Table changed/modified method

Matt Newell newellm at blur.com
Wed Oct 21 23:08:14 BST 2009


On Wednesday 21 October 2009 14:49:28 Taylor Carrasco wrote:
> I'm looking for the exact same thing (to be notified when an item hierarchy
> changes) - but the following signal -
>
> self.connect(self.treeMain, SIGNAL('itemChanged(QTreeWidgetItem *, int)'),
> self.onItemChanged) # changes on init only
>
> is not emitted when an item is reparented. is there a way to do this?
>
> On Thu, Oct 22, 2009 at 8:01 AM, simozack <simozack at yahoo.it> wrote:
> > 2009/10/21 Filippo Rebora <filirebo at gmail.com>:
> > > I'm using an extention of QtableWidget as table...is there anything
> > > like isModified() or something?
> > > Documentation didn't help (I could not find something similar in class
> > > or parents)
> >
> > You can use an attribute in the window class and set it to True if the
> > user modifies the data.
> >
> > In the function called when closing the window, you can test that
> > attribute.
> >
> > HTH,
> > Simone
> > _______________________________________________
> > PyQt mailing list    PyQt at riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Use the QAbstractItemModel's signals for this.  rowsInserted/rowsRemoved 
signals should get called when an item is moved.

self.treeMain.model() # to get the QAbstractItemModel

Matt



More information about the PyQt mailing list