[SOLVED]QTextEdit AlignRight causes issues with wrapMode



  • 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.



  • Try this...

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

    Thanks & Regards...



  • that solved it. thank you


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.