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 start text from down in QTextEdit
Forum Updated to NodeBB v4.3 + New Features

How to start text from down in QTextEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.4k 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
    ARASHz4
    wrote on last edited by A Former User
    #1

    Hi
    I have a QTextEdit and i want to show text in bottom of QTextEdit

    matthew.kuiashM 1 Reply Last reply
    0
    • A ARASHz4

      Hi
      I have a QTextEdit and i want to show text in bottom of QTextEdit

      matthew.kuiashM Offline
      matthew.kuiashM Offline
      matthew.kuiash
      wrote on last edited by
      #2

      @ARASHz4 I'm sorry. I can't understand you question. What do you mean by "down"?

      The legendary cellist Pablo Casals was asked why he continued to practice at age 90. "Because I think I'm making progress," he replied.

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Well I guess on:
        Showing the last text so to speak.

        You can make it scroll down by
        ui->textEdit->verticalScrollBar()->setValue(ui.textEdit->verticalScrollBar()->maximum());

        If that is not what what you mean, then please spend little more time to describe better what you try to do :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ARASHz4
          wrote on last edited by ARASHz4
          #4

          my mean is the pointer start in last line
          something like Telegram messenger

          alt text

          mrjjM 1 Reply Last reply
          0
          • A ARASHz4

            my mean is the pointer start in last line
            something like Telegram messenger

            alt text

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @ARASHz4
            You can move the cursor with
            QTextCursor textCursor = ui->textEdit->textCursor();
            textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor,1);
            ui->textEdit->setTextCursor(textCursor);

            A 1 Reply Last reply
            4
            • mrjjM mrjj

              @ARASHz4
              You can move the cursor with
              QTextCursor textCursor = ui->textEdit->textCursor();
              textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor,1);
              ui->textEdit->setTextCursor(textCursor);

              A Offline
              A Offline
              ARASHz4
              wrote on last edited by
              #6

              @mrjj I test this but don't work

              J.HilkJ mrjjM 2 Replies Last reply
              0
              • A ARASHz4

                @mrjj I test this but don't work

                J.HilkJ Online
                J.HilkJ Online
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @ARASHz4

                it should,
                but I guess you want to curser at the end of your document?

                than you'll have to replace

                QTextCursor::Start with QTextCursor::End
                

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                3
                • A ARASHz4

                  @mrjj I test this but don't work

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  @ARASHz4
                  Well its a sample for "how to move the cursor"
                  you must look at the doc and understand the code....
                  Then it will work :)

                  Thank you to @J-Hilk for doing it for you :)

                  1 Reply Last reply
                  2

                  • Login

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