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. [SOLVED]QTextEdit AlignRight causes issues with wrapMode
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QTextEdit AlignRight causes issues with wrapMode

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k 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.
  • B Offline
    B Offline
    b1gsnak3
    wrote on last edited by
    #1

    I have a simple program like this:

    @
    #include <QTextEdit>
    #include <QApplication>

    int main(int argc, char *argv[]) {

    QApplication app(argc, argv);
    QTextEdit *te = new QTextEdit();

    te->setLineWrapMode(QTextEdit::WidgetWidth);
    te->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    te->document()->setDefaultTextOption(QTextOption(Qt::AlignRight));
    te->show();

    return app.exec();
    }
    @

    this code seems to not wrap correctly at the end of a widget. If, for example, you fill the line with random letters it doesn't jump to the next line when the limit is reached. If I remove the alignment it works perfectly. Is there any options I must set for it to work correctly?

    Thank you in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Macro
      wrote on last edited by
      #2

      Try this...

      @te->setAlignment(Qt::AlignRight);@

      Thanks & Regards...

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b1gsnak3
        wrote on last edited by
        #3

        that solved it. thank you

        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