[SailfishDevel] Problem with SearchField hiding and clearing on text entry

Pekka Vuorela pekka.vuorela at jolla.com
Tue Feb 17 08:41:09 UTC 2015

ma, 2015-02-16 kello 15:49 +0100, Tadeusz Sośnierz kirjoitti:
> Hey,
> I started writing myself a little app with D&D spell list. Worked well
> enough until I tried the search functionality. I'm using SilicaListView
> with SearchField in it to grep through the QSqlTableModel, and when I
> type one letter into the search box it clears itself and defocuses the
> keyboard. The search still occurs, for that single letter that got typed in.
> [1] is where I react on keyboard input. If I comment out spells.search()
> line the issue with SearchField no longer occurs (but it's pretty
> useless for obvious reasons). That makes me think that something on the
> C++ side is wrong ([2]), but I don't see why it would affect the view so
> dramatically.
> Could anyone point out where did I screw it up? General code criticism
> is welcome too :)

I'd guess ListView recreates the header item on model reset (you can
verify by Component.onCompleted debug output). In such case you could
either try make model not do that, or then move the search field out of
header. Perhaps some hack like dummy item on header to reserve space and
then search field parented to it could provide similar UI.

More information about the Devel mailing list