PDA

View Full Version : Qcompleter



wambagilles
23rd March 2011, 00:24
hi, i used a Qcompleter in the address bar of my browser, for autocompletion, but the problem is that the completion is only provided base on the prefix, is it possible to provide completion when the word type in the address bar is contains in any item in the completion list? if so, how?

wambagilles
29th March 2011, 17:32
please help!!!

SixDegrees
29th March 2011, 21:29
No, this is not possible. Although you can set the column to begin comparison on, CompletionModels implicitly require a prefix in order to work.

You could implement your own widget to do something like what you require. Doing so will show why it is a bad idea: because you're forced to check every position of every word in your list.

Question: is the user really so incompetent that they can't be counted on to type correctly? Or will type correctly, but precede the correct portion with random gibberish?

Perhaps you should explain exactly what it is you're trying to do. Frankly, it sounds ill considered from what you've presented here, but perhaps a more detailed explanation will suggest a reasonable approach.

wambagilles
29th March 2011, 22:22
thanks for your reply, and sorry for the quality of my english, i am french man!
what i wanted is somting like in firefox or chrome, when you start typing an address in the adress bar, completion is provided based on the history! and this completion is not only done only using a prefix! for example, if the item "http://qtcentre.org" is in the completion list, i want it to be shown when the user type qt..., not only when he types http...! i hope i am a bit clearer now, could could you suggest me a method to do that?

schnitzel
29th March 2011, 22:27
does this help?

http://www.qtcentre.org/threads/6900-a-smarter-QCompleter

SixDegrees
29th March 2011, 23:11
thanks for your reply, and sorry for the quality of my english, i am french man!
what i wanted is somting like in firefox or chrome, when you start typing an address in the adress bar, completion is provided based on the history! and this completion is not only done only using a prefix! for example, if the item "http://qtcentre.org" is in the completion list, i want it to be shown when the user type qt..., not only when he types http...! i hope i am a bit clearer now, could could you suggest me a method to do that?

If you want to begin with a specified column in the completion list, QCompleter supports that. It does not support unbounded searches throughout the string.

wambagilles
30th March 2011, 07:01
i think it will help, thanks!

wambagilles
6th April 2011, 08:14
sorry i have not been able to use your QcompletionWidget, instead i reimplemented the Qcompleter class, now, i want to reimplement the method

QAbstractItemModel *completionModel () const;

so that i will populate the completion model my self!
is that a good way to solve the problem? if yes, how should i do it? for example if i want to put the item "http://qtcentre.org" in completion list how should i do? if not, please what is a good way to solve this problem?

need help!