Results 1 to 8 of 8

Thread: SqlTableModel not updating AbstractProxyModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 24 Times in 24 Posts

    Default Re: SqlTableModel not updating AbstractProxyModel

    You need either to call QSortFilterProxyModel::invalidateFilter() whenever your model changes or to set the dynamicSortFilter property to true (warning: slow).

  2. #2
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: SqlTableModel not updating AbstractProxyModel

    But i'm not using QSortFilterProxyModel! I'm using QAbstractProxyModel... Shall I use SortFilter instead?
    It's quite nonsense, since I don't need any of the features it provides (sort and filtering).

  3. #3
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: SqlTableModel not updating AbstractProxyModel

    Well, if you do not use those features, they hopefully won't use too much processing power ;-)

    The source model does not have to emit dataChanged() if only a new row has been added. That is what rowsInserted() is for.

  4. The following user says thank you to caduel for this useful post:

    akiross (13th November 2008)

  5. #4
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: SqlTableModel not updating AbstractProxyModel

    Oops! You're so right! I forgot about rowsInserted.
    Anyway that was just a test, the problem remains: view isn't updated correctly (both on row insertion and data changing)...

    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.
    Am I supposed to forward the signals when using abstract proxy models?

  6. #5
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: SqlTableModel not updating AbstractProxyModel

    Your proxy has to tell the view all the view needs to know.
    So, unless your proxy does not show a row that has been modified or inserted, yes, you will need to forward those signals.

  7. #6
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: SqlTableModel not updating AbstractProxyModel

    Ok, thank you

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
  •  
Qt is a trademark of The Qt Company.