Results 1 to 15 of 15

Thread: How copy data from one model view to another

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How copy data from one model view to another

    Well I don't know the architecture of your code, but instead of creating the model each time the function is called do something like that
    Qt Code:
    1. QStringList newData; // or where ever your data is
    2. QStringListModel* model = qobject_cast<QStringListModel*>(ui->listtableView_2->model());
    3. QStringList old = model->stringList();
    4. old << newData;
    5. model->setStringList(old);
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Lykurg for this useful post:

    breakthecode (4th December 2011)

Similar Threads

  1. Qt delegate model data and view
    By giusepped in forum Qt Programming
    Replies: 0
    Last Post: 27th July 2011, 11:30
  2. Replies: 1
    Last Post: 24th February 2011, 05:54
  3. Model / View and data structures
    By laszlo.gosztola in forum Newbie
    Replies: 0
    Last Post: 2nd December 2010, 05:13
  4. How to identify data from the model in the view?
    By csmithmaui in forum Qt Programming
    Replies: 8
    Last Post: 17th April 2010, 08:52
  5. Table view->model->set data
    By tulsi in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2009, 08:36

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.