0

Hi all! I have a question about PyQT4.
How can I get an index of current cell, in which the cursor is whitout clicking on it?
According to official documentation of QT there are only signals that send current index
when you click on it. But if you just enter the cell with navigation keys they don't work...
Is there a way to get the current index of TableView (not TableWidget) whitout clicking on it?

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by annndrey
0

I've found the solution!
The problem was that in QT4 there are a signal and a slot with the same name - currentChanged(QModelIndex, QModelIndex)
To obtain an index of current cell while moving through the table we have to add a selectionModel to our TableView:

selectionModel = QtGui.QItemSelectionModel(TableView.model())
connect(selectionModel, QtCore.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), some_function)

Et voila, it works!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.