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. (Sloved) Change tab title in TabView
Forum Updated to NodeBB v4.3 + New Features

(Sloved) Change tab title in TabView

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.6k Views 2 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
    A Former User
    wrote on last edited by A Former User
    #1

    Hello guys :-)
    I want to change the current tab title in TabView but I can't access to tabs title propertie :(
    I have to add new tab by button with id : "btn_add_new" so I need to change current tab title by "btn_change_title" button.

    this is my code :

    TabView {
        id : mytab
        x: 22
        y: 43
        width: 576
        height: 209
    
    }
    
    Button {
        id: btn_change_title
        x: 261
        y: 258
        width: 166
        height: 23
        text: qsTr("Chnage current tab name")
    
        onClicked: {
    
            // Change the current tab Title
            //Can't access to current tab (title) 
           mytab.title = "New tab Title"
    
        }
    }
    
    Button {
        id: btn_add_new
        x: 180
        y: 258
        text: qsTr("Add new tab")
    
        onClicked: {
    
            ts.addTab("My tab");
    
        }
    }
    
    p3c0P 1 Reply Last reply
    0
    • ? A Former User

      Hello guys :-)
      I want to change the current tab title in TabView but I can't access to tabs title propertie :(
      I have to add new tab by button with id : "btn_add_new" so I need to change current tab title by "btn_change_title" button.

      this is my code :

      TabView {
          id : mytab
          x: 22
          y: 43
          width: 576
          height: 209
      
      }
      
      Button {
          id: btn_change_title
          x: 261
          y: 258
          width: 166
          height: 23
          text: qsTr("Chnage current tab name")
      
          onClicked: {
      
              // Change the current tab Title
              //Can't access to current tab (title) 
             mytab.title = "New tab Title"
      
          }
      }
      
      Button {
          id: btn_add_new
          x: 180
          y: 258
          text: qsTr("Add new tab")
      
          onClicked: {
      
              ts.addTab("My tab");
      
          }
      }
      
      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @EmulationQt Use getTab to get tab at particular index and then access its title

      mytab.getTab(0).title = "New tab Title"
      

      157

      ? 1 Reply Last reply
      0
      • p3c0P p3c0

        @EmulationQt Use getTab to get tab at particular index and then access its title

        mytab.getTab(0).title = "New tab Title"
        
        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @p3c0 said:

        @EmulationQt Use getTab to get tab at particular index and then access its title

        mytab.getTab(0).title = "New tab Title"
        

        Thank you @p3c0 :-)

        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