Pergunta

I recently discovered that QMessageBox parses provided text as HTML subset. I want to use it along with user-provided text (name for an item). How should I escape user's text to prevent interpreting it as RTF/HTML?

Foi útil?

Solução

Use Qt::escape(const QString& plain) function to escape HTML entities.

Outras dicas

Use QMessageBox::setTextFormat(Qt::PlainText) to force it to interpret the text as plain text.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top