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. #1
    Join Date
    Nov 2011
    Location
    India
    Posts
    22
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default How copy data from one model view to another

    i am trying to select a data member from a model/view class, here a table view and add that particular data to an another table view. i can copy the data to another table view but only one selected data can add when i click the add button by using my code. can i add more data to table view by modifying the code or is there any other solution

    Qt Code:
    1. void dcsinter::on_pushButton_clicked()
    2. {
    3.  
    4. const QModelIndex index = ui->dirtableView->selectionModel()->currentIndex();
    5. QString selectedtext = index.data(Qt::DisplayRole).toString();
    6.  
    7. list << selectedtext ;
    8. model2->setStringList(list);
    9. ui->listtableView_2->setModel(model2);
    10. ui->listtableView_2->setColumnWidth(0,600);
    11.  
    12.  
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    thank you
    Last edited by breakthecode; 3rd December 2011 at 20:19.

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.