PDA

View Full Version : draging a QFrame, at the same time destory it



waiter
5th February 2013, 11:12
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 ?

Santosh Reddy
5th February 2013, 11:35
when I destroy the Frame,but it still in drag->exec()
How and where are you destroying the Frame ?

Stanfillirenfro
5th February 2013, 12:14
Also use the tags to make your code easy to read