You can implement this behaviour manually:
void MainWindow::on_textEdit_textChanged() {
QString text = ui->textEdit->toPlainText().toUpper();
text.replace(QRegExp("[^A-F]"), "");
QStringList tokens;
for(int i = 0; i < text.length(); i += 2) {
tokens << text.mid(i, 2);
}
ui->textEdit->blockSignals(true);
ui->textEdit->setText(tokens.join(" "));
ui->textEdit->moveCursor(QTextCursor::EndOfBlock);
ui->textEdit->blockSignals(false);
}
Note that this implementation makes difficult to edit text in the middle of the line. If it's a problem, more complicated implementation required.