Results 1 to 6 of 6

Thread: How to lock data petition for a custom model ?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How to lock data petition for a custom model ?

    I have noted that when I'm edit a cell (custom model & table view) the table model ask for vales of the other visible cells. If I return a Qvariant invalid (as dochelp advise )
    Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.
    what I get are empty the cells....

    Is there any way to lock the data petition ?
    Thanks

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,546
    Thanks
    13
    Thanked 1,578 Times in 1,507 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to lock data petition for a custom model ?

    I have noted that when I'm edit a cell (custom model & table view) the table model ask for vales of the other visible cells. If I return a Qvariant invalid (as dochelp advise )
    Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.
    what I get are empty the cells....
    Yes, of course you do. You told the view there was no data to display for the given index by returning QVariant(). If the index in the model has data for the given role then return the data.
    Is there any way to lock the data petition ?
    I have no idea what this means.

  3. #3
    Join Date
    Oct 2011
    Location
    united states
    Posts
    1
    Qt products
    Qt4 Qt Jambi PyQt3 PyQt4
    Platforms
    Windows

    Default Re: How to lock data petition for a custom model ?

    In table view cell are merge in to each other and overlap.

  4. #4
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to lock data petition for a custom model ?

    What I want is some way to tell the table or model that does not refresh the content of any cell.
    Now, I'm viewing how when I edit a cell first I receive a 'Data' event for the whole cells.
    In case I have a 100x100 Table, I'd have an unusefull time used for refresh an information that is not neccesary.
    ( In this case If I return a QVariant what I get is to clear the cells...)
    So, in case of edit a cell, how can I lock or disable the Data refreshing ?
    Thanks.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,546
    Thanks
    13
    Thanked 1,578 Times in 1,507 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to lock data petition for a custom model ?

    The view will request the indexes it requires in order to maintain a consistent view of the model. It does this based on changes made to the view made by users (e.g. resize an make more visible) and the signals emitted by your model as it modifies data. What signals are you emitting from your custom model?

  6. #6
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to lock data petition for a custom model ?

    By now, I only emit datachanged.
    I have tested the addressbook example and it happens the same.
    When you do a double click to edit a cell, you see (with a qdebug) a data petition for every visible cell.
    (And there is no resize event).

    I'd understand logical this data refresh when I end my edition (in example after enter), but not before edit a cell.
    Repeat, I have a problem because I spend a significant time doing a data refreshing that is not neccesary.
    Can be a trick to mark some 'I'm editing a cell ' var and if it is true return index.data(display-role) ? (insted the data I have to search into my store-system) ??
    Thanks.

Similar Threads

  1. Replies: 9
    Last Post: 14th February 2013, 19:39
  2. Combine custom delegate and model data() roles
    By qlands in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2011, 12:43
  3. Replies: 1
    Last Post: 24th February 2011, 05:54
  4. Custom model for QTreeView with SQLite data source
    By emanuel in forum Qt Programming
    Replies: 0
    Last Post: 19th January 2011, 00:53
  5. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 20:23

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.