hi, i subclassed QWidget as CustomWidget, and in CustomDelegate:: createEditor() i new a CustomWidget instance and return it. now once i double click the item in a view, the editor widget was created, and once i press the editor widget( a CustomWidget instance), the delegate commit data and close editor and the editor widget was destroyed. this is not our expection. i wonder how to control the editor widget's closing event, for example, click event will edit the data, and double click event will close the editor and commit data.

i'v read the star delegate in Qt's example, however, in the following code, i cannot change the close event from "release" to "double click".

in this example, once the mouse release, the editor was destroyed.

Qt Code:
  1. void StarEditor::mouseReleaseEvent(QMouseEvent * /* event */)
  2. {
  3. emit editingFinished();
  4. }
  5. //! [3]
  6. void StarEditor::mouseDoubleClickEvent(QMouseEvent *event)
  7. {
  8. emit editingFinished();
  9. }
  10. void StarEditor::mousePressEvent(QMouseEvent *event)
  11. {
  12. update();
  13. }
To copy to clipboard, switch view to plain text mode 

Thanks!