Results 1 to 16 of 16

Thread: function dropEvent(QGraphicsSceneDragDropEvent *event) doesn't work...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2013
    Location
    Poland, Katowice
    Posts
    13
    Thanks
    1
    Thanked 16 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default function dropEvent(QGraphicsSceneDragDropEvent *event) doesn't work...

    Hi All
    I have problem with function dropEvent(QGraphicsSceneDragDropEvent *event) when I wanna drop object type QGraphicsItem.
    this is my part code

    QPixmap dwuMasztowiec;
    dwuMasztowiec = QPixmap("../Statki/images/dwu.png");
    statek_1 = scene->addPixmap(dwuMasztowiec);
    statek_1->setPos(277,405);
    statek_1->setFlag(QGraphicsItem::ItemIsMovable);

    I have several objects type statek (statek=ship). I wanna drag this ships somewhere in another place that I can drop and read position this ship.

    I set flag (QGraphicsItem::ItemIsMovable) so I can drag elements but I haven't ideas how drop and read postion ship.

    I used function (which is below) from example robot from Qt but doesn't work


    void Plansza::dropEvent(QGraphicsSceneDragDropEvent *event)
    {
    if (event->mimeData()->hasImage()) {
    dragOver = false;
    pixmap = qVariantValue<QPixmap>(event->mimeData()->imageData());
    update();
    } else {
    Plansza::dropEvent(event);
    }
    }

    If I explained wrong my example , I will tell and show more details.

    I please about support
    Thanks

  2. The following 2 users say thank you to Mariusz_1990 for this useful post:


Similar Threads

  1. Replies: 3
    Last Post: 1st May 2013, 20:44
  2. gprof doesn't work
    By soul_rebel in forum Qt Programming
    Replies: 0
    Last Post: 10th May 2012, 14:49
  3. Paint event function in key press event
    By soumya in forum Qt Programming
    Replies: 6
    Last Post: 2nd February 2010, 12:40
  4. dropEvent doesn't happen without mousemove
    By Dimon in forum Qt Programming
    Replies: 0
    Last Post: 6th October 2009, 16:49
  5. qSort doesn't work with member function
    By ber_44 in forum Qt Programming
    Replies: 10
    Last Post: 2nd June 2007, 12:00

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.