Results 1 to 8 of 8

Thread: Simple model with QListView and QTableView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Simple model with QListView and QTableView

    What does your data structure look like?
    Do you have a list of City objects and each of those has a list of coordinate pairs?

    In cases such as this is might be easiest to use two models. One derived from QAbstractListModel presenting the cities, and one derived from QAbstractTableModel presenting the coordinates for a given city.

    In your current approach, with a tree model based on QStandardItem, you could try setting the same model for the table view and when selecting a city, set that model index as the table view's root index.

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    knro (29th September 2015)

Similar Threads

  1. Event handlers for QTableView model / selection model.
    By hickscorp in forum Qt Programming
    Replies: 2
    Last Post: 8th July 2011, 17:57
  2. Replies: 4
    Last Post: 1st April 2011, 23:44
  3. Replies: 1
    Last Post: 24th February 2011, 05:54
  4. A simple example of a tree model
    By YaK in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 17:15
  5. QListView does not display its model
    By mtrpoland in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2008, 19: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.