First, maybe you can explain what you are doing here. How are you making "QTextEdit one of the widgets of QTreeWidget"? This doesn't make a lot of sense.I have designed an QTreeWidget with a QTextedit as one of the widget of the QTreeWidget.
Second, if you are using QTextEdit just to edit a two-letter string, why? QLineEdit seems a better fit.I want to restrict the input in the QTextEdit only to "OK/KO" and user should be prompted by message box to enter only this two values.
And third, if you use QLineEdit, then you can either 1) use an input mask (QLineEdit::setInputMask()) that restricts them from entering anything except "K" or "O", 2) use a QCompleter that gives only "OK" or "KO" as choices, 3) use a QValidator that accepts only "OK" or "KO", or 4) write your own handlers for the QLineEdit::textChanged(), QLineEdit::textEdited(), or QLineEdit::editingFinished() signals where you check to see if the user is entering (or has entered) the correct characters and either accept them or display your error message.
But to be honest, if the only thing the user can enter is "OK" or "KO" (whatever that means), then why don't you just use a check box? Either it is checked or it isn't, and that's your status.
Bookmarks