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. [Solved] Access to object properties in a tab element
Forum Update on Monday, May 27th 2025

[Solved] Access to object properties in a tab element

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 2.0k Views
  • 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.
  • M Offline
    M Offline
    mrdebug
    wrote on 7 May 2015, 21:30 last edited by mrdebug 5 Sept 2015, 17:24
    #1

    Hi. My situation is

        TabView {
            id: twUser
    
            Tab {
                id: tSurname
    
                    Text {
                        id: text2
                        text: 'Hello'
    

    Is there a way to access the text properties of text2 element?

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 7 May 2015, 21:47 last edited by
      #2

      Hi,

      inside the QML module all ids are available so you can write text2.text to read the value.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrdebug
        wrote on 8 May 2015, 06:35 last edited by
        #3

        No, with TabView is different. text2 is unavailable.
        Outside TabView I can access only at the tab but not at the objects inside the tab.
        I can access to tSurname but I obtain an error when I try to access to text2.
        Is there a way?

        Need programmers to hire?
        www.labcsp.com
        www.denisgottardello.it
        GMT+1
        Skype: mrdebug

        P 1 Reply Last reply 8 May 2015, 07:55
        0
        • M Offline
          M Offline
          mcosta
          wrote on 8 May 2015, 07:00 last edited by
          #4

          If you are outside TabView you can create a property alias pointing to the text2.text

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • M mrdebug
            8 May 2015, 06:35

            No, with TabView is different. text2 is unavailable.
            Outside TabView I can access only at the tab but not at the objects inside the tab.
            I can access to tSurname but I obtain an error when I try to access to text2.
            Is there a way?

            P Offline
            P Offline
            p3c0
            Moderators
            wrote on 8 May 2015, 07:55 last edited by p3c0 5 Aug 2015, 08:00
            #5

            @mrdebug Use getTab to get the Tab at a particular index. Now since Tab inherits Loader you can use its item property to access the item it contains. Eg:

            var tab = tabv.getTab(0) //get tab at index 0; tabv = id of TabView
            console.log(tab.item.text) //get the item and access its properties
            

            157

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrdebug
              wrote on 9 May 2015, 17:24 last edited by
              #6

              Perfect!

              Need programmers to hire?
              www.labcsp.com
              www.denisgottardello.it
              GMT+1
              Skype: mrdebug

              1 Reply Last reply
              0

              1/6

              7 May 2015, 21:30

              • Login

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