Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTEXTEDIT FIND BACKWARD
Forum Update on Monday, May 27th 2025

QTEXTEDIT FIND BACKWARD

Scheduled Pinned Locked Moved General and Desktop
qtextedit
6 Posts 3 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Olivier Ronat
    wrote on 30 Aug 2015, 07:14 last edited by
    #1

    I don't understand why the find forward is working well but not the find backwark (flag QTextDocument::FindBackward) that skips the first previous occurence of a search). How to solve this issue?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 30 Aug 2015, 11:48 last edited by
      #2

      Hi and welcome to devnet,

      can you post some examples of code that shows your problem? Sorry but we don't have yet a crystal ball :)

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • O Offline
        O Offline
        Olivier Ronat
        wrote on 30 Aug 2015, 12:35 last edited by
        #3

        void MainWindow::rechercheNext(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);
        }

        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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on 30 Aug 2015, 21:35 last edited by
          #4

          Hi,

          you're right, I tried with my code and the behaviour is the same you described.
          I'm with Qt 5.5.0 on OS X 10.10.

          IMO you could open a bugreport

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • O Offline
            O Offline
            Olivier Ronat
            wrote on 6 Sept 2015, 19:34 last edited by
            #5

            I have reported the bug. I will feed back when the issue is solved

            1 Reply Last reply
            2
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 6 Sept 2015, 20:03 last edited by
              #6

              Hi,

              Can you share the bug report link ? That will make it easier for others to find it

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              6/6

              6 Sept 2015, 20:03

              • Login

              • Login or register to search.
              6 out of 6
              • First post
                6/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved