I am building a program using QTreeWidget. When I double click to a child, it allows to edit this child. I write a function to validate new input value using QDoubleValidator and I want to show a error tooltip but it not work, so I have a question whether I can write a validator that check input value immediately ( like ajax in web development) and show a error tooltip ? Can anyone have me?
1 Answers
Your question is pretty inspecific because you missed the chance of providing any code.
Anyway, I think you should not need any self implemented QValidator, if and only if the functionality of QDoubleValidator are sufficient.
Thing I would do is implementing a slot in the main widget/dialog whatever and connect the signal void QTreeWidget::itemChanged(QTreeWidgetItem *item, int column)
to the created slot. Whenever any tree item changes the slot gets invoked.
Inside the slot you may do any magic for validating the change, wheter you use QDoubleValidator or not. After any invalid check you may display an error message or pop up a QMessageBox.
If you require more information or help you have to provide more information. Feel free to generate a MCVE. For a nice example look here.