Results 1 to 1 of 1

Thread: [SOLVED] Retrieving data from QTableWidget

  1. #1
    Join Date
    Aug 2009
    Qt products

    Default [SOLVED] Retrieving data from QTableWidget


    I'm creating a QTableWidged based on my text file like this:

    Qt Code:
    1. char readword[50]="";
    2. for(i=0; i<6; i++)
    3. {
    4. for(j=0; j<5; j++)
    5. {
    7. fscanf(input,"%s", &readword);
    8. QTableWidgetItem *refItem = new QTableWidgetItem(QString("%1").arg(readword));
    9. refTable->setItem(i, j, refItem);
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    Then I'd like to see if I get the correct entru back out of the table (testing with location 1,1):

    Qt Code:
    1. QTableWidgetItem *item = refTable->item(1,1);
    2. QString celltext; celltext=item->text(); char print[50]; strcpy(print, celltext.toLocal8Bit().constData());
    4. fprintf(output,"%s\n", print);
    To copy to clipboard, switch view to plain text mode 

    However, I'm not getting the same text back as what was in the input file. I'm getting text from a location other than 1,1.
    I'd be very thankful for any help. It seems that I don't know how to handle QTAbleWidget or QTableWidgetItem
    Last edited by timmu; 7th October 2011 at 14:53.

Similar Threads

  1. Replies: 1
    Last Post: 16th September 2011, 09:15
  2. retrieving data from a QWT plot
    By mobucl in forum Qwt
    Replies: 1
    Last Post: 26th May 2011, 14:00
  3. SQL Server data retrieving speed problem
    By Aleksandar in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2010, 14:52
  4. Debugger problem retrieving data for watch view hangs
    By frenk_castle in forum Installation and Deployment
    Replies: 0
    Last Post: 6th May 2010, 00:09


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.