Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Align text in right
QtWS25 Last Chance

Align text in right

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.3k Views
  • 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 Offline
    F Offline
    felipe.c.sousa
    wrote on last edited by
    #1

    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
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        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
        0
        • F Offline
          F Offline
          felipe.c.sousa
          wrote on last edited by
          #4

          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
          0
          • F Offline
            F Offline
            felipe.c.sousa
            wrote on last edited by
            #5

            arg.. the qt project eat my spaces..

            i want my cents aling, one under the other.

            From all, to all.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              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
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                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
                0
                • F Offline
                  F Offline
                  felipe.c.sousa
                  wrote on last edited by
                  #8

                  thanks! i will try using that.

                  From all, to all.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved