Page.head.sections selects the first item even though selectedIndex is -1

Bug #1517612 reported by Gustavo Pichorim Boiko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Zoltan Balogh
messaging-app (Ubuntu)
New
Undecided
Unassigned
ubuntu-ui-toolkit (Ubuntu RTM)
Fix Released
Critical
Tim Peeters

Bug Description

In some cases it is desired that no header section is selected when the program starts. We used to achieve that by setting head.sections.selectedIndex to -1, but on Ubuntu.Components 1.3 this doesn't work: the first item gets selected by default. See the sample program below:

import QtQuick 2.4
import Ubuntu.Components 1.3

MainView {
    id: mainview
    objectName: "mainView"

    width: units.gu(100)
    height: units.gu(75)

    Page {
        id: mainPage
        title: "Should not select"
        head.sections.model: [ "first", "second", "third" ]
        head.sections.selectedIndex: -1
    }
}

This is actually a regression, the sample program below works fine on Ubuntu.Components 1.2
---------------------------
Update: The old header doesn't work with the new design properly, therefore apps should turn to use the 1.3 hearing as in the example below:
it will work properly when the app switches to the new header:

import QtQuick 2.4
import Ubuntu.Components 1.3

MainView {
    id: mainview
    objectName: "mainView"

    width: units.gu(100)
    height: units.gu(75)

    Page {
        id: mainPage
        header: PageHeader {
            title: "Should not select"
            extension: Sections {
                model: [ "first", "second", "third" ]
                selectedIndex: -1
            }
        }
    }
}

Bill Filler (bfiller)
Changed in canonical-devices-system-image:
milestone: none → ww02-2016
assignee: nobody → Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Zoltan Balogh (bzoltan)
importance: Undecided → Medium
Changed in canonical-devices-system-image:
importance: Undecided → Medium
Bill Filler (bfiller)
Changed in canonical-devices-system-image:
importance: Medium → High
Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Medium → High
Revision history for this message
Zsombor Egri (zsombi) wrote :

Isn't this similar to bug 1511839?

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

That's a different problem, not sure it was a problem introduced by the MR fixing bug 1511839 or if the problem was already there.
Just try the sample program above using the latest UI toolkit (which already includes the fix for the other mentioned bug) and see the problem.

Changed in canonical-devices-system-image:
status: New → Confirmed
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: Zoltan Balogh (bzoltan) → Zsombor Egri (zsombi)
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: Zsombor Egri (zsombi) → Tim Peeters (tpeeters)
status: New → Triaged
Zoltan Balogh (bzoltan)
affects: ubuntu-ui-toolkit (Ubuntu) → ubuntu-ui-toolkit (Ubuntu RTM)
Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu RTM):
importance: High → Critical
Revision history for this message
Tim Peeters (tpeeters) wrote :

I am still investigating, but I verified that it will work properly when the app switches to the new header:

import QtQuick 2.4
import Ubuntu.Components 1.3

MainView {
    id: mainview
    objectName: "mainView"

    width: units.gu(100)
    height: units.gu(75)

    Page {
        id: mainPage
        header: PageHeader {
            title: "Should not select"
            extension: Sections {
                model: [ "first", "second", "third" ]
                selectedIndex: -1
            }
        }
    }
}

Revision history for this message
Tim Peeters (tpeeters) wrote :

As we also discussed in this bug: https://bugs.launchpad.net/ubuntu-rtm/+source/ubuntu-ui-toolkit/+bug/1517614 there are issues with the Page.head.sections that we cannot fix properly, but we released now a new PageHeader that no longer has these problems.

So from UITK I consider this fixed. The apps still need to update to use the new header.

Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu RTM):
status: Triaged → Fix Released
Changed in canonical-devices-system-image:
status: Confirmed → Fix Released
Zsombor Egri (zsombi)
description: updated
Changed in canonical-devices-system-image:
status: Fix Released → Fix Committed
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
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.