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. [solved] plainTextEdit vs textEdit and .setText()
Forum Updated to NodeBB v4.3 + New Features

[solved] plainTextEdit vs textEdit and .setText()

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.2k 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.
  • T Offline
    T Offline
    thistleknot
    wrote on 10 Aug 2014, 16:07 last edited by
    #1

    I have these three lines

        //ui->plainTextEditLeft->setText(in.readAll());
        //ui->plainTextEditLeft->toPlainText(in.readAll());
        ui->textEditLeft->setText(in.readAll());
    

    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.

    http://qt-project.org/doc/qt-5/QPlainTextEdit.html

    Update
    Found it:
    ui->plainTextEditLeft->setPlainText(in.readAll());

    derp:
    "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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on 11 Aug 2014, 22:53 last edited by
      #2

      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.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thistleknot
        wrote on 11 Aug 2014, 23:22 last edited by
        #3

        yeah, the issue was I needed to use the

        .toLatin1() function I believe.

        As

        .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.

        1 Reply Last reply
        0

        1/3

        10 Aug 2014, 16:07

        • Login

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