← Back to team overview

touch-packages team mailing list archive

[Bug 1517612] Re: Page.head.sections selects the first item even though selectedIndex is -1

 

** Description changed:

  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
-         title: "Should not select"
-         head.sections.model: [ "first", "second", "third" ]
-         head.sections.selectedIndex: -1 
+         header: PageHeader {
+             title: "Should not select"
+             extension: Sections {
+                 model: [ "first", "second", "third" ]
+                 selectedIndex: -1
+             }
+         }
      }
  }
- 
- This is actually a regression, the sample program below works fine on
- Ubuntu.Components 1.2

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

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

Status in Canonical System Image:
  Fix Released
Status in messaging-app package in Ubuntu:
  New
Status in ubuntu-ui-toolkit package in Ubuntu RTM:
  Fix Released

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
              }
          }
      }
  }

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


References