Results 1 to 2 of 2

Thread: doubles and strings as items of a QTableWidget

  1. #1
    Join Date
    Nov 2010
    Qt products

    Default doubles and strings as items of a QTableWidget

    I want to create a simple QTableWidget consisted of strings and double numbers.
    I want the user to edit these items and I want the program to access/edit the values of these items.

    In the documentation, I found so far,

    a QTableWidget is consisted of QTableWidgetItems
    A QTableWidgetItem is contructed from this function

    Qt Code:
    1. QTableWidgetItem::QTableWidgetItem ( int type = Type )
    To copy to clipboard, switch view to plain text mode 

    which is the int type for double numbers and QStrings? I cannot find any list

  2. #2
    Join Date
    May 2010
    Thanked 260 Times in 246 Posts
    Qt products
    MacOS X Unix/X11 Windows Android

    Default Re: doubles and strings as items of a QTableWidget

    Also it has an overloaded constructor with a QString argument: QTableWidgetItem

    Basically what you will do is subclass QTableWidgetItem, and store everything as a QString and then see if it's a double/int value or just a string, or a string that means something (like a formula)

    You can download from here the sample code for C++ GUI Programming with Qt4, 2nd Edition, it has an example with that functionality.

Similar Threads

  1. Replies: 1
    Last Post: 7th May 2010, 15:01
  2. QTableWidget->items
    By calireno in forum Newbie
    Replies: 2
    Last Post: 8th October 2009, 18:16
  3. Transfer items from a QTableWidget to another
    By grub87 in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2009, 16:46
  4. Read files with strings and doubles
    By thebra in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 20:41
  5. adding items in qtablewidget
    By Djony in forum Qt Programming
    Replies: 17
    Last Post: 24th November 2006, 10:03

Tags for this Thread


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.