diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-25 11:45:23 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-01-25 11:45:23 +0100 |
commit | acf7f38b2b4a5d6427dca9b6538e3394cfde2d94 (patch) | |
tree | fcd5eeb1006b01a4596cce5956bfe32f3c055d29 /src/core/web_contents_adapter.cpp | |
parent | c2447a308882ba3691d66b2c28df197f571518c7 (diff) | |
parent | 349ef9870917e8cf2c189fed4a970023b19ba24a (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/3rdparty
tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
Change-Id: I070173576fc4be53689ce0dd9e1fd4133f5814da
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 9de2085ba..3763770d9 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -348,7 +348,7 @@ WebContentsAdapterPrivate::WebContentsAdapterPrivate() , adapterClient(0) , nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd) , lastFindRequestId(0) - , currentDropAction(Qt::IgnoreAction) + , currentDropAction(blink::WebDragOperationNone) , inDragUpdateLoop(false) , updateDragCursorMessagePollingTimer(new QTimer) { @@ -1169,7 +1169,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD d->currentDropData->file_contents.clear(); d->currentDropData->file_description_filename.clear(); - d->currentDropAction = Qt::IgnoreAction; + d->currentDropAction = blink::WebDragOperationNone; QDrag *drag = new QDrag(dragSource); // will be deleted by Qt's DnD implementation bool dValid = true; QMetaObject::Connection onDestroyed = QObject::connect(dragSource, &QObject::destroyed, [&dValid](){ @@ -1246,6 +1246,17 @@ void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPoint &screenPos) flagsFromModifiers(e->keyboardModifiers())); } +Qt::DropAction toQt(blink::WebDragOperation op) +{ + if (op & blink::WebDragOperationCopy) + return Qt::CopyAction; + if (op & blink::WebDragOperationLink) + return Qt::LinkAction; + if (op & blink::WebDragOperationMove || op & blink::WebDragOperationDelete) + return Qt::MoveAction; + return Qt::IgnoreAction; +} + Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const QPoint &screenPos) { Q_D(WebContentsAdapter); @@ -1273,13 +1284,13 @@ Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const Q loop.Run(); d->updateDragCursorMessagePollingTimer->stop(); - return d->currentDropAction; + return toQt(d->currentDropAction); } -void WebContentsAdapter::updateDragAction(Qt::DropAction action) +void WebContentsAdapter::updateDragAction(int action) { Q_D(WebContentsAdapter); - d->currentDropAction = action; + d->currentDropAction = static_cast<blink::WebDragOperation>(action); finishDragUpdate(); } |