Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Avoid QTreeWidgetItem to have children
Qt 6.11 is out! See what's new in the release blog

Avoid QTreeWidgetItem to have children

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 945 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.
  • E Offline
    E Offline
    excalibur1491
    wrote on last edited by
    #1

    Hi,

    I have been working with QTreeWidget and QTreeWidgetItem and I have had some problems to be able to drag&drop QTreeWidgetITems form a QTreeWidget to another. Anyway I found a way to do it by reimplementing the dropEvent.

    Now, I still have a problem... This is my current situation:
    I have a class Item which inherits form QTreeWidgetItem and a class TWidget wich inherits from QTreeWidget (with its dropEvent method reimplemented, as I said above).
    What I want is to be able to drag&drop items into other items (to create "groups"), but not for all the items. I have a boolean property in my Item class that says "if true, I can be a group, if false, I can't". So I want to be able to drag and drop Items into other Items only if this boolean is set to true for the target.

    The best information I have found yet is this: http://www.qtcentre.org/threads/5910-QTreeWidget-Drag-and-drop , but does not help me much because I don't have any idea how to reimplement dropMimeData.. I don't even understand wha this method does from reading the documentation.

    Any suggestion?
    Thank you!

    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