Learn what row is under the mouse in QAbstractTableModel? [Solved]
-
In a QAbstractTableModel, for one particular column I would like to return different toolTip data depending on the row under the mouse.
My problem was just confusion -- I need to return ToolTip data from the data() method, which does receive the row number. Not from headerData.
-
Hi,
I might be wrong, but when data is called for a tooltip, doesn't the index provided contain the right row/col information ?
-
Alas no, the signature is "QAbstractItemModel::headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole )" where "section" is the column number for horizontal orientation.
You are correct the "section" is row number for vertical orientation, I will investigate when that orientation is presented.
-
Sorry I misread the signature...
Then I'm not sure I understand what you want to achieve.You're hovering with your mouse over the horizontal table header and want to make it show a tooltip dependent of the row you're on with the mouse ? Then would you not be hovering over the table rather than the header ?