Hi friends,
I have a window of configuration of the toolbar on my application, running smoothly the drag n 'drop the items.
I'm using QListWidgetItem with icons, but when you drag the item to another widget, the icon does not go with him. How can I improve this follow code in QMimeData?
void ListAct::performDrag()
{
if (item)
{
mime->setText(item->text());
drag->setMimeData(mime);
if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
delete item;
}
}
void ListAct::performDrag()
{
QListWidgetItem *item = currentItem();
if (item)
{
QMimeData *mime = new QMimeData;
mime->setText(item->text());
QDrag *drag = new QDrag(this);
drag->setMimeData(mime);
if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
delete item;
}
}
To copy to clipboard, switch view to plain text mode
Thanks,
Marcelo E. Geyer
Brazil/RS
Bookmarks