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?

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.