Qt World Summit: Submit your Presentation

[solved] plainTextEdit vs textEdit and .setText()

  • I have these three lines


    only the last uncommented one works when I use a textEdit.

    If I try a plainTextEdit... I can't using the setText() function.

    Is there an equivalent function to load a plainTextEdit that accepts qstring?

    Is there a different way that I should be loading my plainTextEdit? I only have a desire to be working with .txt files, so I want to see ascii formatting. I assumed that's what this plainTextEdit object was.


    Found it:

    "The text is set or replaced using setPlainText() which deletes the existing text and replaces it with the text passed to setPlainText()."

    and... it's not ascii

  • What do you mean by ascii formatting?

    Plain text is literally just plain text. Nothing fancy like formatting. No bold, no italics, no colors, etc. I.e. not rich text.

    So like my comment here would be plain text. Whereas if I included code and wanted coloring and different looks to some text it would be a rich text thing.

  • yeah, the issue was I needed to use the

    .toLatin1() function I believe.


    .toAscii() was depreciated.

    as to the ascii formatting.

    I assumed it did ascii formatting vs non courier font, but I figured a way to set the font already using a ui-> call.

Log in to reply