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. how to prevent textbrowser from being modified?

how to prevent textbrowser from being modified?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.5k 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.
  • chaochaoC Offline
    chaochaoC Offline
    chaochao
    wrote on last edited by
    #1

    Now,i use textbrowser as central wigdet and use function insertplaintext to display on textbrowser.If i do not click the textbrowser,insertplaintext can inset at the last .but if i click it,insertplaintext will inset from my clicked position. What i want is that insertplaintext is always at the last positon. how to do that? thank for your help.

    jsulmJ raven-worxR 2 Replies Last reply
    0
    • chaochaoC chaochao

      Now,i use textbrowser as central wigdet and use function insertplaintext to display on textbrowser.If i do not click the textbrowser,insertplaintext can inset at the last .but if i click it,insertplaintext will inset from my clicked position. What i want is that insertplaintext is always at the last positon. how to do that? thank for your help.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @chaochao What about http://doc.qt.io/qt-5/qtextedit.html#append ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      chaochaoC 1 Reply Last reply
      0
      • chaochaoC chaochao

        Now,i use textbrowser as central wigdet and use function insertplaintext to display on textbrowser.If i do not click the textbrowser,insertplaintext can inset at the last .but if i click it,insertplaintext will inset from my clicked position. What i want is that insertplaintext is always at the last positon. how to do that? thank for your help.

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @chaochao

        QTextCursor c( textEdit->document() );
        c.movePosition( QTextCursor::End );
        c.insertBlock();
        c.insertText( ... );
        

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        chaochaoC 1 Reply Last reply
        1
        • jsulmJ jsulm

          @chaochao What about http://doc.qt.io/qt-5/qtextedit.html#append ?

          chaochaoC Offline
          chaochaoC Offline
          chaochao
          wrote on last edited by
          #4

          @jsulm can not use append.i dont know why。append will display wrong like this.

          append:

          a
          d
          c data :2
          .50,

          a
          d
          c data :2
          .50,
          insertPlainText:
          adc data :2.50,
          adc data :2.50

          1 Reply Last reply
          0
          • raven-worxR raven-worx

            @chaochao

            QTextCursor c( textEdit->document() );
            c.movePosition( QTextCursor::End );
            c.insertBlock();
            c.insertText( ... );
            
            chaochaoC Offline
            chaochaoC Offline
            chaochao
            wrote on last edited by
            #5

            @raven-worx no ,it will display err like when i use append.
            QByteArray data = _serial->readAll();
            this is my data to be diplayed on textbrowser.

            raven-worxR 1 Reply Last reply
            0
            • chaochaoC chaochao

              @raven-worx no ,it will display err like when i use append.
              QByteArray data = _serial->readAll();
              this is my data to be diplayed on textbrowser.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @chaochao
              to make it clear.

              You get this:

              a
              d
              c data :2
              .50,
              
              a
              d
              c data :2
              .50,
              

              but want it to display like this?

              adc data :2.50,
              adc data :2.50
              

              If this is the case the question is when you are doing the call to readAll() and append it.

              Since it seems you are reading from a serial device, i guess you are just calling it whenever new data is available. Every call to append creates a new paragraph. So if your received data just contains a single character and append it you get this.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              3

              • Login

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