Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Align text in right

    General and Desktop
    3
    8
    1891
    Loading More Posts
    • 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.
    • F
      felipe.c.sousa last edited by

      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.

      From all, to all.

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        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

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • K
          koahnig last edited by

          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.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply Reply Quote 0
          • F
            felipe.c.sousa last edited by

            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 5

            i use a table, and then i can align, but when i create a txt file.....
            p.s.- sorry for my english. rsrss

            From all, to all.

            1 Reply Last reply Reply Quote 0
            • F
              felipe.c.sousa last edited by

              arg.. the qt project eat my spaces..

              i want my cents aling, one under the other.

              From all, to all.

              1 Reply Last reply Reply Quote 0
              • K
                koahnig last edited by

                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

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply Reply Quote 0
                • K
                  koahnig last edited by

                  Or you can do it the Qt way with "QTextStream":http://qt-project.org/doc/qt-4.8/qtextstream.html#fieldAlignment for instance

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply Reply Quote 0
                  • F
                    felipe.c.sousa last edited by

                    thanks! i will try using that.

                    From all, to all.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post