This sounds a lot like a homework problem to me. Aren't you supposed to be doing this on your own instead of asking for help here every time you run into a problem?

First, QTableView is simply a way to display and interact with your internal data structure. This data structure is usually wrapped by a QAbstractTableModel that the view uses for display. When you click on something in the table view, the view's QItemSelectionModel is filled in with the information about the selection. The QModelIndex items in this selection model tell you which entries were selected, and these indices point to your original table model's items.

It would be a very good idea for you to study the Qt Model / View tutorial and some of the many Qt model / view examples.