← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1190509] Re: [ListItems] Default property being "children" brings some inconvenience

 

** Changed in: ubuntu-ui-toolkit
       Status: Fix Committed => Fix Released

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

Title:
  [ListItems] Default property being "children" brings some
  inconvenience

Status in Ubuntu UI Toolkit:
  Fix Released
Status in “ubuntu-ui-toolkit” package in Ubuntu:
  Fix Released

Bug description:
  ListItem/Empty.qml defines this property:

      default property alias children: body.children

  Empty is inherited by Base, and basically means that for all ListItems the default property is "children". This comes a bit as a surprise to a QtQuick developer, because the default property for Item is "data", and not "children".
  This fact has the unfortunate effect that it's not possible to freely declare non-graphical objects inside a ListItem. For example:

  =========
  ListItem.Standard {
      property variant accountServiceHandle

      text: accountService.service.id
      icon: "image://gicon/" + accountService.service.iconName

      AccountService {
          id: accountService
          objectHandle: accountServiceHandle
      }
  }
  =========

  The above snippet will not work (the QML engine will complain "Cannot assign object to list"), because the AccountService is not a QQuickItem, and the ListItem is trying to assign it to the "children" property.
  In order to workaround this the developer can do:

      resources: AccountService {...}

  but this is rather annoying, especially if the resources are more than
  one.

  I'd propose to double-check if the "default" keyword in the property
  definition in Empty.qml file is really necessary, and remove it if it
  isn't.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1190509/+subscriptions