Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML: Access parent attributes in setProperty
Forum Updated to NodeBB v4.3 + New Features

QML: Access parent attributes in setProperty

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 790 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.
  • C Offline
    C Offline
    chrismit7
    wrote on last edited by
    #1

    I have a QML application that can be updated through a Lua environment. I wish to be able to set relative attributes of a element, such as:

    updateQML("gaugeFront", "width", "parent.width")

    I can update it with:
    updateQML("gaugeFront", "width", 50)

    The relevant piece of C++ is:
    child->setProperty( property, value);//child being gaugeFront, property being width, value being 50

    or anything else, but updating it by trying to access the parent elements doesn't work. The .qml file has a parent.width/parent.height which works for the gaugeFront element.

    I can fall back to a getQML("parent name", "width") to do this, but would rather keep things relative and make use of the natural hierarchy. Is there something I'm missing to be able to set attributes relative to already defined objects?

    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