title: Mystery: In Qt, why would editorEvent be called, but not createEditor?
body: <p>I'm subclassing QAbstractItemDelegate.  This is my code.  Suggestions are welcome:</p>
  
  <pre><code>QWidget *ParmDelegate::createWidget(Parm *p, const QModelIndex &amp;index) const {
      QWidget *w;
      if (index.column() == 0) {
          w = new QLabel(p-&gt;getName().c_str());
      } else {
          if (p-&gt;isSection())
              return NULL;
          w = p-&gt;createControl();
      }
      return w;
  }
  
  QWidget *ParmDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const {
      cout &lt;&lt; "createEditor called" &lt;&lt; endl;
      Parm    *p = reinterpret_cast&lt;Parm*&gt;(index.internalPointer());
      QWidget *retval = createWidget(p, index);
      retval-&gt;setFocusPolicy(Qt::StrongFocus);
      retval-&gt;setParent(parent);
      return retval;
  }
  
  void ParmDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const {
      QRect rect(option.rect);
      editor-&gt;setGeometry(QRect(QPoint(0,0), rect.size()));
  }
  
  void ParmDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const {
      Parm    *p = reinterpret_cast&lt;Parm*&gt;(index.internalPointer());
      scoped_ptr&lt;QWidget&gt; w(createWidget(p, index));
      if (!w)
          return;
      QRect rect(option.rect);
      w-&gt;setGeometry(QRect(QPoint(0,0), rect.size()));
      w-&gt;render(painter, rect.topLeft());
  }
  
  QSize ParmDelegate::sizeHint(const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const {
      Parm    *p = reinterpret_cast&lt;Parm*&gt;(index.internalPointer());
      scoped_ptr&lt;QWidget&gt; w(createWidget(p, index));
      if (!w)
          return QSize(0,0);
      return w-&gt;sizeHint();
  }
  
  bool ParmDelegate::editorEvent(QEvent * event, QAbstractItemModel * model, const QStyleOptionViewItem &amp; option, const QModelIndex &amp; index ) {
      cout &lt;&lt; "editorEvent called" &lt;&lt; endl;
      return false;
  }
  </code></pre>
  
  <p>When this is run, I only see that editorEvent gets called twice for every edit event -- no createEditor!</p>