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. Dynamically add buttons to a row and change their text
Forum Updated to NodeBB v4.3 + New Features

Dynamically add buttons to a row and change their text

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 561 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.
  • A Offline
    A Offline
    Alvib
    wrote on last edited by
    #1

    I'm new to QT and trying to use QT Design Studio for my first UI.
    I created a custom tab button which is placed in a row item. Now I'm struggling with adding additional custom tab buttons dynamically by using another button. Additionally the text of the new button should to be changed to "New Button".

    Because my tab button is customized, a text item "tabText" is used. I already included

    property alias tabText: tab.text
    

    to the tab button code to get access to the text of the tab button. I tried "Connections" to solve this issue but wasn't successful.

    Thank you for your help!

    Screenshot 2024-11-27 174005.png

    JonBJ 1 Reply Last reply
    0
    • A Alvib

      I'm new to QT and trying to use QT Design Studio for my first UI.
      I created a custom tab button which is placed in a row item. Now I'm struggling with adding additional custom tab buttons dynamically by using another button. Additionally the text of the new button should to be changed to "New Button".

      Because my tab button is customized, a text item "tabText" is used. I already included

      property alias tabText: tab.text
      

      to the tab button code to get access to the text of the tab button. I tried "Connections" to solve this issue but wasn't successful.

      Thank you for your help!

      Screenshot 2024-11-27 174005.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Alvib
      I thought Qt Design Studio is for designing advanced visuals. I didn't think it does any logic/coding, for anything "dynamic". But I might be mistaken.

      A 1 Reply Last reply
      0
      • JonBJ JonB

        @Alvib
        I thought Qt Design Studio is for designing advanced visuals. I didn't think it does any logic/coding, for anything "dynamic". But I might be mistaken.

        A Offline
        A Offline
        Alvib
        wrote on last edited by
        #3

        @JonB
        Thank you for your response.
        I think the whole QT framework is not as straightforward as it could be. I also can't find any information on how to best use the Qt tools.
        That's why I'm not sure whether the complex UI can be designed in Qt Design Studio and the logic of the UI in Qt Creator.

        Perhaps someone can clear up the ambiguities.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
        • johngodJ Offline
          johngodJ Offline
          johngod
          wrote on last edited by
          #4

          @Alvib Hi
          I am not experienced in Design Studio so can not help you there, but I did something similar for a buttons menu, in code, with a ListModel and a delegate button and roles for the button text and button type. Then, adding buttons was just one line of code, by appending elements (buttons) to the list model.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Alvib
            wrote on last edited by
            #5

            Hello guys,
            I found more information regarding the designer-developer-workflow, which is described in the Qt Design Studio documentation. I have used Qt Design Studio to design my graphical user interface and Qt Creator for the logic. This means that all visual elements are ui.qml files and the logic code can be found in .qml files.

            1 Reply Last reply
            0
            • A Alvib has marked this topic as solved on

            • Login

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