just a quick and easy (maybe) question:
How do I prevent an edit on a QTreeWidgetItem
from allowing an empty string?
Currently, I use QTreeWidgetItem::itemChanged(QTreeWidgetItem*, int)
to check for modifications, and of course, I could just check for an empty string, but I don't have the previous text. So I'm left with setting a "default" QString
, but this is bad...
Thanks & Cheers!
I would suggest using the item delegate for your tree widget to handle the possible user input. Below is the simplified solution.
The implementation of item delegate:
Implementation of the simple tree widget with an editable item and custom item delegate: