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. Problems with QTextBrowser
Qt 6.11 is out! See what's new in the release blog

Problems with QTextBrowser

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 3.8k 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.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    Hello all!

    I have these problems:

    1. It doesn't scroll when I use
      @ui->output->insertPlainText(output_buffer);@
      I mean, even it goes below the widget, the scroll shows itself but doesn't scroll along with the text being placed inside it.

    2. I have checked the readOnly checkbox and yes, it doesn't take input put when I click in it it changes the cursor position and it outputs the next 'output_buffer' after where I placed the cursor and continues from there.

    Thanks for any replies :)

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

      Have a look at this "parallel thread":http://developer.qt.nokia.com/forums/viewthread/12636 dealing with the same problem.

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

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

        Thanks! What about the 2nd problem :D ?

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

          I cannot reproduce the second error on a Mac. Did you try it with a [[Doc:QTextBrowser]] already?

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alexandros
            wrote on last edited by
            #5

            But the problem IS about a QTextBrowser (look at the title).

            Well, to describe better what the problem is:
            I have this code being called by a timer once a second:
            @
            ui->output->insertPlainText("HELLO PLAIN\n");
            sb->setValue(sb->maximum());
            @
            And here's the screenshot which shows that I clicked inside the QTextBrowser, cursor position changed and output started being placed from there:!http://i.imgur.com/D5c9Y.png(image.png)!

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

              Why don't you use QTextEdit::append()?

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

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alexandros
                wrote on last edited by
                #7

                Because append() seems to add automatically an additional '\n' or '\r' to the end of the string and I just want to display the data coming from my serial port "as is".

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

                  Then you will have to use a [[Doc:QTextCursor]] that you get from the [[Doc:QTextEdit]] or its [[Doc:QTextDocument]], move the cursor position to the end and insert there.

                  BTW: you might be better off using a [[Doc:QPlainTextEdit]] instead of the rich text editor.

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

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alexandros
                    wrote on last edited by
                    #9

                    Thanks a lot! Both problems have been solved :)

                    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