Re: [SailfishDevel] Problem with SearchField hiding and clearing on text entry
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 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
Re: [SailfishDevel] Problem with SearchField hiding and clearing on text entry
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. ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
[SailfishDevel] Problem with SearchField hiding and clearing on text entry
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-unsubscr...@lists.sailfishos.org
[SailfishDevel] Problem with SearchField hiding and clearing on text entry
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-unsubscr...@lists.sailfishos.org