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. Qt::AlignJustify not working
Forum Updated to NodeBB v4.3 + New Features

Qt::AlignJustify not working

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 2.1k Views 2 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.
  • P Offline
    P Offline
    Pippin
    wrote on last edited by Pippin
    #1

    Hello,

    I've been having this problem for quite some time and I'd like to solve it once and for all. The following line, in the constructor of a QMainWindow's derived class, doesn't work.

    myQTextEdit->setAlignment(Qt::AlignJustify)
    

    The text is never justified whatsoever. Does alignment require anything to work besides setting it? Also, does it matter that the text is set after the alignment?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      From the documentation: "Sets the alignment of the current paragraph to a".
      So yes, if you're using setText()you must set the alignment after you set the text, otherwise you're setting it for whatever was in the text edit before that.
      Also note that if you use something like append() to add text you will need to move the cursor to the right position to set the alignment, as the setAlignment affects only current paragraph.

      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