Results 1 to 2 of 2

Thread: getting the value from a QTableWidget where the cell is a combobox

  1. #1
    Join Date
    Oct 2007
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default getting the value from a QTableWidget where the cell is a combobox

    Hi, im having trouble in getting the value of the cell where the cell is a combobox, i've addded the combobx feature by means of:

    Qt Code:
    1. QComboBox *cb = new QComboBox();
    2. cb->addItem("India");
    3. cb->addItem("Philippines");
    4. cb->addItem("NIS");
    5. CheckList->setCellWidget(CheckList->rowCount()-1, 3,cb);
    To copy to clipboard, switch view to plain text mode 

    where i already have a tablewidget and edited the cell so that it would be a combobx, but
    the problem is i cannot get the value that the combobx contains on runtime.
    Last edited by jpn; 2nd December 2008 at 18:25. Reason: missing [code] tags

  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: getting the value from a QTableWidget where the cell is a combobox

    Cell widgets are not that strictly part of the model-view concept. Cell widgets are just something laid on top of the view. A cell value won't reflect to the value of a cell widget and vice versa. See the Spinbox Delegate example for details how to use a custom delegate to create custom editors that are properly integrated to the model-view.
    J-P Nurmi

Similar Threads

  1. Qtablewidget Combobox
    By aekilic in forum Qt Programming
    Replies: 17
    Last Post: 7th July 2015, 11:22
  2. Signal from a ComboBox cell in a QTableWidget
    By thebra in forum Qt Programming
    Replies: 5
    Last Post: 21st October 2008, 08:48
  3. Problems with QString
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2008, 08:18
  4. Replies: 0
    Last Post: 2nd May 2008, 07:57
  5. Word wrapping in a QTableWidget cell
    By jcooperddtd in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2007, 03:57

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.