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. QListWidget Drag and drop
Qt 6.11 is out! See what's new in the release blog

QListWidget Drag and drop

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 912 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.
  • naaxN Offline
    naaxN Offline
    naax
    wrote on last edited by
    #1

    Hello.
    I want to drag from one QListWidget item and drop it to another. After his drop, I want to call one function.
    All works but only if I click this dropped item in another QListWidget and I want to call this function automatic after drop item. Can someone help me or give a tip?

    JonBJ 1 Reply Last reply
    0
    • naaxN naax

      Hello.
      I want to drag from one QListWidget item and drop it to another. After his drop, I want to call one function.
      All works but only if I click this dropped item in another QListWidget and I want to call this function automatic after drop item. Can someone help me or give a tip?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @naax
      Subclass QListWidget and override dropEvent()?

      Though if problems receiving the drop event, possibly see https://stackoverflow.com/questions/53897601/qlistwidget-derived-drop-event-not-firing, https://stackoverflow.com/questions/53870847/qt-drop-event-not-firing

      1 Reply Last reply
      0
      • naaxN Offline
        naaxN Offline
        naax
        wrote on last edited by naax
        #3

        @JonB
        I used QAbstractItemView in .ui for both QListWidget (one to drag only and second to drop only). The next step was to click the second QListWidget / Go to slot... and I don't know how I can select here from this all options. Of course, if this is impossible and I don't need to write code for this what I want.

        naaxN 1 Reply Last reply
        0
        • naaxN naax

          @JonB
          I used QAbstractItemView in .ui for both QListWidget (one to drag only and second to drop only). The next step was to click the second QListWidget / Go to slot... and I don't know how I can select here from this all options. Of course, if this is impossible and I don't need to write code for this what I want.

          naaxN Offline
          naaxN Offline
          naax
          wrote on last edited by
          #4

          @JonB

          Item is adding successfully, but I need to click and then my functions are called. I want to call this function when I drop item

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            If you need to react specifically to the drop event then do as @JonB suggested and create a derived class. You can always then use it in designer through promotion.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved