Results 1 to 3 of 3

Thread: Finding text on Text edit

  1. #1
    Join Date
    Apr 2006
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Finding text on Text edit

    Created one QTextEdit widget named inputPane
    Displaying text using syntax
    m_uiMainWindow.inputPane->append(QString(designFile.readAll()));

    Now I want to Find expr in the file displayed on input pane & highlight the same, but I am not able to do so.

    Pls help.
    I have used
    if(m_uiMainWindow.inputPane->find(expr))
    {
    QMessageBox::information(this,tr("Find"),tr("Found "));
    }
    I am able to see "Found" message but I am not clear with what is to be done to highlight the found text.

  2. #2
    Join Date
    May 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Finding text on Text edit

    Perhaps could you use a QSyntaxHilighter ? Looks ugly though.
    Visit my personal website (Qt tutorials, Ruby, Mac OS X and more): The Fifth Essence

  3. #3
    Join Date
    May 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Finding text on Text edit

    From the Qt Assistant: "QTextEdit::find(...): Returns true if exp was found and changes the cursor to select the match". So your text should already be selected. If it isn't, it looks like a Qt bug to me.
    Visit my personal website (Qt tutorials, Ruby, Mac OS X and more): The Fifth Essence

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Character encoding in text edit and llne edit
    By greenvirag in forum Qt Programming
    Replies: 3
    Last Post: 20th January 2009, 08:45
  3. Replies: 1
    Last Post: 15th January 2009, 10:34
  4. how to read from text edit in QT4
    By iamjayanth in forum Qt Programming
    Replies: 3
    Last Post: 17th October 2008, 12:51
  5. Replies: 8
    Last Post: 15th May 2007, 09:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.