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. Drag drop signal for two QListViewWidgets
Forum Updated to NodeBB v4.3 + New Features

Drag drop signal for two QListViewWidgets

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 1.9k 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.
  • T Offline
    T Offline
    Timmoth
    wrote on last edited by
    #1

    Hi, i have two QlistViewWidgets by setting :
    @
    list1->setDragDropMode(QAbstractItemView::DragDrop);
    list1->setDefaultDropAction(Qt::MoveAction);
    list2->setDragDropMode(QAbstractItemView::DragDrop);
    list2->setDefaultDropAction(Qt::MoveAction);
    @
    i am able to drag and drop items between both list views what i need now is a signal and slot to show when the items have been dragged and drop - preferably with their index / text.

    is there any way to do this ?

    Cheers, Tim.

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

      Hi,

      I would subclass and reimplement the startDrag and dropEvent functions for example

      Hope it helps

      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
      0
      • T Offline
        T Offline
        Timmoth
        wrote on last edited by
        #3

        Cheers for the direction SGalst.
        i manged to get hold of the dropEvent and dragMoveEvent using this code:
        @
        listWidget::listWidget(QWidget *parent)
        : QListWidget(parent)
        {
        setDragDropMode(QAbstractItemView::DragDrop);
        setDefaultDropAction(Qt::MoveAction);
        }

        void listWidget::dropEvent(QDropEvent *event)
        {
        QListWidget::dropEvent(event);
        }

        void listWidget::dragMoveEvent(QDragMoveEvent *e)
        {

        QListWidget::dragMoveEvent(e);
        

        }

        @

        but im kind of clueless of what to do from here. i need to be able to get the statustip of the item moved.

        any way to do this?

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

          What do you mean by statustip ?

          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
          0
          • T Offline
            T Offline
            Timmoth
            wrote on last edited by
            #5

            basically my list widget items status tip is the actual physical location of the file which it represents. When the user moves the list item between the two listviewwidgets i would like to actually move the file too.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Timmoth
              wrote on last edited by
              #6

              ill take a print screen which will hopefully make more sense

              • http://tinypic.com/r/1zqbv5d/5
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                If you are using a QFileSystemModel underneath and IIRC you should just have to make it writable and all this should be handled for you.

                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
                0

                • Login

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