Results 1 to 3 of 3

Thread: Cannot Drop on QGraphicsView

  1. #1
    Join Date
    Jul 2012
    Posts
    53
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Cannot Drop on QGraphicsView

    I want to drag a QTreeWidgetItem and drop the mime data onto a customized QGraphicsView in a customized QWidget.
    The drag looks working fine because when I drag the item and drop onto the Qt Drop Site example, the mime data is read correctly.

    I have implemented the dragMoveEvent() and dragEnterEvent() of the QGraphicsView to accept drops, and setAcceptDrops() to true.
    However, when I drag the item onto the view, the mouse icon is a big "unavailable" and the dropEvent() of the view cannot be triggered.
    This kind of weird because even if I'm trying to drop on a line edit widget (which accepts drop by default) of the QWidget (parent of the view), the mouse icon is still big "unavailable", which looks like the whole widget is disabled for dropping.
    But when I check the acceptDrops() on click the view, it does return true.

    Any ideas please? Thanks in advance.
    Last edited by Seishin; 5th June 2013 at 20:51.

  2. #2
    Join Date
    Jul 2012
    Posts
    53
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot Drop on QGraphicsView

    Found the reason but I don't know why. When I call setViewport() of the QGraphicsView, if I set the viewport to QGLWidget, drop is working; but if I set the viewport to QWidget, drop is not working any more.
    Anyone knows the reason?
    Thanks.

  3. #3
    Join Date
    Oct 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Cannot Drop on QGraphicsView

    I have the same issue.

Similar Threads

  1. Drag from QtreeWidget and drop to QGraphicsView
    By syjgin in forum Qt Programming
    Replies: 0
    Last Post: 3rd July 2010, 14:17
  2. Drop polygons in a QGraphicsView
    By qlands in forum Newbie
    Replies: 0
    Last Post: 6th May 2010, 13:52
  3. Drag and Drop from QListView to QGraphicsView
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 20th August 2009, 14:26
  4. Drar and Drop on QGraphicsView
    By rippa in forum Qt Programming
    Replies: 8
    Last Post: 19th November 2008, 17:02
  5. Drag and drop from QTreeWidget to QGraphicsView
    By igu@na in forum Qt Programming
    Replies: 2
    Last Post: 27th August 2008, 08:24

Tags for this Thread

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.