Results 1 to 2 of 2

Thread: accessing prtected member of QTableView

  1. #1
    Join Date
    Jan 2007
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default accessing prtected member of QTableView

    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

    Qt Code:
    1. void derived_class::derived_class_slot()
    2. {
    3. QModelIndex index;
    4. index = view->selectedIndexes().first();
    5. ......
    6. }
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: accessing prtected member of QTableView

    Quote Originally Posted by locus View Post
    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().

  3. The following user says thank you to jacek for this useful post:

    locus (29th January 2007)

Similar Threads

  1. QTableView : accessing the data
    By marvaneke in forum Newbie
    Replies: 10
    Last Post: 30th March 2012, 12:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.