PDA

View Full Version : Navigate through QTableView with next, previos, first and last buttons



Sparhawk
16th May 2008, 18:13
Hi,

I have next problem to solve, and I'm not sure how to do that using the model/view arquitecture of qt.

I have a main form, with a QTableView, the view of a QSqlQueryModel. So, I have a list of records (in the QTableView) of a table of a database. The user can select one row, push an edit button, an another form, editForm, is open with the data of the row (and the record too) for the user to edit.

I want to implement several buttons on the editForm: First, Previous, Next and Last. A navigate set of buttons. When the user click first, the form would show the first record (or row) of the QTableView. If the user click previous, the form would show the previous record of the actual row... An so on...

I don't see how to do that using model/view arquitecture in qt. How would you do that?

Thanks a lot.

jpn
16th May 2008, 20:31
See QAbstractItemView::moveCursor()

QAbstractItemView::MoveNext
QAbstractItemView::MovePrevious
QAbstractItemView::MoveHome
QAbstractItemView::MoveEnd