Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bug in QTextEdit ?
Forum Updated to NodeBB v4.3 + New Features

Bug in QTextEdit ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luca
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      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.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Feeding plain text that will be interpreted as HTML will lead to loosing the line breaks, at least.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • L Offline
            L Offline
            luca
            wrote on last edited by
            #5

            [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!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved