[PyQt] Emit parameter of QStandardItemModel

Maurizio Berti maurizio.berti at gmail.com
Tue Jan 29 19:43:01 GMT 2019


Maybe I've not understood correctly the question, but if you know the row
and column of the item for which you want to emit the notification, it
should be as simple as:

self.model.itemChanged.emit(self.model.item(row, column))

If you only have the index, you can access the item through the
itemFromIndex() method.

Maurizio

Il giorno mar 29 gen 2019 alle ore 20:05 Tong Zhang <warriorlance at gmail.com>
ha scritto:

> Hello,
>
> As the doc of 'itemChanged' signal of QStandardItemModel class (
> http://doc.qt.io/qt-5/qstandarditemmodel.html#itemChanged) states: the
> parameter to be emitted is QStandardItem *item, which is the point to the
> item, and in the Python program, we usually can write the following slot to
> connect to:
> def on_item_changed(self, item):
>     pass
>
> While not put decorator @pyqtSlot() atop, since @pyqtSlot(QStandardItem)
> is not right, @pyqtSlot('QStandardItem*') works. And here is my question:
> If I wanna trigger this signal emitting in a function, how can I pass the
> parameter to itemChanged?
>
> Thanks,
> Tong
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>


-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190129/692476dc/attachment.html>


More information about the PyQt mailing list