QCompleter with Regular Expresions



  • Hi guys.... I need to use QCompleter with Regular Expression and I don't know why... to be exactly, I have a QLineEdit which I need to have the following behaviour:

    Imagine that I have the folowwing list:
    {"RegComp", "Testing the Qt Completer", "We are Testing Regular Expressions"}

    I need that when I type "Test", the completer give me:
    "Testing the Qt Completer"
    "We are Testing Regular Expressions"
    If I type "Test Reg" the completer give me:
    "We are Testing Regular Expressions"

    How can I do that ?? because the QCompleter doesn't have this behaviour

    regards


  • Lifetime Qt Champion

    Hi,

    Can you show how you setup your QLineEdit + QCompleter ?

    And which version of Qt are you using ?



  • @SGaist

    Hi SGaist and thanks for always answer me...

    I'm trying to do the same as the example in the assistance for the QCompleter help. The model is a list of strings, but I need to search using regular expressions

    regards


  • Lifetime Qt Champion

    Then completer->setFilterMode(Qt::MatchContains); should get you what you want.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.