Results 1 to 20 of 22

Thread: putting QTableWidgetItem (s) in a boolean array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Nov 2006
    Location
    indonesia
    Posts
    55
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 11 Times in 11 Posts

    Default Re: putting QTableWidgetItem (s) in a boolean array

    Hi,
    Use QTableWidget->item,
    Because QTableWidget->itemAt use coordinat location.
    Please check this code :

    Qt Code:
    1. ui->tableWidget->setRowCount(2);
    2. ui->tableWidget->setColumnCount(2);
    3.  
    4. int i,j;
    5. for(i=0; i<2; i++)
    6. {
    7. for(j=0; j<2; j++)
    8. {
    9. QTableWidgetItem *item = new QTableWidgetItem(QString::number(i));
    10. ui->tableWidget->setItem(i,j,item);
    11.  
    12. }
    13. }
    14.  
    15. for(i=0; i<2; i++)
    16. {
    17. for(j=0; j<2; j++)
    18. {
    19. item = ui->tableWidget->item(i,j);
    20. ui->textEdit->append(item->text());
    21.  
    22. if (item->text()="1")
    23. {
    24. M[o][p]=true;
    25. }
    26. else
    27. {
    28. M[o][p]=false;
    29. }
    30.  
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 

    you can modified with your problem. This code return text value from QTableWidget

    Thank you

    Best regards,

    Myta
    Last edited by myta212; 15th February 2012 at 09:00.

Similar Threads

  1. Replies: 2
    Last Post: 12th November 2010, 15:42
  2. boolean field checkbox QTableView
    By skuda in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2010, 14:48
  3. declare an array of QSemaphore and array of slot functions
    By radeberger in forum Qt Programming
    Replies: 11
    Last Post: 2nd May 2010, 14:24
  4. Strore Boolean value
    By bismitapadhy in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2009, 10:32
  5. [delegate] wrong commit for boolean
    By lauranger in forum Qt Programming
    Replies: 3
    Last Post: 26th October 2006, 09:14

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.