En fait, je dispose d'un slot qui vérifie la validité des données saisies par l'utilisateur dans un QTextEdit.Comment pourrais je effacer la denière ligne saisie si elle n'est pas valide sans avoir erecours à "undo()".
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 void TextEditIPView::SetInputMask() { QRegExp * rxIP = AddressCheck::ApplyrxIPMask(); QRegExp * rxMAC = AddressCheck::ApplyrxCharMask(); QString text; text = this->toPlainText(); QStringList List = text.split("\n"); QString word; int length; length = List.length(); word = List.at(length - 1); if ((rxIP->exactMatch(word) == false) || (rxMAC->exactMatch(word) == false)) { this->undo(); } else this->append("\n"); }
Partager