Results 1 to 2 of 2

Thread: Qtablewidget and insert integer

  1. #1

    Default Qtablewidget and insert integer

    Hello
    How can I insert a integer value into Qtablewidget and next sorting column by integer order ( 14 > 5)
    When I used Qtablewidget.setitem(3,3,QtGui.QTableWidgetItem(in t("2")) I got nothing in my table and
    when I used Qtablewidget.setitem(3,3,QtGui.QTableWidgetItem(st r("2")) I can sorting ony in Lexicographical order (14 < 5)
    I write my program in PyQT 4.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qtablewidget and insert integer

    Use QTableWidgetItem::setData() to set numerical data instead of textual data. In C++ it would be:
    Qt Code:
    1. item->setData(Qt::DisplayRole, 2);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Insert the string into QTableWidget
    By suresh in forum Newbie
    Replies: 4
    Last Post: 5th August 2012, 14:06
  2. QTableWidget : insert multiple widgets in one cell..
    By halberdier83 in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2007, 16:15

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.