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

QTextEdit Find Backward (flag QTextDocument::FindBackward) bug

    XMLWordPrintable

Details

    • a4f79313f065815451610dabdbbb33b8a35f0a86 (qt/qtbase/5.12)

    Description

      The find bachward flag skips the first previous occurence of a search
      Here is the procedure :

      void MainWindow::findNext(QString texte,bool fBackward,bool fCaseSensitive, bool fWholeWord)
      
      {
      QTextDocument::FindFlags flag=0;
      
      if (fBackward) 
      flag= QTextDocument::FindBackward;
      
      if (fCaseSensitive)
      flag = flag | QTextDocument::FindCaseSensitively;
      
      if (fWholeWord)
      flag = flag | QTextDocument::FindWholeWords;
      
      bool f=textEdit->find(texte,flag);
      
      }
      
      Attached is the example which can be used to see this.
      Steps
      Run the example
      Bring the cursor at the beginning of the last 'a' in list then click Button "search backward for 'a'"

      If in the textedit document there is the following text (a "a" character on each line as shown)

      a
      a
      a
      a
      

      When the cursor is at the end of the document, the find backward mode skips one "a" on 2.

      Attachments

        1. qtbug48035.zip
          451 kB
          Irfan Omair
        For Gerrit Dashboard: QTBUG-48035
        # Subject Branch Project Status CR V

        Activity

          People

            vgt Eirik Aavitsland
            tenorr Olivier RONAT
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes