Previously i used the internalmove mode, Then i changed to DragDrop mode.. But it is not working for me ..

sample code

Qt Code:
  1. ui->treeWidget->dragDropOverwriteMode();
  2. ui->treeWidget->setDragEnabled(true);
  3. ui->treeWidget->setAcceptDrops(true);
  4. ui->treeWidget->setDragDropMode(QAbstractItemView ::DragDrop);
  5. QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget);
  6. item->setText(0,"Friends");
  7. QList <QString > list;
  8. list << tr("john") << tr("joseph") << tr("stephen") << tr("raj") << tr("Addu") ;
  9.  
  10. for ( int i=0;i < list.size;i++)
  11. {
  12. QTreeWidgetItem *new_item = new QTreeWidgetItem(item);
  13. new_item->setText(0,list.at(i));
  14. }
To copy to clipboard, switch view to plain text mode 

Again i am creating new top level item for TreeWidget

Qt Code:
  1. QTreeWidgetItem *colleages = new QTreeWidgetItem(ui->treewidget);
  2. colleages->setText(0,"co-Workers");
To copy to clipboard, switch view to plain text mode 

I am trying to drag the items from friends to co-workers .. Here top level item only accept the drops..child items won't accept the drops.


How do i sort out this issue


Thanks

Addu R