Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2006
QCompleter and QAbstractItemModel


Message 1 in thread

Hi there,

I'd like to use Qt 4.2's Completer+QLineEdit to replace one of my older homegrown widgets. The underlaying data is well representable in a Tree, so I derieved a class from QAbstractItemModel and provided it to the Completer via setModel.
The problem is: it doesn't work.
The Model methods do not even get called. ( rowCount and columnCount directly when executing setModel, but that was it ).
I tried it with other AbstractItemModel-Derieved classes in the Application, that work fine in QTreeViews - not working either.

QCompleter and QDirModel work fine though....

Any Ideas?

Greets
Sebastian

--
 [ signature omitted ] 

Message 2 in thread

On Friday 08 December 2006 16:01, Morawietz, Sebastian (LNG-MUE) wrote:
> Hi there,
>
> I'd like to use Qt 4.2's Completer+QLineEdit to replace one of my older
> homegrown widgets. The underlaying data is well representable in a Tree, so
> I derieved a class from QAbstractItemModel and provided it to the Completer
> via setModel. The problem is: it doesn't work.
> The Model methods do not even get called. ( rowCount and columnCount
> directly when executing setModel, but that was it ). I tried it with other
> AbstractItemModel-Derieved classes in the Application, that work fine in
> QTreeViews - not working either.
>
> QCompleter and QDirModel work fine though....
>
> Any Ideas?
>
> Greets
> Sebastian
>
> --

Did you subclass QCompleter and implement the two virtual functions to work 
with your model?

-Benjamin Meyer

--
 [ signature omitted ] 

Message 3 in thread

Am Montag 11 Dezember 2006 01:17 schrieb Benjamin Meyer:

> Did you subclass QCompleter and implement the two virtual functions to work
> with your model?

*sigh*
sometimes you just fail to see the forest, because the trees are in your 
way...

I declared the completer on the Stack, and it went out of scope before 
anything interesting could happen...  :)

Thanks anyway...

Greetz
Sebastian

--
 [ signature omitted ]