Results 1 to 3 of 3

Thread: How to know which views are using my custom ModelView?

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question How to know which views are using my custom ModelView?

    Hi,

    Giving that a model can be shared between several views.. How can I know which views are using my model from inside the my model class?

    Thanks,
    Carlos.

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to know which views are using my custom ModelView?

    In general, you can't; this would violate the model/view design. Models are sources of data and nothing more; they provide data upon request, without regard for the view asking for it.

    Most often, if you find yourself wanting this sort of information, there's something wrong with your design.

  3. #3
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to know which views are using my custom ModelView?

    seems that public ItemModel API doesn't allow to know connected views.

    I think it is correct because the Models provide data and don't need to know where and how these data are displayed.

    If you need you can inherits your model class and reimplement setModel in order to save views list
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. Better understanding of the ModelView archtecture
    By scarleton in forum Qt Programming
    Replies: 6
    Last Post: 28th June 2010, 07:07
  2. Model with two very different views
    By mholmes in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2010, 23:19
  3. GraphicsView / ModelView Integration ???
    By travlr in forum Qt Programming
    Replies: 11
    Last Post: 8th December 2008, 10:19
  4. list of custom item views?
    By Beluvius in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2008, 06:43
  5. How customize items of ModelView?
    By istdasklar in forum Qt Programming
    Replies: 3
    Last Post: 28th March 2007, 18:08

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.