Results 1 to 3 of 3

Thread: Clicking a QComboBox does not change cells in QTableWidget

  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Clicking a QComboBox does not change cells in QTableWidget

    This is my first post here, so be gentle...

    I have a QTableWidget that I'm populating with QComboBox's and QSpinBox's. For example...
    Qt Code:
    1. QTableWidget *table = new QTableWidget(this);
    2. QComboBox *cmbEx = new QComboBox(table);
    3. table->setCellWidget->(2, 2, cmbEx);
    To copy to clipboard, switch view to plain text mode 

    However, now when I run the form and click on that combobox, it does not activate the cell it is in. For example, if I'm currently in cell [1,1], and I click on that combobox I created, the table does NOT change to cell [2,2] like it should -- it stays in cell [1,1]. If I use the TAB key to move into the combobox, the cell changes just fine.

    Is there something I need to do to force the QTableWidget to be aware that I have clicked on the QComboBox and force it to change cells?

    Thanks,
    -Evan

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Clicking a QComboBox does not change cells in QTableWidget

    you need to set data in table manually when data in combobox have been changed. another way it's write your own delegate. take a look at QTDIR/examples/itemviews/spinboxdelegate.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    ean5533 (10th March 2009)

  4. #3
    Join Date
    Mar 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Clicking a QComboBox does not change cells in QTableWidget

    This worked absolutely perfectly. Thanks again.

Similar Threads

  1. Sorting QTableWidget alters selectioin of cells
    By zarkzervo in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2009, 15:13
  2. Focus of cells in a QTableWidget
    By SailinShoes in forum Qt Programming
    Replies: 4
    Last Post: 9th June 2008, 09:19
  3. Again QTableWidget and QComboBox delegate
    By Aki-Matti in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2008, 14:40
  4. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 14th October 2007, 00:29
  5. QComboBox inside QTableWidget
    By campana in forum Qt Programming
    Replies: 7
    Last Post: 20th March 2006, 18:22

Tags for this Thread

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.