How to right-justify QLabel text
Hi, this is what I'm getting:
1000
100
10
1
but this is what I want, sans the underlines:
1000
_100
__10
___1
How do I do this? Each of the numbers is a QLabel set at a fixed position.
I have tried many variations setting the alignment with Qt::AlignRight, Qt::AlignJustify, and setting the layout direction Qt::RightToLeft in the hopes that some combination would work, but it doesn't.
Re: How to right-justify QLabel text
AlignRight should work. If it doesn't then it's probably because your labels are not aligned correctly relative to each other. Put them all into a single vertical layout.
Re: How to right-justify QLabel text
See Qt::AlignAbsolute:
Quote:
If the widget's layout direction is Qt::RightToLeft (instead of Qt::LeftToRight, the default), Qt::AlignLeft refers to the right edge and Qt::AlignRight to the left edge. This is normally the desired behavior. If you want Qt::AlignLeft to always mean "left" and Qt::AlignRight to always mean "right", combine the flag with Qt::AlignAbsolute