OptionSelector: Setting selectedIndex unpredictable

Bug #1589939 reported by Dubstar_04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Confirmed
High
Zsombor Egri

Bug Description

setting the selectedIndex is unpredictable. it works on:

xenial desktop
M10 OTA 11

but fails on:

MX4 OTA 11
Krillin OTA 11
Krillin rc_proposed

Definitions:

Works - selectedIndex is set, optionSelection becomes animated and changes to set index.
Fails - selectedIndex is set, optionSelector remains at index 0 while the selectedIndex is changed to set index.

Dubstar_04 (dubstar-04)
description: updated
Revision history for this message
Andrea Bernabei (faenil) wrote :
Download full text (3.3 KiB)

I had a look at the OptionSelector code this morning (for the first time) in the hope I could help Dan, one of our community developers, but one morning was not enough to be 100% sure of what's wrong here. I will leave a report of my investigation below:

Works -> on Krillin rc-proposed
Fails -> on Arale OTA11

Report:
- On Arale OTA11, where it fails, I see that when I select index > 3 not all delegates are created. Let's suppose I select the item with index 6, then close the app, open again, I see that ListView creates delegates 0,1,2,3 and 6, but not 4-5. That leads me to believe the highlightFollowsCurrentItem logic was not triggered, otherwise scrolling from 0 to 6 would require info about delegates 4-5 as well.

LOG:
REFERENCE TO SOURCE OF THE APP EXPOSING THE BUG
http://bazaar.launchpad.net/~ocs-team/owncloud-sync/trunk/view/30/Owncloud-Sync/Owncloud-Sync/ui/AccountSettingsPage.qml#L91

//this is onSourceChanged for the Image inside OptionSelectorDelegate
qml: SOURCE 0 file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/Themes/Ambiance/artwork/chevron_down.png false false
//This is printed from the OptionSelectorDelegate having modelData "0", from inside Component.onCompleted
qml: I AM ALIVE! 0
//onHeightChanged for the ListView inside OptionSelector.qml
qml: LISTVIEW HEIGHT 115
qml: SOURCE 15 file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/Themes/Ambiance/artwork/chevron_down.png false false
qml: I AM ALIVE! 15
qml: SOURCE 30 file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/Themes/Ambiance/artwork/chevron_down.png false false
qml: I AM ALIVE! 30
qml: SOURCE 45 file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/Themes/Ambiance/artwork/chevron_down.png false false
qml: I AM ALIVE! 45
qml: [AccountsSettingsPage] - Set Frequency Index:6
qml: LISTVIEW CURRENTINDEX CHANGED TO 6
qml: SOURCE 120 file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/Themes/Ambiance/artwork/chevron_down.png false false
//Delegate with modelData 120 is instantiated, but not those with data "60", "120" (see app source link above). The listview does not scroll, and the UI still shows "No Sync", i.e. the element at index 0, even though ListView's currentIndex is now 6
qml: I AM ALIVE! 120

It seems like it could be a timing issue in ListView itself, i.e. highlightFollowsCurrentItem doesn't work if you set the currentIndex too early, although I'm not sure about this. Someone should have a deeper look.

- Additionally, OptionSelectorDelegate has a Connection to onCurrentlyExpandedChanged.
http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/1986/src/Ubuntu/Components/1.3/OptionSelectorDelegate.qml#L166
Let's pick up the case I described above again: I open the app, select "120 minutes" in the setting OptionSelector, then close the app, open it again (at this point the OptionSelector shows "No Sync" although currentIndex of the ListView is 6, as said in the previous bullet point). NOW I tap on the OptionSelector, it expands, and I notice that the onCurrentlyExpandedChanged slot is only called for the delegates at index 0,1,2,3, even though the view is now showing all delegates, from index...

Read more...

Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Zsombor Egri (zsombi)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Dubstar_04 (dubstar-04) wrote :

Adding a timer to OptionSelector Component.onCompleted to delay the calculation of the correct index seems to work around this bug.

http://bazaar.launchpad.net/~ocs-team/owncloud-sync/trunk/revision/39

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.