[PyQt] Return type Qlist<QModelIndex> is ignored because it is unknown to PythonQt

Saeed Mahdizadeh Bakhshmand saeedbakhshmand at gmail.com
Tue Sep 8 22:51:45 BST 2015


Hello All,

I am trying to obtain a list (indices) of selected cells in a QTableView
using this script (in 3D slicer interface):

table = qt.QTableView()
...
#setup of the table and adding models and items etc.
...
select = table.selectionModel()
index = select.selectedIndexes()

and I get this error:

File "<console>", line 1, in <module>

ValueError: Called QList<QModelIndex> selectedRows(), return type
'QList<QModelIndex>' is ignored because it is unknown to PythonQt. Probably
you should register it using qRegisterMetaType() or add a default
constructor decorator to the class.


Any hint on which way is better and how can I register an unknown type in
PythonQt?


Best,

Saeed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150908/60ae1d5e/attachment.html>


More information about the PyQt mailing list