Results 1 to 5 of 5

Thread: Multiple model to single view

  1. #1
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Multiple model to single view

    Hi,

    Is is possible to have multiple modl attched to single view.
    If yes,Please suggest how?


    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple model to single view

    Yes. Use QAbstractItemView::setModel() multiple times with different views and same model.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    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: Multiple model to single view

    I suspect the OP means "at the same time". That is, the single view is showing some data from model A, and some from model B at the same time.

    The general answer would be no in this case (at least with respect to the standard views supplied). If the two models were of two related tables in a database then the QSqlRelationalTableModel is a good place to look for alternative approaches.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple model to single view

    Hmm... I must have been too tired when reading this thread
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Multiple model to single view

    Thanks for your reply

Similar Threads

  1. Should I use multiple or a single model(s)?
    By Cotlone in forum Newbie
    Replies: 2
    Last Post: 7th May 2010, 03:39
  2. Replies: 0
    Last Post: 21st April 2010, 12:23
  3. Replies: 1
    Last Post: 1st February 2010, 18:42
  4. 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
  5. insertion of multiple items in a single row
    By grimbaum in forum Qt Programming
    Replies: 4
    Last Post: 17th November 2006, 05:36

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.