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 add a layout in the QTextEdit.
Forum Updated to NodeBB v4.3 + New Features

How to add a layout in the QTextEdit.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 497 Views 3 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1

    How to add a layout in the QTextEdit.
    for example a verticalLayout in the bottom of the textEdit widget,so that if i scolled the bar to the bottom ,I saw the bottom contents of the textEdit?

    QTextEdit : public QAbstractScrollArea

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      That's a pretty unusual requirement for an edition control. Can you show what you would like to achieve ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      nicker playerN 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        That's a pretty unusual requirement for an edition control. Can you show what you would like to achieve ?

        nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote on last edited by nicker player
        #3

        @SGaist 22a91879-919a-4a14-9c7c-60568ec61aa7-image.png
        the red part is the scroll of the QTextWidget,I just want to add some widgets on the bottom of the textedit,so that I could use the purple scroll to move the green part up and down with the QTextEdit content.It looks like that the green layout is part of the textedit.

        M 1 Reply Last reply
        0
        • nicker playerN nicker player

          @SGaist 22a91879-919a-4a14-9c7c-60568ec61aa7-image.png
          the red part is the scroll of the QTextWidget,I just want to add some widgets on the bottom of the textedit,so that I could use the purple scroll to move the green part up and down with the QTextEdit content.It looks like that the green layout is part of the textedit.

          M Offline
          M Offline
          mpergand
          wrote on last edited by mpergand
          #4

          @nicker-player

          In the Designer you can do:

          • start with a scrollArea as the root widget of your window (or central widget)
          • put your textEdit in the scrollArea
          • right click in the scrollArea and set the layout to vertical
          • add another widget at the bottom, or add an horizontal layout if you want to have several widgets at the bottom

          You have to set a minimal height to the textEdit for the scroll bar to appears.

          nicker playerN 1 Reply Last reply
          0
          • M mpergand

            @nicker-player

            In the Designer you can do:

            • start with a scrollArea as the root widget of your window (or central widget)
            • put your textEdit in the scrollArea
            • right click in the scrollArea and set the layout to vertical
            • add another widget at the bottom, or add an horizontal layout if you want to have several widgets at the bottom

            You have to set a minimal height to the textEdit for the scroll bar to appears.

            nicker playerN Offline
            nicker playerN Offline
            nicker player
            wrote on last edited by
            #5

            @mpergand
            Ive tried the way you just mentioned ,but there is a problem that if i moved the middle button of the mouse,the scroll of the QTextEdit moved ,not the scrollArea widget moved.And another problem is that the expanding policy seemed unuseless for the scrollArea.
            do I have to rewrite the mouse events of the scroll?

            M 1 Reply Last reply
            0
            • nicker playerN nicker player

              @mpergand
              Ive tried the way you just mentioned ,but there is a problem that if i moved the middle button of the mouse,the scroll of the QTextEdit moved ,not the scrollArea widget moved.And another problem is that the expanding policy seemed unuseless for the scrollArea.
              do I have to rewrite the mouse events of the scroll?

              M Offline
              M Offline
              mpergand
              wrote on last edited by
              #6

              @nicker-player said in How to add a layout in the QTextEdit.:

              if i moved the middle button of the mouse,the scroll of the QTextEdit moved ,not the scrollArea widget move

              When the scroll of the text edit reach the bottom, the scroll of the main widget begins.

              To be honest, nested scroll areas are very bad design.

              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