patrik08
9th February 2007, 18:06
I have build a remote file list model to a QTreeWidget
now i can drag file from desktop & drop to QTreeWidget ++ upload on PUT Webdav method....
But now how i can drag from QTreeWidget & drop to desktop?
i muss fill a QClipboard ?
here is the method drop upload.....
void WebDav_Main::dropEvent(QDropEvent *event)
{
/* incomming data file upload to server */
if(event && event->mimeData()) {
const QMimeData *data = event->mimeData();
QStringList urlmixed;
urlmixed.clear();
QList<QUrl> urlelist;
if (data->hasUrls()) {
urlelist = data->urls();
for ( int i = 0; i < urlelist.size(); ++i ) {
QUrl gettyurl(urlelist.at(i));
if (gettyurl.isValid()) {
QString shema = gettyurl.scheme();
qDebug() << "### shema " << shema;
if (shema == "file") {
QString localfileupsgo = gettyurl.toLocalFile();
urlmixed.append(localfileupsgo);
}
}
}
SendUpPutList(urlmixed);
return;
}
}
}
now i can drag file from desktop & drop to QTreeWidget ++ upload on PUT Webdav method....
But now how i can drag from QTreeWidget & drop to desktop?
i muss fill a QClipboard ?
here is the method drop upload.....
void WebDav_Main::dropEvent(QDropEvent *event)
{
/* incomming data file upload to server */
if(event && event->mimeData()) {
const QMimeData *data = event->mimeData();
QStringList urlmixed;
urlmixed.clear();
QList<QUrl> urlelist;
if (data->hasUrls()) {
urlelist = data->urls();
for ( int i = 0; i < urlelist.size(); ++i ) {
QUrl gettyurl(urlelist.at(i));
if (gettyurl.isValid()) {
QString shema = gettyurl.scheme();
qDebug() << "### shema " << shema;
if (shema == "file") {
QString localfileupsgo = gettyurl.toLocalFile();
urlmixed.append(localfileupsgo);
}
}
}
SendUpPutList(urlmixed);
return;
}
}
}