Results 1 to 2 of 2

Thread: Trouble with sortItems coercion of text in QTableWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Trouble with sortItems coercion of text in QTableWidget

    Qt Code:
    1. if (val <= "0")
    To copy to clipboard, switch view to plain text mode 
    I would leave the quotation marks since you want compare the value numerical. Therefore also see toDouble().

    Qt Code:
    1. itemReplace = new QTableWidgetItem("0.0001");
    2. ui->timing_tableWidget->setItem(i, j, itemReplace);
    To copy to clipboard, switch view to plain text mode 
    There is no need to create a new item! just use your variable item and set the new text there.


    See if that solves your problem.


    EDIT: instead of test all the cells you could use QTableWidget::itemChanged() to only check a changed item.
    Last edited by Lykurg; 18th November 2009 at 07:40. Reason: updated contents

  2. The following user says thank you to Lykurg for this useful post:

    wconstan (18th November 2009)

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Change QTableWidget header name or text
    By ricardo in forum Qt Programming
    Replies: 3
    Last Post: 14th May 2009, 11:37
  3. Layout long text in QTableWidget
    By Tamtam in forum Newbie
    Replies: 0
    Last Post: 13th February 2009, 15:09
  4. Trouble with cursor and selecting text in QTextEdit
    By R_Torsten in forum Qt Programming
    Replies: 3
    Last Post: 7th June 2008, 19:17
  5. QTableWidget setSpan text display problem
    By sureshbabu in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2008, 16: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.