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. QTextEdit alignment doesn't work
Qt 6.11 is out! See what's new in the release blog

QTextEdit alignment doesn't work

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.5k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MasterBlade
    wrote on last edited by
    #1

    Hello I have a QTextEdit and used setAlignment(Qt::AlignCenter); on the constructor.

    Later I used setText(QString); but the string is aligned to the left. What should I do?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Since QTextEdit works in paragraphs, you need to set alignment for each
      https://stackoverflow.com/questions/25855024/aligning-text-in-qtextedit

      M 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        Since QTextEdit works in paragraphs, you need to set alignment for each
        https://stackoverflow.com/questions/25855024/aligning-text-in-qtextedit

        M Offline
        M Offline
        MasterBlade
        wrote on last edited by
        #3

        @mrjj said in QTextEdit alignment doesn't work:

        Hi
        Since QTextEdit works in paragraphs, you need to set alignment for each
        https://stackoverflow.com/questions/25855024/aligning-text-in-qtextedit

        Thank you for the reply. Since I only need a single line instead of paragraphs, I'll switch to QLineEdit. That would surely make things much easier.

        1 Reply Last reply
        1

        • Login

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