|
|
@ -476,7 +476,7 @@ void UBWidgetUniboardAPI::enableDropOnWidget(bool enable) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event) |
|
|
|
void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const QMimeData *pMimeData = event->mimeData(); |
|
|
|
const QMimeData *pMimeData = event->mimeData(); |
|
|
|
|
|
|
|
|
|
|
@ -485,11 +485,12 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event) |
|
|
|
bool downloaded = false; |
|
|
|
bool downloaded = false; |
|
|
|
|
|
|
|
|
|
|
|
QGraphicsView *tmpView = mGraphicsWidget->scene()->views().at(0); |
|
|
|
QGraphicsView *tmpView = mGraphicsWidget->scene()->views().at(0); |
|
|
|
QPoint dropPoint(mGraphicsWidget->mapFromScene(tmpView->mapToScene(event->pos())).toPoint()); |
|
|
|
QPoint dropPoint(mGraphicsWidget->mapFromScene(tmpView->mapToScene(event->pos().toPoint())).toPoint()); |
|
|
|
Qt::DropActions dropActions = event->dropAction(); |
|
|
|
Qt::DropActions dropActions = event->possibleActions(); |
|
|
|
Qt::MouseButtons dropMouseButtons = event->mouseButtons(); |
|
|
|
Qt::MouseButtons dropMouseButtons = event->buttons(); |
|
|
|
Qt::KeyboardModifiers dropModifiers = event->keyboardModifiers(); |
|
|
|
Qt::KeyboardModifiers dropModifiers = event->modifiers(); |
|
|
|
QMimeData dropMimeData; |
|
|
|
QMimeData *dropMimeData = new QMimeData; |
|
|
|
|
|
|
|
qDebug() << event->possibleActions(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pMimeData->hasHtml()) { //Dropping element from web browser
|
|
|
|
if (pMimeData->hasHtml()) { //Dropping element from web browser
|
|
|
@ -510,7 +511,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event) |
|
|
|
desc.name = QFileInfo(url).fileName(); |
|
|
|
desc.name = QFileInfo(url).fileName(); |
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
|
desc.totalSize = 0; // The total size will be retrieved during the download
|
|
|
|
|
|
|
|
|
|
|
|
desc.dropPoint = event->pos(); //Passing pure event point. No modifications
|
|
|
|
desc.dropPoint = event->pos().toPoint(); //Passing pure event point. No modifications
|
|
|
|
desc.dropActions = dropActions; |
|
|
|
desc.dropActions = dropActions; |
|
|
|
desc.dropMouseButtons = dropMouseButtons; |
|
|
|
desc.dropMouseButtons = dropMouseButtons; |
|
|
|
desc.dropModifiers = dropModifiers; |
|
|
|
desc.dropModifiers = dropModifiers; |
|
|
@ -542,12 +543,9 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QDropEvent *event) |
|
|
|
} |
|
|
|
} |
|
|
|
qDebug() << destFileName; |
|
|
|
qDebug() << destFileName; |
|
|
|
QString mimeText = createMimeText(downloaded, contentType, destFileName); |
|
|
|
QString mimeText = createMimeText(downloaded, contentType, destFileName); |
|
|
|
dropMimeData.setData(tMimeText, mimeText.toAscii()); |
|
|
|
dropMimeData->setData(tMimeText, mimeText.toAscii()); |
|
|
|
|
|
|
|
|
|
|
|
QDropEvent readyEvent(dropPoint, dropActions, &dropMimeData, dropMouseButtons, dropModifiers); |
|
|
|
event->setMimeData(dropMimeData); |
|
|
|
//sending event to destination either it had been downloaded or not
|
|
|
|
|
|
|
|
QApplication::sendEvent(mGraphicsWidget,&readyEvent); |
|
|
|
|
|
|
|
readyEvent.acceptProposedAction(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc desc, QByteArray pData) |
|
|
|
void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc desc, QByteArray pData) |
|
|
|