Results 1 to 3 of 3

Thread: Container choice problem

  1. #1
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Container choice problem

    Hi,

    I need someone's advice.

    I need to store somewhere a set of items, objects of QStandardItem, that are in a model, a QStandardItemModel. I need to store both items and their coordinates in a model. Essentially, in my application, a user can choose a few rows from a QTableView and make changes to a model. I synced a form and a Viewer with the same model so all changes should be updated immediately in the Viewer--QTableView.
    However, I would like to have a functionality that all changes can be cancelled. Therefore, I would need to store somewhere original content of those records that have been changed. I could make a copy of the whole model and operate on its copy but this would not be very memory efficient. I thought I could utilize any of the Qt containers but I am not expert and I really don't know which container or even combination to choose. I would basically need to store a content of a particular item along with its coordinates. I would need something like this:
    Qt Code:
    1. Container<QtStandardItem, QModelIndex>
    To copy to clipboard, switch view to plain text mode 

    The only problem is I don't know which container would be best for it or perhaps I'd better made my own class.

    I hope I've been clear with the explanation.
    Attached Images Attached Images

  2. #2
    Join Date
    Jun 2010
    Location
    Pretoria, South Africa
    Posts
    22
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Container choice problem

    Have you had a look at the QDataWidgetMapper class? Looking at your attachments, this might be your answer and you won't have to worry about the inner structure of your data model.

  3. The following user says thank you to Robbie for this useful post:

    ZikO (18th September 2012)

  4. #3
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Container choice problem

    Hi Robbie,

    Thanks. I read, not everything but quite a lot, about Model/View approach but did not come across this mapper. It will help me a lot

    Thanks

Similar Threads

  1. Container's removing item problem.
    By zgulser in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2012, 12:36
  2. Problem During fatching records from QMAP container
    By lekhrajdeshmukh in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2011, 13:12
  3. Quick ? about qSort(Container & container)
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2007, 11:20
  4. Problem with Container Extension
    By tarod in forum Qt Tools
    Replies: 2
    Last Post: 12th November 2007, 16:20
  5. Problem with custom container widget
    By MrGarbage in forum Qt Tools
    Replies: 4
    Last Post: 25th August 2007, 03:37

Tags for this Thread

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.