Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3417

QTextEdit Wrap Policy Issue

    XMLWordPrintable

Details

    Description

      Setting QTextOption::WrapAtWordBoundaryOrAnywhere for the wordWrapMode and QTextEdit::FixedColumnWidth for the lineWrapMode does not work correctly. The text will wrap anywhere even if there is a space in the line. Consider the following example:

      #include <QtGui>

      class Widget : public QWidget
      {
      Q_OBJECT
      public:
      Widget(QWidget *parent = 0)
      : QWidget(parent)

      { QTextEdit *edit = new QTextEdit(this); edit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); edit->setLineWrapMode(QTextEdit::FixedColumnWidth); edit->setLineWrapColumnOrWidth(10); QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->addWidget(edit); }

      public slots:
      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      Widget w;
      w.show();
      return a.exec();
      }

      With the input "foobar1 foobar2", the line should break after foobar1. It instead breaks at fo-obar2.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mch Jervey Kong
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes