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.sosni...@onet.pl>
wrote:

> 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@lists.
> sailfishos.org
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to