InputMask on QTreeWidgetItem
Hello,
Is there any way to put an inputMask onto a QTreeWidgetItem that is listed as Qt::ItemIsEditable? I need to check to make sure that a value typed in is numeric. I know I can do this easily with a QLineEdit, but I don't know what kind of widget is created when you just create a default QTreeWidgetItem and set its text. I know that QTreeWidget has a method itemWidget() that returns a QWidget*, but I don't want to just cast it as a QLineEdit if it isn't one. I really want to be able to restrict what inputs the user can make.
Thanks.
Re: InputMask on QTreeWidgetItem
You can try subclassing QTreeWidget item and implement the data method such that it returns a numerical value when the role is Qt::EditRole.
Alternatively you could look into creating an item delegate for that column.
Cheers,
_