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

Krisztian Olah fasza2mobile at gmail.com
Tue Feb 17 11:07:17 UTC 2015

Hi Tadeusz,

Although Qt docs don't mention it specifically, I suspect that
QSqlTableModel's setFilter method resets the model causing the attached
views redrawing themselves, including their headers. You clould use a
QSortFilterProxyModel which would not reset upon setting its filter,
resulting in the desired behaviour.

Regards Kris

On 16 February 2015 at 14:49, Tadeusz Sośnierz <tadeusz.sosnierz at onet.pl>

> 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 :)
> Best regards,
> Tadeusz Sośnierz
> [1]
> https://github.com/tadzik/harbour-dndhelper/blob/master/
> qml/pages/SpellList.qml#L16
> [2]
> https://github.com/tadzik/harbour-dndhelper/blob/master/src/Spells.cpp#L74
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.
> sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150217/2f6a0ff4/attachment-0001.html>

More information about the Devel mailing list