View Full Version : accessing prtected member of QTableView

29th January 2007, 21:19
I have a tableview in a form which i have subclassed. The form contains a qtableview and i am trying to access one the view's protected member functions
(QModelIndexList selectedIndexes () const) from a slot in the derived class using

void derived_class::derived_class_slot()
QModelIndex index;
index = view->selectedIndexes().first();

but i'm getting the following error:

error C2248: 'QTableView::selectedIndexes' : cannot access protected member declared in class 'QTableView'

how can i access this function?

thanks for your attention.

29th January 2007, 21:30
how can i access this function?
You can't access it from outside. Protected methods and fields are only accessible to derived classes. Better try QAbstractItemView::selectionModel().