Is there anyway to create a table includes combobox cells in Qt 4.1.1 version?
I followed the "delegatespinbox" example to add combobox but wasn't successful.
delegate.cpp
delegate.h
main.cpp
Thank you for any help
Is there anyway to create a table includes combobox cells in Qt 4.1.1 version?
I followed the "delegatespinbox" example to add combobox but wasn't successful.
delegate.cpp
delegate.h
main.cpp
Thank you for any help
There is some extra parameter "int col" in DelegateSpinBox::createEditor(), and that's why createEditor() never gets called.
virtual QWidget* QItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
Just to get the concept right:
- createEditor() is supposed to create and initialize the editor for the given index. Add combo items, set spin ranges, etc here.
- setEditorData() is supposed to set correct content to the editor when the editing mode starts, you don't need to initialize and/or set editor properties anymore.
- setModelData() is supposed to exchange the data from the editor to the model when the editing mode ends, you don't need to initialize and/or set editor properties here either. (Oh, and btw check DelegateSpinBox::setModelData(), in "index.column() == 3", 3 should be 2).
J-P Nurmi
mgurbuz (10th May 2006)
Thank you for your help.
It works just fine...
Originally Posted by jpn
Bookmarks