Results 1 to 4 of 4

Thread: Use of signals and slots with proxy models.

  1. #1
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    37
    Thanks
    14
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Use of signals and slots with proxy models.

    Hello,

    The documentation says the following about proxy models:
    The signals and slots used by the model/view framework ensure that each view is updated appropriately no matter how many proxy models are placed between itself and the source model.

    Does that mean that the signals and slots are automatically piped through the the proxy models? Or do we still need the connect the signals and slots directely bettween the source model and the view when there are proxy models in between?

    Thanks!
    Last edited by Guett_31; 26th April 2013 at 21:12.

  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: Use of signals and slots with proxy models.

    Connections are set for you automatically when you call setBaseModel on the proxy.
    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. The following user says thank you to wysota for this useful post:

    Guett_31 (26th April 2013)

  4. #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: Use of signals and slots with proxy models.

    Your view is connected only to the last model in the chain. Any proxy model is connected to the model before it, takes upstream signals, and maps those signals to corresponding signals for the downstream consumer. Depending the function of the proxy not all upstream signals result in downstream signals and there may not be a one-to-one correspondence.

    This mapping occurs for all the QAbstractItemModel signals.

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

    Guett_31 (26th April 2013)

  6. #4
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    37
    Thanks
    14
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Use of signals and slots with proxy models.

    In other words, any signal/slot specific to a QAbstractItemModel sub class (like directoryLoaded() for QFileSystemModel) needs to be connected directely between the source model and the view. Is that what you are saying?

    Does that rule also apply for specific class members too?
    For example, my source model is a QFileSystemModel and I call isDir() in my View. If there is a proxy model in between, do I need to subclass the proxy model to impement a isDir() function to return to the View whatever the QFileSystemModel source model returns to the proxy model?

Similar Threads

  1. Switching between models
    By janorcutt in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2012, 19:52
  2. Viewer for 3D Models
    By bts in forum Newbie
    Replies: 2
    Last Post: 3rd March 2011, 14:45
  3. sql models
    By damiano19902 in forum Newbie
    Replies: 1
    Last Post: 4th June 2009, 07:18
  4. Proxy models and slection models
    By amunitz in forum The Model-View Framework
    Replies: 1
    Last Post: 23rd September 2008, 14:35

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.