Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I want to drag and drop the listwidget item inside the gridlayout
Qt 6.12 LTS is out! See what's new in the release blog

I want to drag and drop the listwidget item inside the gridlayout

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 2.2k 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.
  • A Offline
    A Offline
    amarism
    wrote on last edited by amarism
    #1

    I have a List widget containing an image. I want to drag the image from list widget and drop inside the grid to display. Just see my UI view.

    0_1530709919805_draganddrop.png

    It would be great if someone could guide me regarding this.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      https://forum.qt.io/topic/88170/dragging-qlistwidgetitem-into-qgraphicscene-and-create-qgraphicsitem

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      A 1 Reply Last reply
      1
      • VRoninV VRonin

        https://forum.qt.io/topic/88170/dragging-qlistwidgetitem-into-qgraphicscene-and-create-qgraphicsitem

        A Offline
        A Offline
        amarism
        wrote on last edited by
        #3

        @VRonin actually i am not able to understand the concept mention in that link

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          You need to subclass a QWidget (QLabel?) and reimplement dropEvent (https://doc.qt.io/qt-5/qwidget.html#dropEvent). the link above shows you how to extract row, column and data of the dragged item from the event

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          A 1 Reply Last reply
          1
          • VRoninV VRonin

            You need to subclass a QWidget (QLabel?) and reimplement dropEvent (https://doc.qt.io/qt-5/qwidget.html#dropEvent). the link above shows you how to extract row, column and data of the dragged item from the event

            A Offline
            A Offline
            amarism
            wrote on last edited by
            #5

            @VRonin single thumbnail image is also a combo of an image. If I drag image it will only copy the first image not all the series of image

            VRoninV 1 Reply Last reply
            0
            • A amarism

              @VRonin single thumbnail image is also a combo of an image. If I drag image it will only copy the first image not all the series of image

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @amarism said in I want to drag and drop the listwidget item inside the gridlayout:

              combo of an image

              How are you saving them in the model?

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi, just as a note
                This sample i used for something similar
                http://doc.qt.io/qt-5/qtwidgets-draganddrop-puzzle-example.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
                • Unsolved