componentsCompleter = new QCompleter(componentsModel,this); componentsCompleter->setCaseSensitivity(Qt::CaseInsensitive); componentsCompleter->setCompletionColumn(componentsModel->fieldIndex("item")); 

How to make the search was not only from the beginning of the line. Those. if I write "force" he throws out the line "let the force be with you"

    1 answer 1

    In the help :

    If filterMode is set to Qt::MatchStartsWith , only those entries will be displayed. Qt::MatchContains Qt::MatchEndsWith the ones that end up with the typed characters.

    what is translated:

    If the filtering mode is set to Qt::MatchStartsWith , then elements starting with the search string will be Qt::MatchStartsWith . If Qt::MatchContains , then contain the desired. Well, if Qt::MatchEndsWith , then only those that end in it.

    Accordingly, if you need to search for strings containing the desired character set, then set the Qt::MatchContains :

     componentsCompleter = new QCompleter(componentsModel,this); componentsCompleter->setCaseSensitivity(Qt::CaseInsensitive); componentsCompleter->setFilterMode(Qt::MatchContains); componentsCompleter->setCompletionColumn(componentsModel->fieldIndex("item")); 
    • Thank. Do not abuse badly) - Alexey Smirnov