[SailfishDevel] Use same header item instance in multiple views

Andrey Kozhevnikov coderusinbox at gmail.com
Fri Jul 22 17:46:33 UTC 2016

Wrapping your list views into loader components can probably help you :)

------ Исходное сообщение ------
От: "Michael Neufing" <michael at neufing.org>
Кому: devel at lists.sailfishos.org
Отправлено: 22.07.2016 23:43:41
Тема: [SailfishDevel] Use same header item instance in multiple views

>Hi together!
>I am trying to use the same SearchField instance in multiple views as 
>header item.
>When the page opens, a GridView is displayed with popular content. A 
>SearchField is used as header.
>When the user focuses and/or writes text into the search field, the 
>page should go into "search mode" where the GridView is hidden and a 
>ListView with the search results is displayed.
>The goal is, that no screen space is wasted while scrolling. Therefore 
>I want to have the same SearchField as header on both views.
>I tried to add a placeholder item into both views with the same height 
>as the SearchField and reparent the SearchField according to the mode 
>either into the GridView or the ListView.
>While that technically works (scrolling, etc), the SearchField loses 
>it's focus during that process and the user has to re-focus the field 
>in order to be able to type more text.
>Even calling "forceActiveFocus()" or setting "focus = true" on the 
>SearchField after the reparenting does not work.
>Please see [1] for a code example.
>Can anybody help? I want to avoid that the SearchField is always 
>visible when scrolling.
>[1] http://pastebin.com/fhAdELHN
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to 
>devel-unsubscribe at lists.sailfishos.org

More information about the Devel mailing list