Align text in right
-
Hi, I am trying align money values to right. I am writing in a txt, that’s possible?
I try use QLocale, but dont work. -
Hi,
Most text GUI widgets have settings to set the alignment inside the widget. It is default set to AlignLeft in designer. Maybe add a picture how you want it, or what your application should do it or be displayed. It's not really clear right now.
Greetz -
It probably depends on the widget you are using for instance QTextEdit you can set the "alignment":http://qt-project.org/doc/qt-4.8/qtextedit.html#setAlignment
QLocale is more for translating to language specifics, but does not have an alignment option AFAIK. -
i have a file like that:
name price qntd
soap 3,54 1
coff 13,59 2
gold 135,76 5
i want to be like that:
name price qntd
soap 3,54 1
coff 13,59 2
gold 135,76 5i use a table, and then i can align, but when i create a txt file.....
p.s.- sorry for my english. rsrss -
arg.. the qt project eat my spaces..
i want my cents aling, one under the other.
-
if you are using a plain ASCII text file you may use the standard "C++ alignment for output streams":http://www.cplusplus.com/reference/ios/right/?kw=right
-
Or you can do it the Qt way with "QTextStream":http://qt-project.org/doc/qt-4.8/qtextstream.html#fieldAlignment for instance
-
thanks! i will try using that.