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

QTextBlock::previous() behavior regressed for invalid blocks

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.4
    • 4.7.2
    • GUI: Font handling
    • None
    • Self compiled (from git tag) on Linux 64 bit + gcc 441
    • 1b326932d48c0e584f9d5173fa5f892c5086fee8

    Description

      The code;
      QTextDocument doc;
      QTextBlock block = doc.begin();
      QTextBlock nextBlock = block.next(); // note this one is invalid!
      QTextBlock lastValid one = nextBlock.previous();
      qDebug() << lastValid.isValid();

      QTextBlock last = doc.end().previous();
      qDebug() << last.isValid();

      behaves differently between 4.7.2 and earlier versions.
      It looks like using a QTextBlock as an interator is no longer possible due to this change and I think thats a consistency bug. I expect that much like a QList<T>::Iterator the 'entry-after-last' to be possible to go back one and get a valid entry again.

      Attachments

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

        Activity

          People

            jiang Jiang Jiang
            tzander zander
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes