Results 1 to 6 of 6

Thread: How to save Qstring from QTableView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default How to save Qstring from QTableView

    Hello
    I have been writing in qt for 2 months, so I am green and I have one problem. I want to save every cell of table ms sql in QString. I use driver QODBC. This is what I've already written:
    Qt Code:
    1. QString *copy;
    2. copy=new QString[20];
    3. QItemSelectionModel *selectionM = ui->tableView->selectionModel();
    4. QModelIndexList selectionL = selectionM->selectedIndexes();
    5. selectionL.takeFirst();
    6. for (int h=0; h<20; h++){
    7. copy[h] = model->data(selectionL.takeFirst()).toString();
    8. }
    9. QMessageBox::information(this, "Kopiowanie", copy[1]);
    To copy to clipboard, switch view to plain text mode 
    When I want to open this function in the program which I have written there appears a notification about the error : ,,This application has requested the Runtime to terminate it in an unusual way." Thanks in advance and I count for a simple explanation
    Last edited by wodzu-96; 23rd October 2011 at 17:12.

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2011, 15:42
  2. Replies: 8
    Last Post: 25th November 2010, 11:40
  3. Replies: 3
    Last Post: 1st April 2010, 23:56
  4. Replies: 4
    Last Post: 1st February 2010, 14:21
  5. Replies: 4
    Last Post: 31st January 2008, 20:44

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.