Results 1 to 2 of 2

Thread: How to use QStringMatcher ?

  1. #1
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to use QStringMatcher ?

    Hi everybody,

    my question is mostly general not especially for QStringMatcher.

    I wan to create widjet with Lineedit, Text edit and Qpushbutton.
    When the user enter some text in the texteidt and than enter some word(string) in line edit and push the button, the program must mark in some color the matched string in the text.

    What i do:
    - i open QtCreator
    - create GUI application Widget and rename it text
    - than open ui file and drag-drop the line edit, text edit and Qpushbutton.
    My question is: how and where in the header file to introduce the QStringMatcher (if it is the right choice) in order to do the requested function?

    Thank you a lot previously.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to use QStringMatcher ?

    Quote Originally Posted by unix7777 View Post
    my question is mostly general not especially for QStringMatcher.
    So why does the title suggest it is about QStringMatcher?

    My question is: how and where in the header file to introduce the QStringMatcher (if it is the right choice) in order to do the requested function?
    Use QRegExp and a line edit with custom painting. QStringMatcher is tailored for a situation when you compare a pattern against lots of strings (i.e. when searching for something):
    Quote Originally Posted by QStringMatcher docs
    This class offers no benefit if you are doing one-off string matches
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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
  •  
Qt is a trademark of The Qt Company.