Delegate display on row selection in QTableView
Hi,
I have implemented the custom delegate in QTableView. In One column i have set the ComBox as delegate in QTableView.
Problem is when i select the row of QTableView then ComboBox is not getting displayed. Combobox is only ge displayed when i clicked on second column where i have set the delegate.
- {
- this->view = view;
- }
- virtual QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
- {
- Q_UNUSED(index);
- Q_UNUSED(option);
- editor->installEventFilter( const_cast<QComboDelegate*>(this) );
- editor->setAutoFillBackground(true);
- return editor;
- }
- {
- combo->addItems( comboList() );
- combo->setCurrentIndex( idx );
- }
- virtual void setModelData( QWidget * editor, QAbstractItemModel* model, const QModelIndex& index ) const
- {
- model->setData( index, combo->currentText() );
- }
- {
- Q_UNUSED(index);
- int hCell = option.rect.height();
- int hEditor = editor->sizeHint().height();
- int h = qMax( hCell, hEditor );
- size.setHeight( h );
- }
- /**
- * handle the events anf filter the required events
- */
- {
- }
- return false;
- }
Can you please help me how to do when i select the row then delegate should be displayed ?
Thanks,
Neel
0 replies
You must log in to post a reply. Not a member yet? Register here!
