SilicaListView + positionViewAtIndex from ContextMenu don't work?

REPRODUCIBILITY: 100%
OS VERSION: 4.4.0.64
HARDWARE: Vollapone / GS290, 10ii (also .64).
UI LANGUAGE: EN
REGRESSION: not sure.

DESCRIPTION:

Given:

SilicaListView {

        id: listView
        anchors.fill: parent
        // (height and width don't matter)

        Component.onCompleted:  {
            var time = new Date();
            if (debug) console.debug(time.toTimeString(Locale.LongFormat).split(':')[0] )
            tindex = time.toTimeString(Locale.LongFormat).split(':')[0]
             // Does not work
            listView.positionViewAtIndex(tindex, ListView.Beginning)
            // Also not
            positionViewAtEnd()
        }

        model: listModel
        delegate: WeatherItem{
            id: delegate
        }
        // Dosn't matter whether it on.
        //VerticalScrollDecorator {flickable: listView}
    }

It doesn’t seem possible to set the focus. Also tried setting the index.

PRECONDITIONS:

Create and use SilicaListView.

STEPS TO REPRODUCE:

  1. See the code above.
  2. Try to substitute a ListView. No diff.

EXPECTED RESULT:

Seting the index to position the view at should scroll view.

ACTUAL RESULT:

nothing. The onCompleted signal works. But position to index does not.

MODIFICATIONS:

ADDITIONAL INFORMATION:

The number of elements (24) is always restricted to about 10 visible elements (device dependant).

Probably related? https://forum.sailfishos.org/t/silicalistview-positionviewatindex-from-contextmenu-buggy-behaviour

Also tested on a clean (don’t develop on, don’t hack in any way) sony 10ii (not yet .68, still .64). Must be me :slight_smile:

probably on completion your list is not populated with model yet. try doing same in onCountChanged instead?

3 Likes

Ah, man. I was ‘assuming’ that completion meant population in this case. That’s naive! Thanks for the tip!

Works like a charm. And we’ve made a least one user happier to boot :slight_smile: nice to see you back @coderus!

3 Likes