Results 1 to 3 of 3

Thread: draging a QFrame, at the same time destory it

  1. #1
    Join Date
    Mar 2012
    Location
    china
    Posts
    54
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default draging a QFrame, at the same time destory it

    void Frame::mousePressEvent(QMouseEvent *Ae)
    {
    if (Ae->button() == Qt::LeftButton) {

    QDrag *drag = new QDrag(this);
    QMimeData *mimeData = new QMimeData;

    drag->setMimeData(mimeData);
    QPixmap p = QPixmap::grabWidget(this);
    drag->setPixmap(p);

    drag->exec();
    }
    }

    but reflash the ui many times, when I destroy the Frame,but it still in drag->exec(), and the then it crash,so what should I do ?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: draging a QFrame, at the same time destory it

    when I destroy the Frame,but it still in drag->exec()
    How and where are you destroying the Frame ?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2012
    Posts
    83
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: draging a QFrame, at the same time destory it

    Also use the tags to make your code easy to read

Similar Threads

  1. Replies: 5
    Last Post: 19th November 2010, 03:25
  2. Replies: 6
    Last Post: 18th August 2010, 13:52
  3. check the time of last time keyboard is pressed
    By Aki Tomar in forum General Programming
    Replies: 2
    Last Post: 5th February 2008, 10:10
  4. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 12:47
  5. Reg - QFrame
    By suresh in forum Qt Programming
    Replies: 1
    Last Post: 1st November 2006, 05:34

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.