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. Accessing QML TabView's Component properties "from the outside"

Accessing QML TabView's Component properties "from the outside"

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.8k 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.
  • K Offline
    K Offline
    Korchkidu
    wrote on last edited by Korchkidu
    #1

    Hi,

    I have a TabView with a simple TextArea:

    import QtQuick 2.0
    import QtQuick.Controls 1.1
    
    Rectangle
    {
      TabView
      {
        id: tabs
    
        Component.onCompleted:
        {
          addTab("tab1", comp1)
        }
     }
    
      Component
      {
        id: comp1
    
        TextArea
        {
          id: textArea
          text: "Component 1"
        }
      }
    }
    

    The result is as expected:
    http://imageshack.com/a/img21/2066/e3ey.png(Tab)

    Now, I want to access tab elements from the outside. using a property alias. I tried the following without success:

    import QtQuick 2.0
    import QtQuick.Controls 1.1
    
    Rectangle
    {
      property alias comp1Text: tabs.getTab(0).textArea // <<==
    
      TabView
      {
        id: tabs
    
        Component.onCompleted:
        {
          addTab("tab1", comp1)
        }
    

    }

      Component
      {
        id: comp1
    
        TextArea
        {
          id: textArea
          text: "Component 1"
        }
      }
    }
    

    For the moment, I get the following error:
    Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property>
    property alias comp1Text: tabs.getTab(0).textArea // <<==@

    So how can I access items that are enclosed into a TabView?

    Thanks a lot for any help.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Korchkidu
      wrote on last edited by
      #2

      Anybody? Using TabView in QML seems something basic to me.

      Best regards.

      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