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. How to identify dynamic items in a mouseArea?
Forum Updated to NodeBB v4.3 + New Features

How to identify dynamic items in a mouseArea?

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

    I have two questions regarding how dynamic items are handled in Qt Quick.

    1. If I have many items, each with id item1, item2, item3, etc. If I drag one of the items into a mouseArea, how does the mouseArea identify which item is it? From the tutorials and examples, it seems like the item that is allowed to be in the mouseArea is pre-defined.

    2. Can I create a new item on my GUI? E.g. can I create a new rectangle if I press a button in my GUI? And how does a mouseArea recognize a new item, when this new item is move over it?

    Many thanks for your guidance.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2
      1. I think you are misunderstanding the purpose of drag.target. The drag.target in MouseArea is mostly for convenience and it is useful to make things such as sliders and scrollbar where only one predefined item is draggable. For fine grained control you can always use the onPositionChanged signal handler and to whatever you want.
      2. See this http://doc.qt.nokia.com/latest/qdeclarativedynamicobjects.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