Results 1 to 5 of 5

Thread: Insert the string into QTableWidget

  1. #1
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Insert the string into QTableWidget

    Can I directly insert the string into particular cell in QTableWidget? ( Without using QTableViewItem)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Insert the string into QTableWidget

    No, you can't --- QTableWidgetItems are the cells.
    Last edited by jacek; 8th September 2006 at 15:32. Reason: corrected class name

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Insert the string into QTableWidget

    I guess you were both speaking about QTableWidgetItems, right?

  4. #4
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: Insert the string into QTableWidget

    Yes, QTableWidgetItems.

  5. #5
    Join Date
    Apr 2012
    Posts
    49
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    14
    Thanked 3 Times in 3 Posts

    Default Re: Insert the string into QTableWidget

    Hi all,

    I am trying to use QTableWidgetItem to add a string to a tablewidget.But i coudnt able to add.

    strcpy(Temp,val_pnt->Row[i].Column[j].ColumnValue);
    str.sprintf("%s",Temp);
    ui->tableWidget->setItem(i,j,new QTableWidgetItem(str));


    The above code is not working properly.
    Could anyone please tell me what i am wrong.?

    Thanks in advance.

    Regards
    Vinithr


    Added after 22 minutes:


    hi,
    The problem is fixed.The problem was Temp declared as pointer instead of a specific array

    Thanks
    Vinithr
    Last edited by vinithr; 5th August 2012 at 14:06.

Similar Threads

  1. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  2. QTableWidget Update - slow
    By DPinLV in forum Qt Programming
    Replies: 16
    Last Post: 18th August 2006, 21:09
  3. how to insert an ' in a database
    By jh in forum General Programming
    Replies: 3
    Last Post: 17th August 2006, 02:47
  4. Replies: 6
    Last Post: 5th March 2006, 21:05
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34

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.