Results 1 to 17 of 17

Thread: Custom QAbstractProxyModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom QAbstractProxyModel

    Thanks wysota, Yes i'm reading! i just want to clear the problem!

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom QAbstractProxyModel

    If you wish to modify values returned by the model, reimplement data().
    Thanks again wysota, I've implemented the data() and it's ok except that the table doesn't update itself when i modify values returned by the model. I've even
    try emit dataChanged() signal but i'm getting a weird error:
    Qt Code:
    1. error: C2662: 'QAbstractItemModel::dataChanged' : cannot convert 'this' pointer from 'const TCustomProxyModel' to 'QAbstractItemModel &'
    2. Conversion loses qualifiers
    To copy to clipboard, switch view to plain text mode 

    (TCustomProxyModel: my custom proxy model)

    Just another thing: when i click on table the table update itself!!!
    Last edited by alizadeh91; 15th December 2012 at 09:22.

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

    Default Re: Custom QAbstractProxyModel

    You can't emit dataChanged() from data() which is a const method. Invalidate the proxy model when its data changes (that is when you perform action that will cause the proxy to return different values).
    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.


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

    alizadeh91 (15th December 2012)

Similar Threads

  1. How to subclass QAbstractProxyModel
    By skycrestway in forum Qt Programming
    Replies: 2
    Last Post: 22nd October 2010, 23:35
  2. QAbstractProxyModel to do a Tree
    By xgoan in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2008, 17:31
  3. QAbstractProxyModel lessThan [SOLVED]
    By killerwookie99 in forum Qt Programming
    Replies: 3
    Last Post: 15th September 2008, 19:42
  4. Help with QAbstractProxyModel
    By killerwookie99 in forum Qt Programming
    Replies: 9
    Last Post: 12th September 2008, 22:13
  5. QAbstractProxyModel and QTreeView
    By niko in forum Qt Programming
    Replies: 5
    Last Post: 18th January 2008, 21:17

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.