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. Object reference between two files over thrid
Forum Updated to NodeBB v4.3 + New Features

Object reference between two files over thrid

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 850 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.
  • _ Offline
    _ Offline
    _icebear
    wrote on last edited by
    #1

    Hi,

    I try to address the QML-objects between different files:

    main.qml :
    Column
    {
    InfoView
    {
    id : info
    }
    ButtonBar { ... }
    }

    InfoView.qml :
    Row
    {
    Item
    {
    id : view3d
    InfoQt3d { ... }
    }
    }

    InfoQt3d.qml :
    Viewport
    {
    Item
    {
    id : castle
    Item3D { ... }
    }
    }

    ButtonBar.qml :
    Row
    {
    ButtonItem { ...; receiver : info; ... }
    ButtonItem { ...; receiver : view3d; ... }
    }

    In an example I try from file ButtonBar.qml (receiver : view3d) to adress objects in InfoQt3d.qml file (view3d or castle). Also I receive a error. Object "info" (receiver : info) is addressed normally.

    How i can to address view3d or castle objects from ButtonBar.qml file? Probably an example where such situation is described?

    thanks for answers,
    Sergej

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Torgeir
      wrote on last edited by
      #2

      The ids visible in ButtonBar are only the ids defined in ButtonBar or parents of ButtonBar. InfoView is a sibling in this case, so ids defined in InfoView will not be visible in ButtonBar.

      You need to forward it with properties. If InfoView's id view3d is to be visible to ButtonBar, add a property to ButtonBar:

      @property Item view3d@

      This should also be exposed from InfoView so that main.qml will look like this:

      @main.qml :
      Column {
      InfoView { id : info }
      ButtonBar { view3d: info.view3d }
      }@

      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