Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. [SOLVED]iomanip in Qt: Manipulating displayed text
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]iomanip in Qt: Manipulating displayed text

Scheduled Pinned Locked Moved C++ Gurus
5 Posts 4 Posters 4.1k 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.
  • S Offline
    S Offline
    smileeFace
    wrote on 22 Feb 2012, 11:57 last edited by
    #1

    Title says it all. Is there one? Been looking around and haven't found one. I'm printing it all into a QTextEdit to show the user and I need to manipulate some of it to make it look pretty. For example:

    @
    cout << setw(15) << right << "Something.";
    // But the Qt version of it...so like:
    data->setw(15).insertPlainText(tr("Something"));
    // data is a QTextEdit. Im sure that last statement is absolutely wrong but yeah...hope you understand what I am trying to do.
    @

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 22 Feb 2012, 12:43 last edited by
      #2

      No, there is no such means for QTextEdit. You will have to use qsprintf or QString::arg() or something similar to prepare the string.

      Also, make sure to set a fixed width font for the text edit, otherwise all that formatting will be useless.

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on 22 Feb 2012, 12:43 last edited by
        #3

        QTextEdit supports a subset of HTML. Do you need more than that?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          smileeFace
          wrote on 22 Feb 2012, 12:51 last edited by
          #4

          @Andre! Savior, completly forgot about the HTML. I'll use that which I'm pretty sure will work. Else I'll do it with strings. Thanks to both!

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shoyeb
            wrote on 22 Feb 2012, 13:10 last edited by
            #5

            "please check this":http://developer.qt.nokia.com/doc/qt-4.8/QTextEdit.html

            There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

            1 Reply Last reply
            0

            1/5

            22 Feb 2012, 11:57

            • Login

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