Change cursor inside QTableview
Hi All,
I would like to change the mouse cursor when I move the mouse pointer inside my QTableView over a row.
I've tried this:
Code:
{
int iRow = this->rowAt( pEvent->y() );
if( iRow == -1 )
{
this
->setCursor
( QCursor( Qt
::ArrowCursor ));
}
else
{
this
->setCursor
( QCursor( Qt
::PointingHandCursor ));
}
}
But this unfortunately this does not work. The mouse cursor is not changing. What do I wrong? Any ideas?
Many thanks and best regards
Re: Change cursor inside QTableview
Just a guess:
maybe rowAt() uses local Widget coordinates, but the event is giving global.
Try to map to widget coordinates and see if it helps.
Re: Change cursor inside QTableview
Hi high_flyer,
with pEvent->y() I'm mapping to the local widget coordinates (pEvent->globalY() is the one which mapps global). Also when I move over a row inside my QTableView I can see (with qDebug()-output) that this function call works fine. But the cursor is not changing.
Any ohter ideas or suggestions?
Best regards
Re: Change cursor inside QTableview
Hmm...
Try first with out specifying a row.
See if at all you get the cursor to change over the widget.
Re: Change cursor inside QTableview
a mouseMoveEvent is only generated, if you press a button. If you want to generate the event always, you have to enable mouse tracking for the widget