PDA

View Full Version : List of Views for a model



gkarthick5
22nd June 2011, 08:26
Can i get a list of views for a given model or selectionModel?

I update the selectionModel in one place and i need to scroll a QTableView to the newly selected row. But i do not have the table object's reference in the SLOT connected to the selectionModel's selectionChanged(...) SIGNAL.

How else can i get this done?

Thanks in advance.

ChrisW67
23rd June 2011, 00:17
Are you sharing the same selection model between views? Connect the selection model's selectionChanged() signal to slots in the views that need to scroll or emit your own signal that you connect to views that should stay in sync.

gkarthick5
23rd June 2011, 06:57
Yes, I'm sharing the same selection model between the views. And, I'm using the default QTableView, not subclassing it. And the
QTableView::scrollTo(..) is not a slot.

ChrisW67
23rd June 2011, 09:06
Then either subclass the view and write your own slot which calls scrollTo() or put a slot in the widget containing the view that call scrollTo() on the view.