Qt::MatchWildcard issue



  • Hello everyone,
    I am trying to find a match for a particular string with a wildcard character in a QTree , but the values that I find are not what I would expect. For example, I am looking for '_A', all the strings that end with A, but the system is currently returning everything that has an A that is not the first letter of the word. I have a QAbstractItemModel and I am calling the 'match' function with flags Qt::MatchFlags( Qt::MatchWildcard | Qt::MatchRecursive). Am I using the wrong function/flags or doing something else wrong?

    Thank you in advance for the help!


  • Moderators

    and why don't us just use Qt::MatchEndsWith flag?



  • Well I understand in this particular example I could use the MatchEndsWith flag, but since I was using a generic search string and there might be even different wildcard characters in the search string, I thought using Qt::MatchWildcard was generic enough and that Qt would be able to understand which elements to match. Would the Qt::MatchWildcard be enough or should I analyze the search string myself and pass the Qt flags accordingly (Qt::MatchEndsWith, MatchStartsWith, etc.) based on the particular wildcard position?


Log in to reply
 

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