I am trying to create a custom editor for a user datatype to show in a model-view . Here is want I have:

Custom data type btRule (class), registered with Q_DECLARE_METATYPE(btRule)

Model btRulesModel that returns btRule for editing:
Qt Code:
  1. QVariant btRulesModel::data(const QModelIndex& index, int role) const
  2. {
  3. btRule& rul = _rules[index.row()];
  4. …
  5. if ( (role == Qt::EditRole) && (index.column() == 1))
  6. {
  7. v.setValue(rul);
  8. return v;
  9. }
  10. …
  11. }
To copy to clipboard, switch view to plain text mode 

I have class ModelParamViewer derived from QStyledItemDelegate. In the constructor I am registering custom editor
Qt Code:
  1. ModelParamViewer::ModelParamViewer(QObject *parent)
  2. : QStyledItemDelegate(parent)
  3. {
  4. QItemEditorCreator<ParamEditor>* itemCreator =
  5. new QItemEditorCreator<ParamEditor>("btRules");
  6.  
  7. btRule br;
  8. v.setValue(br);
  9. this->setItemEditorFactory(factory);
  10. QItemEditorFactory* editorfactory = this->itemEditorFactory();
  11. editorfactory->registerEditor(v.type(), itemCreator);
  12. }:
To copy to clipboard, switch view to plain text mode 

And I am showing the editor in
Qt Code:
  1. QWidget* ModelParamViewer::createEditor(QWidget *parent,
  2. const QStyleOptionViewItem& option,
  3. const QModelIndex& index) const
  4. {
  5. …
  6. ParamEditor* wdg= new ParamEditor(parent);
  7. //QComboBox* wdg = new QComboBox(parent);
  8. return wdg;
  9. }
To copy to clipboard, switch view to plain text mode 

My custome editor is:
Qt Code:
  1. class ParamEditor : public QWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. ParamEditor (QWidget* parent = 0) : QWidget(parent)
  6. {
  7. QString ss("QSpinBox{background-color: #ABABAB;border: 1px solid black;}");
  8. setStyleSheet(ss);
  9. setMinimumWidth(200);
  10. QHBoxLayout* layout = new QHBoxLayout();
  11. setLayout(layout);
  12. QLabel* lbl = new QLabel"label 1", this);
  13. layout->addWidget(lbl);
  14. }
  15. };
To copy to clipboard, switch view to plain text mode 
Question:
when I am in the edit mode the editor does not show up. However, when I am replacing editor with ComboBox – combobox shows up as the editor. I understand that ComboBox, just like QLabel, are some of the default editors for the regular datatypes. What am I doing wrong here?