Unsolved QTextEdit Vertical Alignment Error.
-
Qt 5.4 I am using Windws8 64Bit and Linux 64Bit.
Can not Vertically Align Text in QTextEdit?
Horizontal alignment is normal for left, center, and right, but vertical alignment is not for top, middle, and bottom alignment.
-
Hi,
Why such an outdated version of Qt ? Can you update ? Current version is 5.12.
Can you show how you setup the content of your QTextEdit ?
A minimal compilable example would be the test. -
Currently only 5.4 or 5.7 are available.
textEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute | Qt::AlignVCenter);
I set it like this.
Then the text is left aligned and the Vertical Align is in the middle but it does not move.
-
@Pada_ You can't align vertically with setAlignment: https://doc.qt.io/qt-5/qtextedit.html#setAlignment
"Valid alignments are Qt::AlignLeft, Qt::AlignRight, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally)."I don't know whether there are other possibilities.
-
-
-
You are comparing unrelated widgets.
Can you show what exact result you want to achieve ?
-
It's an irrelevant widget, but I want to do it in QTextEdit.
The purpose is to look like that.
-
@Pada_ Like what? There is no image in your last post.
Why do you want to align text vertically in the center in QTextEdit? This is quite unusual. -
I want to bet is the same as the above picture.
QTextEdit should also be vertically aligned to top, middle, and bottom.
The reason for using this feature is simple. I am creating an Editor personally. This is a required function.
-
@Pada_ said in QTextEdit Vertical Alignment Error.:
I want to bet is the same as the above picture.
As I said there is no picture.
To make it clear: do you want to align text inside QTextEdit, or do you want to align QTextEdit in a layout?
I never used a text editor which aligns text vertically in the center. -
I do not know if you will use it, but I need it now to develop. I want to arrange it like a photo inside a text item, not a layout.