← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1630683] [NEW] ListItem: setting implicitHeight has no effect

 

Public bug reported:

ubuntu-ui-toolkit/staging, r2133

Description:
Creating a ListItem and setting its implicitHeight has no effect.
This means any component that derives from ListItem has to be implemented setting its height, while the best practice (as far as I know) is that components are supposed to set their implicit size, and leave the "real" size to the user of those components.

Investigation:
I spent some time on investigating this already. The problem is:
- http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/2133/src/UbuntuToolkit/uclistitem.cpp#L1128
This means every time the width of the parent changes, ListItem will reset its implicit height to the default value. As a consequence, specifying a custom implicit height value is not allowed, because any parent's width change would cause it to be overwritten.
- http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/2133/src/UbuntuToolkit/uclistitem.cpp#L1130 At this point the item has the implicitHeight set by the testcase below. Calling _q_updateSize overwrites what the user set.


Testcase:
import QtQuick 2.4
import Ubuntu.Components 1.3

Item {
    width: units.gu(42)
    height: units.gu(75)
    ListItem {
        id: menu
        Component.onCompleted: console.log(height, implicitHeight)

        //This is overridden on ListItem init and on every parent's width change.
        //It is as if it weren't there
        implicitHeight: 5000

        //Explicitly setting height is the only way to resize the component
        height: 5000

        Rectangle {
            anchors.fill: parent
            color: "blue"
        }
    }
}

** Affects: ubuntu-ui-toolkit (Ubuntu)
     Importance: Undecided
     Assignee: Zsombor Egri (zsombi)
         Status: New

** Changed in: ubuntu-ui-toolkit (Ubuntu)
     Assignee: (unassigned) => Zsombor Egri (zsombi)

-- 
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/1630683

Title:
  ListItem: setting implicitHeight has no effect

Status in ubuntu-ui-toolkit package in Ubuntu:
  New

Bug description:
  ubuntu-ui-toolkit/staging, r2133

  Description:
  Creating a ListItem and setting its implicitHeight has no effect.
  This means any component that derives from ListItem has to be implemented setting its height, while the best practice (as far as I know) is that components are supposed to set their implicit size, and leave the "real" size to the user of those components.

  Investigation:
  I spent some time on investigating this already. The problem is:
  - http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/2133/src/UbuntuToolkit/uclistitem.cpp#L1128
  This means every time the width of the parent changes, ListItem will reset its implicit height to the default value. As a consequence, specifying a custom implicit height value is not allowed, because any parent's width change would cause it to be overwritten.
  - http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/staging/view/2133/src/UbuntuToolkit/uclistitem.cpp#L1130 At this point the item has the implicitHeight set by the testcase below. Calling _q_updateSize overwrites what the user set.

  
  Testcase:
  import QtQuick 2.4
  import Ubuntu.Components 1.3

  Item {
      width: units.gu(42)
      height: units.gu(75)
      ListItem {
          id: menu
          Component.onCompleted: console.log(height, implicitHeight)

          //This is overridden on ListItem init and on every parent's width change.
          //It is as if it weren't there
          implicitHeight: 5000

          //Explicitly setting height is the only way to resize the component
          height: 5000

          Rectangle {
              anchors.fill: parent
              color: "blue"
          }
      }
  }

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