tags:

views:

32

answers:

1

I am trying to make QCompleter match several equivalent options which are separated with commas. There seemingly is no easy way to do that, but one line of QCompleter reference caught my attention, describing function QCompleter::splitPath: "When used with list models, the first item in the returned list is used for matching." Could this be used in the way I need - split the input string and return it so the unfinished last item is the first in the list? I didn't manage to make it work, but I may be doing something wrong.

A: 

From what I understand from your question and the doc, you could separate the user-inputted string with commas and make your completer check in your model for a completion.

BUT, after each comma, the index of your model (figure it like a two-dimension array of string) will be incremented.

For example, if you have the following input:

ABCD, EFGH, IJ

and you would like to the completer to finish IJ KL, you would have to have a model that is at least 3 indexes wide because the first text (ABCD) would be completed with the strings in the first column, EFGH would be completed with the second column of your model, etc.

So, I don't know if it could be used in your application.

Best of luck.

Live