Hi All,
I am trying to Drag from a QListWidget and drop it into QTextBrower/ QLineEdit.
I am trying to copy "Text/plain" to the mimedata by doing this:
{
my_text = Event->mimeData()->text();
mimeData->setText(my_text);
drag->setMimeData(mimeData);
drag->exec();
}
void MainWindow::dragEnterEvent(QDragEnterEvent *Event)
{
QString my_text;
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
my_text = Event->mimeData()->text();
mimeData->setText(my_text);
drag->setMimeData(mimeData);
drag->exec();
}
To copy to clipboard, switch view to plain text mode
But in the dropEvent function, when i capture the mimedata, it is of "application/x-qabstractitemmodeldatalist" format.
{
qDebug() << format;
qDebug() << my_text;
Event->acceptProposedAction();
}
void MainWindow::dropEvent(QDropEvent *Event)
{
QString my_text;
QStringList myformats = Event->mimeData()->formats();
foreach(QString format, myformats)
qDebug() << format;
qDebug() << my_text;
Event->acceptProposedAction();
}
To copy to clipboard, switch view to plain text mode
Kindly help me in dropping the mimedata to QLineEdit or QTextBrowser.
Thanks
Bookmarks