Bug in QTextEdit ?
-
Hi all,
I have this situations:
(1)
@
te_anteprima = new QTextEdit();
te_anteprima->setText(file_personalizzato_str);
te_anteprima->show();
@(2)
@
te_anteprima = new QTextEdit(file_personalizzato_str);
te_anteprima->show();
@The QString file_personalizzato_str has some line that terminate with a new_line ( \n ) like this:
@
[Generale]
interfaccia_grafica=0
connessione_a_star=%connessione_a_star%
indirizzo_star=%indirizzo_star%
utente_star=%utente_star%
password_star=%password_star%
...
...
@In the first case I see in the QTextEdit all the text with the right new line in the right place.
In the second case I see this:
@
[Generale] interfaccia_grafica=0 connessione_a_star=%connessione_a_star% indirizzo_star=%indirizzo_star% utente_star=%utente_star% password_star=%password_star%
@
without new lines. -
That is nice. And the problem is...?
Edit: indeed, it is all in the docs.
setText will try to guess if the contents are HTML or plain text. In this case, it guesses plain text (no HTML tags, so it is right about that). So, no bug in QTextEdit, the issue is with your documentation reading skills.BTW: it is a bit "rude to claim you've found a bug":http://www.catb.org/~esr/faqs/smart-questions.html#id478549, if you're not really sure.
-
[quote author="Volker" date="1299249655"]Read the API docs:
bq. QTextEdit::QTextEdit ( const QString & text, QWidget * parent = 0 )
Constructs a QTextEdit with parent parent. The text edit will display the text text. The text is interpreted as html.[/quote]@
The text is interpreted as html.
@
I didn't read this.That's why... Thanks!