Important: Please read the Qt Code of Conduct -

append text two different interpretations

  • Both QText and QPlainTextEdit have methods to " append ( text)"
    However QText appends to the existing text and QPlainTextEdit
    creates new text and , in my case, adds new line to the widget.

    I have copied / using 3rd party files using BOTH classes, hence , appending - as adding new line of text - is not the same procedure.

    This is NOT A BIG issue , I can change the classes.

    I was just curious if there is an way to make QText behave same as QPlainTextEdit - append new line instead of appending to existing text.

  • Lifetime Qt Champion

    I neither know QText nor has QPlainTextEdit a function named 'append()'.

  • @Christian-Ehrlicher Apparently, QTextEdit has a method with that name.
    And it works as intended (or at least - as described in the docs): it adds new paragraph. So that includes newline.

    But I could not find (nor I ever heard of) QText. QPlainTextEdit also doesn't have that method.

    If OP has QString in mind though, its append() method adds to the string as it is supposed. So, both work as intended.

  • @artwaw
    QPlainTextEdit has both appendHtml() & appendPlainText(). All the methods discussed are for adding a "paragraph". How this relates to whatever the question is I do not know.

  • Probably QText means QTextEdit... and it has an append(QString)-function as well :)

Log in to reply