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. Is there a way to create a tableview inside a button click event?
Forum Update on Monday, May 27th 2025

Is there a way to create a tableview inside a button click event?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 139 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.
  • K Offline
    K Offline
    Kim chang hee
    wrote on last edited by
    #1

    6b9b5878-3a01-4d7d-8fa9-4edc503ae2c0-image.png

    When an object is created in the click event, the message expected token ',' is displayed...
    Is there a way to refresh the tableview on click or create a table within the event?
    Thanks for your help.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NYBL
      wrote on last edited by NYBL
      #2

      Im not sure what are you trying to achieve but you cant create objects like this with java script... (since button handlers are js functions and are not evaluated as qml code) , consider using a loader and a check-able button
      so that when the button is checked you set the loader visible or not visible (though you dont need a loader for that) or change the source component
      somthing like this:

      Item{
          Button{id: someButton
         }
          Loader{
              visible: someButton.checked
              sourceComponent:TableVIew{...}
          }
      }
      

      Also you might want to read this https://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html

      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