PDA

View Full Version : How can I tell if user leaves a row in a tableview



rdjenner
20th August 2010, 20:29
Can some please show me how to code the event to determine if the user has clicked off of a row in a tableView ?

tbscope
20th August 2010, 20:46
You can do this by implementing the mouse click event.
Maybe you might need to install an event filter for the scroll area, but I'm not sure here.

Urthas
20th August 2010, 20:52
Can some please show me how to code the event to determine if the user has clicked off of a row in a tableView ?

Are you asking about the case where the user has simply clicked elsewhere, or the case of, for example, shift-clicking on the currently selected row...or both?

rdjenner
21st August 2010, 12:49
I would need for both. What I am trying to accomplish is to save the record once the users exits the row, either update or insert if new.

ChrisW67
23rd August 2010, 02:02
Are the QAbstractItemView::currentChanged() and/or QAbstractItemView::selectionChanged() signals what you are looking for?

rdjenner
23rd August 2010, 14:27
Whichever one tells me that the row is about to change and allow me to save the current row data before actually leaving the row.

ChrisW67
23rd August 2010, 23:36
Have you read the docs for those two signals and thought about how you can use them? Seems that currentChanged() is what you want.