Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Behavior element has no 'parent' property
Qt 6.11 is out! See what's new in the release blog

Behavior element has no 'parent' property

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xsacha
    wrote on last edited by
    #1

    I am unable to refer to the parent item in animations as the Behavior element does not have a 'parent' property.

    Example:
    @Behavior on x { NumberAnimation {duration: parent.width } }@

    It is impossible to refer to the parent in this case without the parent having a known ID that you can use. This becomes more complicated in re-parented scenarios such as the one I was attempted to design.

    Is there something I'm missing? How can I refer to variables in the parent item?

    • Sacha
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      You are correct -- parent is a property of Item, the base class of all the visual items (but not Behavior, NumberAnimation, etc).

      I'd recommend adding a suggestion in the "bug tracker":bugreports.qt.nokia.com with some examples of things you'd like to achieve that are difficult without the parent property (like your example above).

      Michael

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved