Print selected item in QtableView

313 views
Skip to first unread message

Adam

unread,
Apr 15, 2019, 12:52:23 AM4/15/19
to Python Programming for Autodesk Maya
Hello, 

 I am trying to get the selected item inside a qTableView when I let it up to a QtableView.clicked.connect() it is only returning a QModelIndex can't find in the docs anything related to getting the text from that row/column.

- Adam

Justin Israel

unread,
Apr 15, 2019, 1:52:10 AM4/15/19
to python_in...@googlegroups.com
On Mon, Apr 15, 2019 at 4:52 PM Adam <aj...@sympatico.ca> wrote:
Hello, 

 I am trying to get the selected item inside a qTableView when I let it up to a QtableView.clicked.connect() it is only returning a QModelIndex can't find in the docs anything related to getting the text from that row/column.

QTableView inherits from QAbstractView, and it entirely deals in QModelIndex, which is the common type to QAbstractModel .
The clicked() signal emits with a QModelIndex:

Converting to some type of item is specific to the model you are using. If you are using a QStandardItemModel, then you would need to convert the index to an item using QStandardItemModel.itemFromIndex()

Justin


- Adam

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/cce1a31d-e861-4893-b091-0696cd661f0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages