[Qt-interest] drag and drop of standard Qt's widgets

George Brink siberianowl at yahoo.com
Tue May 10 16:26:51 CEST 2011


I would like to DnD an item from a QTreeWidget into another widget (in 
the same application.
The "drag" part of DnD works perfectly, but I do not understand how to 
extract the dragged QTreeWidgetItem from the QMimeData object?
-------------------
void MyWindow::dropEvent(QDropEvent *e) {
   if( e->mimeData()->hasFormat(
                        "application/x-qabstractitemmodeldatalist")) {

     QByteArray ba = e->mimeData()->data(
                        "application/x-qabstractitemmodeldatalist");
     QTreeWidgetItem twi = ba; // ???? how?

     qDebug() << twi.text(0);
     e->acceptProposedAction();
   }
}
-------------------
Where is the manual which describes relationship between Qt's widgets 
and QMimeData?




More information about the Qt-interest-old mailing list