Results 1 to 4 of 4

Thread: seeking advice on using model/view in my next project

  1. #1
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default seeking advice on using model/view in my next project

    Hey everyone! I am looking for some advice on organizing my next project.

    Basically, I want an app that stores train schedules (involving ~20,000 trains) in a model and displays it in widgets which are subclasses of QTreeView, QTableView, and QGraphicsView.

    (1) The tree widget would display departure cities at the top level, arrival cities on the next level, and finally the corresponding trains.

    Like this:

    • Paris
      • Athens
        • train A
        • train B
        • train C


    (2) The table widget would display arrival/departure times and other data for the selected trains. Train selection can be facilitated by adding check boxes to the above tree widget.

    (3) Graphics widget would visualize the route of the selected trains on a map.

    Would this be possible to implement using Qt's model/view architecture? If so, what model should I choose? Is it possible (without too much hacking) to make a proxy model between QTreeView widget and a table model? If not, are the any alternative approaches?

    I would really appreciate any suggestions! Thanks!

  2. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: seeking advice on using model/view in my next project

    I'm working on something that looks quite similar. See attached screenshot.
    Screenshot-Untitled* - Cash Flow-1.jpg
    I subclassed QAbstractItemModel and used two QTreeViews to show the data. I found that easier to synchronize than using a QTreeView and a QTableView.

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

    vokov (24th October 2012)

  4. #3
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: seeking advice on using model/view in my next project

    Makes sense. I've also found a discussion on how to use QAbstractItemModel with QGraphicsScene (http://invalidmagic.wordpress.com/20...titemview-iii/). So looks like this is the way to go. Thanks!

    Your app looks really nice. Did you customize the widgets or that's their native Ubuntu look? I mostly work with mac and the widgets look much crappier.

  5. The following user says thank you to vokov for this useful post:

    saifulkhan (25th October 2012)

  6. #4
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: seeking advice on using model/view in my next project

    It's native Ubuntu 10.04 (Gnome desktop) with the Ambiance theme.

Similar Threads

  1. Model/View separation advice sought
    By ChrisW67 in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2012, 16:32
  2. Replies: 4
    Last Post: 18th April 2012, 18:11
  3. Replies: 0
    Last Post: 21st April 2010, 12:23
  4. Replies: 1
    Last Post: 1st February 2010, 18:42
  5. QSql Model-View: How to keep view in sync with model
    By schall_l in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2008, 23:31

Tags for this Thread

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.