How to add a layout in the QTextEdit.
-
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
-
Hi,
That's a pretty unusual requirement for an edition control. Can you show what you would like to achieve ?
-
Hi,
That's a pretty unusual requirement for an edition control. Can you show what you would like to achieve ?
@SGaist
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. -
@SGaist
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.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.
-
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.
@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? -
@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?@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.