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. Populating a QComboBox and a QTable[View|Widget] from javascript

Populating a QComboBox and a QTable[View|Widget] from javascript

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.9k 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.
  • M Offline
    M Offline
    marciano
    wrote on last edited by
    #1

    Hi guys!

    I'm trying to write a script for an application developed in Qt, using javascript for the business logic and a .ui file for the GUI, but I'm facing two problems.

    In the ui I declared a QComboBox, to which I successfully connect javascript functions to handle signals such as editTextChanged, etc. I was wondering I cannot populate the combobox from within javascript code, because the addItem function is not exposed to script-side code.

    @
    combobox.editTextChangedaction; // OK (action is "connect" or "disconnect")
    combobox.addItem("element 1"); // Error!
    @
    Is there any (other) way to do this?

    I need to show a set of items (strings) in a table-like component. I tried using a QTableView and QTableWidget but I cannot insert or get items. For example, from javascript I cannot access the setModel function of a QTableView (if at least I could create a QAbstractItemModel from script...), neither I can access the item(row,col) function of a QTableWidget class, to set an item's text. Is there any way to show a table of strings to the user, let edit them and retrieve the modified contents?

    Thanks in advance.
    Antonio

    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