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

QTextEdit: layout problem with text frames and floating text

    XMLWordPrintable

Details

    Description

      There are layout problems in QTextEdit related to text frames, where text flows along the right hand side.

      • The yellow background of the text block floating at the right hand side of the frame covers part of the frame.
      • The left margin property of the text block is not obeyed when floating beside the frame.

      Example program:

      #include <QApplication>
      #include <QTextEdit>
      #include <QTextCursor>
      #include <QTextFrameFormat>

      int main(int argc, char* argv[])
      {
      QApplication app(argc, argv);
      QTextEdit edit;

      QString text = "Test Test Test Test Test Test Test Test Test Test Test "
      "Test Test Test Test Test Test Test Test Test Test Test.";
      edit.append(text);

      QTextCursor c = edit.textCursor();
      c.movePosition(QTextCursor::End);

      QTextFrameFormat ff;
      ff.setBorder(1);
      ff.setPosition(QTextFrameFormat::FloatLeft);
      ff.setWidth(120);
      c.insertFrame(ff);
      c.insertText(text);

      c.movePosition(QTextCursor::End);
      c.insertBlock();

      QTextBlockFormat bf;
      bf.setBackground(Qt::yellow);
      bf.setLeftMargin(10);
      c.insertBlock(bf);
      c.insertText(text);

      edit.show();
      return app.exec();
      }

      Note: This requires bigger changes in the layouting process to obey frame ordering.

      Attachments

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

        Activity

          People

            shausman Simon Hausmann
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes