0

working on a form using a list widget. Would like to be able to double click on the item in the list and edit it, similar to how you can with the table widget.

I was wondering if this was possible by:

  1. creating an event when item is double clicked a qlineedit widget is created inside the qlistitem.

  2. creating an event when keypress [enter] or out of focus the qlineedit is removed and the text of the item is replaced with the temporary qlineedit's text.

If this works I would be interested in how to write the nesting of the temporary qlineedit and creating methods for that qlineedit. I'm guessing I'd have to make a qtemplineedit class inheriting the qlineedit class and then override the qlistwidgetclass with a custom qlistwidget class.

Should the doubleclick event be in the custom qlistwidget class and the [enter] keypress and out of focus event be in the qtemplineedit class?

eyllanesc
  • 221,139
  • 17
  • 121
  • 189
  • No need to reinvent the wheel here: item views already provide editing natively, you just need to properly set the item `ItemIsEditable` flag. – musicamante Feb 25 '22 at 21:56

0 Answers0