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

QTextBoundaryFinder.boundaryReasons() returns incorrect values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.7.4
    • 4.6.2
    • None
    • Ubuntu 10.04

      Unless I am misunderstanding how to use it, the QTextBoundaryFinder is not returning the correct values for the boundaryReasons() in certain cases. Here is a sample app:

      int main()
      {
          QTextStream out(stdout);
          QTextBoundaryFinder finder(QTextBoundaryFinder::Word,
                                     QLatin1String("This is a test"));
          finder.toStart();
          int previousBoundary = finder.position();
          int currentBoundary = finder.toNextBoundary();
          while (currentBoundary != -1) {
              out << "Boundary: " << qSetFieldWidth(10)
                      << previousBoundary
                      << currentBoundary
                      << finder.boundaryReasons().testFlag(QTextBoundaryFinder::NotAtBoundary)
                      << finder.boundaryReasons().testFlag(QTextBoundaryFinder::StartWord)
                      << finder.boundaryReasons().testFlag(QTextBoundaryFinder::EndWord)
                      << endl;
              previousBoundary = currentBoundary;
              currentBoundary = finder.toNextBoundary();
          }
          return 0;
      }
      

      This finds all the boundaries correctly, but the boundaryReasons() flag is not correct between the "is" and the "a". This is showing that at the boundary at position 8 (just before "a" is not only at the start of a word (which is correct) but also at the end of a word (which is incorrect.)

      Boundary:          0         4         0         0         1         
      Boundary:          4         5         0         1         0         
      Boundary:          5         7         0         0         1         
      Boundary:          7         8         0         1         1         
      Boundary:          8         9         0         0         1         
      Boundary:          9        10         0         1         0         
      Boundary:         10        14         0         0         1         
      

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

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            dmateer Dave Mateer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes