Results 1 to 3 of 3

Thread: Making a tree proxy model with multiple sources

  1. #1
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Making a tree proxy model with multiple sources

    I have several SQL table models. Each has column representing a primary key, foreign key pointing to parent's primary key (optional for 1st level table), and some text data. I want to display these in a QTreeView. I must admit that rolling my own from QAbstractItemModel has me stumped.

    I have looked at the TransposeProxyModel example, but it assumes one if going from table to table. No tree representation.

    My best try, so far, has been starting with Editable Tree Model, and changing the stored data in each TreeItem to be a sourceIndex instead of a stored value. I break down when trying to connect my source rowsInserted signal and have it call my insertRows in a private slot.

    Does anyone know of a good example of taking SQL data and displaying it in a QTreeView?
    Something that would update robustly if the source models changed.
    I would accept read-only (no editing).
    I am not against moving down to QSqlQueryModel for the underlying models, but would like to stick with QSqlTableModel, if possible.
    I would even accept a flat LEFT JOIN representation underneath, if need be.

  2. #2
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making a tree proxy model with multiple sources

    I need the same too but I don't know how can obtain it, I'm a newbie of qt.
    Try to see the answer to my post of 26th December 2009 called "Master/detail presentation", there is an example to how to use a two-level grid populate by an only one StringList model. How can we create a model for this view, a gerarchical SQL Model? Have you got any ideas?

    Thanks for your time!

    Michele

  3. #3
    Join Date
    Feb 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Making a tree proxy model with multiple sources

    If you follow the documentation at http://doc.trolltech.com/4.6/model-v...ogramming.html exactly with the SQL as your model, then that might be what you're looking for.

    But if you want it to be robust, don't use Qt.

Similar Threads

  1. Proxy model, index mapping.
    By wojtekw in forum Qt Programming
    Replies: 14
    Last Post: 7th January 2016, 09:09
  2. Replies: 2
    Last Post: 18th March 2008, 16:38
  3. Custom proxy model issue
    By Khal Drogo in forum Qt Programming
    Replies: 13
    Last Post: 30th November 2007, 13:41
  4. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 09:50
  5. Model and Proxy
    By larry104 in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2006, 22:05

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.