Results 1 to 4 of 4

Thread: List of Views for a model

  1. #1
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question List of Views for a model

    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.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: List of Views for a model

    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.

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

    gkarthick5 (23rd June 2011)

  4. #3
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: List of Views for a model

    Yes, I'm sharing the same selection model between the views. And, I'm using the default QTableView, not subclassing it. And the
    Qt Code:
    1. QTableView::scrollTo(..)
    To copy to clipboard, switch view to plain text mode 
    is not a slot.

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: List of Views for a model

    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.

  6. The following user says thank you to ChrisW67 for this useful post:

    gkarthick5 (24th June 2011)

Similar Threads

  1. Model with two very different views
    By mholmes in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2010, 23:19
  2. how to disable views from a model
    By zeeeend in forum Qt Programming
    Replies: 3
    Last Post: 9th September 2008, 21:14
  3. list of custom item views?
    By Beluvius in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2008, 06:43
  4. 2 Views 1 Model
    By PrimeCP in forum Qt Programming
    Replies: 3
    Last Post: 2nd October 2007, 01:40
  5. Model Views and QLabel
    By naresh in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2006, 15:14

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.