← Back to team overview

touch-packages team mailing list archive

[Bug 1517614] Re: Page.head.sections.selectedIndex binding of values is broken

 

This construction with a binding for head.sections.selectedIndex should
be avoided, because when the user taps on the sections to change the
current section, the new index of the section is updated and the binding
is broken.

Perhaps your newly defined property int selectedIndex should be an alias
instead?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1517614

Title:
  Page.head.sections.selectedIndex binding of values is broken

Status in Canonical System Image:
  New
Status in ubuntu-ui-toolkit package in Ubuntu:
  Triaged

Bug description:
  When trying to assign a binding value to head.sections.selectedIndex, this value is not updated when the bound value changes.
  See the example 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: "selectedIndex: " + head.sections.selectedIndex + " should be: " + mainPage.selectedIndex
          property int selectedIndex: -1
          head.sections.model: [ "first", "second", "third" ]
          head.sections.selectedIndex: mainPage.selectedIndex

          Rectangle {
              anchors.fill: parent
              color: "white"

              Label {
                  anchors.centerIn: parent
                  text: "Click me"
              }
          }

          MouseArea {
              anchors.fill: parent
              onClicked: mainPage.selectedIndex = (mainPage.selectedIndex + 1) % 3
          }
      }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1517614/+subscriptions


References