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. Selecting QML items from a group
Forum Updated to NodeBB v4.3 + New Features

Selecting QML items from a group

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

    I'm having trouble figuring out the best way to implement a UI that I want in my program. The basic idea is that there are two groups consisting of custom QML items. The user will select one of the items from the first group, resulting in that item being highlighted, and then when they click on an item from the second group, a javascript function is executed that does some processing based on certain properties of those items.

    Here's the issues I'm running into. First, I have a "selected" state in the QML items, that I can have them switch to when clicked on. But at the same time, I need the previously selected item to go out of its selected state. It seems like I won't be able to have this logic in the individual QML item, so I'll need it in the container for the items. I'm not sure the best way to set it up, though.

    I'll also need to store the selected QML item, so it can be passed to a javascript function. How can I do that? Is it as easy as "property variant selectedItem" and then setting that equal to the id of whatever item is selected? Then can I just pass that as an argument to a javascript function and call selectedItem.myProperty to access the data?

    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