[Qt-creator] QCompleter with Regular Expresion
Tomaz Canabrava
tcanabrava at kde.org
Fri Jul 31 20:19:55 CEST 2015
On Fri, Jul 31, 2015 at 3:09 PM, Freddy Martinez Garcia <
freddy311082 at gmail.com> wrote:
> I can't use combobox because the lineedit is used for searching...
>
You can use a QLineEdit and a QListView to get the same effect as the
QCompleter,
you need to hook up a few things, of course:
QLineEdit::textChanged signal should be connected to the
QSortFilterProxyModel::invalidate
QSortFilterProxyModel should be the model on the QListView
the show/hide events of the QListView should be deal with and you will need
a eventFilter to handle the up/down keys to send them to the QListView from
within the QLineEdit
It's doable ( I have something like this in my particular software if you
wanna take a look ) - I had to create this because QCompleter doesn't deal
with QRegExp.
(also, if it's desirable, we could add a new CompletionMode on QCompleter -
QCompleter::RegExpCompletion )
> about the QSirtFilterProxyModel, the problems is that QComplet build his
> own model inside when you give him a model... is what i'm seeing in its
> behavior...
>
> for that is my question
>
> regards
>
>
>
>
> *============================================="El tamaño de tus logros
> depende del tamaño de tus metas." *
>
> *C++ and Qt Senior Developer*
>
> *Lic. Computer Science*
>
> *Buenos Aires, Argentina*
>
>
> 2015-07-31 13:29 GMT-03:00 Tomaz Canabrava <tcanabrava at kde.org>:
>
>>
>>
>> On Fri, Jul 31, 2015 at 1:20 PM, Freddy Martinez Garcia <
>> freddy311082 at gmail.com> wrote:
>>
>>> Hi guys... can I use regular expressions with QCompleter ???
>>>
>>
>> You cant easily do that ( unless you override the model that QCompleter
>> has ), but you can use a QSortFilterProxyModel and a QComboBox with the
>> same effect.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150731/2aa071ad/attachment.html>
More information about the Qt-creator
mailing list