The delegate function: createEditor(...) doesn't get called when using a QTreeWidget.
Double clicking on an item in the tree widget has no effect.
Does somebody see what I'm doing wrong?

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication app(argc,argv);
  4. QTreeWidget* tree = new QTreeWidget;
  5.  
  6. tree->setItemDelegate(new MyDelegate);
  7. tree->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
  8.  
  9. tree->setColumnCount(1);
  10.  
  11. QTreeWidgetItem *item01 = new QTreeWidgetItem(tree);
  12. item01->setData(0, Qt::EditRole /*Qt::DisplayRole*/, QVariant("item01"));
  13. item01->setText(0, "item01");
  14. tree->addTopLevelItem(item01);
  15.  
  16. tree->show();
  17. return app.exec();
  18. }
To copy to clipboard, switch view to plain text mode 
The implementation of the delegate class doesn't matter. The create editor method doesn't get called. If I use a QTableWidget instead of a QTreeWidget, it works fine. The class declaration of the delegate looks like this:
Qt Code:
  1. #include <QStyledItemDelegate>
  2.  
  3. class MyDelegate : public QStyledItemDelegate
  4. {
  5. Q_OBJECT
  6. public:
  7. MyDelegate(QObject *parent = 0);
  8. ~MyDelegate() {}
  9.  
  10. void paint(QPainter *painter, const QStyleOptionViewItem &option,
  11. const QModelIndex &index) const;
  12. QSize sizeHint(const QStyleOptionViewItem &option,
  13. const QModelIndex &index) const;
  14. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
  15. const QModelIndex &index) const;
  16. void setEditorData(QWidget *editor, const QModelIndex &index) const;
  17. void setModelData(QWidget *editor, QAbstractItemModel *model,
  18. const QModelIndex &index) const;
  19.  
  20. private slots:
  21. void commitAndCloseEditor();
  22. };
To copy to clipboard, switch view to plain text mode 

Thanks!