Results 1 to 2 of 2

Thread: MoveAction in a QTreeView with a subclass of QAbstractItemModel

  1. #1
    Join Date
    Feb 2006
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default MoveAction in a QTreeView with a subclass of QAbstractItemModel

    Hi,

    I've asked the question on the qt-interest mailinglist but got no answer.

    I am trying to expand the simpletreemodel example with drag and drop of the nodes. I want to be able to move the items inside of the tree. Now I have the following problems:

    1. If I return Qt::MoveAction in supportedDragActions() and supportedDropActions() the drag starts but the drop does not work and is indicated as impossible.

    2. If I return Qt::MoveAction | Qt::CopyAction the move seems to work, but a copy is not possible. dropMimeData() is always called with Qt::MoveAction regardless how I drop the item. In contrast the view indicates that a copy is performed by showing a + next to the dragged item.

    3. If I start the application and click on the + next to 222 the subitem 23 appears. If I click on the 23, suddenly the item 111 is opened and the subitems 11 and 14 appear.

    I am using Qt 4.2.2 on linux. If you want to look at the problem, you can find the code on http://www.pontohonk.de/example/modelview.cpp
    I can also paste the code if this is wanted.

    You can see problem 1 by compiling the code and just dragging an item. To see problem 2 add "| Qt::CopyAction" in the methods mentioned in problem 1 and try to copy an item by Drag&Drop. CopyAction should be the default and pressing SHIFT during dragging should enable MoveAction. To see problem 3 just perform the indicated actions.

  2. #2
    Join Date
    Feb 2006
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: MoveAction in a QTreeView with a subclass of QAbstractItemModel

    Is here anyone that can reproduce the problems on his system? Maybe this is only a compiler/platform issue.

Similar Threads

  1. [QT4] QTreeView, QAbstractItemModel and sorting
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2006, 20:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.