Results 1 to 18 of 18

Thread: Qtablewidget Combobox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qtablewidget Combobox

    Now that I think about it, it's quite possible that the QTableWidget::setCellWidget() function makes the specified cell the new (and only) owner of the specified widget. This would explain why only the last row uses it.

    So maybe you should only call that function when an editor is requested.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  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 Combobox

    Has the table been made sortable?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qtablewidget Combobox

    Dear Michiel

    How this is possible with the codes? And the is going to be other combo boxes other than this one?

    Dear Jpn

    No it not sortable!

  4. #4
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qtablewidget Combobox

    Quote Originally Posted by aekilic View Post
    How this is possible with the codes?
    I'm not really sure. Maybe you could reimplement QAbstractItemView::edit(). My first try would be to first set the cell widget and then call QAbstractItemView::edit(). But I've never tried this. I may be way off on this one.

    Experiment a little. Search the docs.

    Quote Originally Posted by aekilic View Post
    And the is going to be other combo boxes other than this one?
    Sorry, I don't know what you mean.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  5. #5
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qtablewidget Combobox

    I was telling there are going to be more combo boxes.

  6. #6
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qtablewidget Combobox

    Ah, but you used a question mark.

    There will be more comboboxes. But, I assume, not at the same time. Only when an editor is requested (by a double-click trigger). Right?
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  7. The following user says thank you to Michiel for this useful post:

    aekilic (21st July 2007)

  8. #7
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qtablewidget Combobox

    Yes, I would like to have the combo when i double clicked the item in the table!

  9. #8
    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 Combobox

    Quote Originally Posted by aekilic View Post
    Yes, I would like to have the combo when i double clicked the item in the table!
    Take a look at the spinbox delegate example as already suggested earlier in this thread.
    J-P Nurmi

  10. The following user says thank you to jpn for this useful post:

    aekilic (21st July 2007)

  11. #9
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qtablewidget Combobox

    Dear All

    Actually we have solved problem in a different way and we have added the combo different way. Thank you very much that you have helped us!

  12. #10
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qtablewidget Combobox

    Can you please share how you solved this problem....thanks

  13. #11
    Join Date
    Jul 2015
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Cool Re: Qtablewidget Combobox

    try this you have to make a new object everytime.


    for(int i=0; i<n; i++)
    {
    QComboBox * editor = new QComboBox(parent);
    editor->addItem("0");
    editor->addItem("1");
    editor->addItem("Z");
    editor->addItem("Last Known State");
    io_ui->tableWidget->setCellWidget(i,j,editor);
    }

Similar Threads

  1. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 19th December 2006, 23:27
  2. print QTableWidget
    By chak_med in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 18:46
  3. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  4. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.