MCPcopy Create free account
hub / github.com/KDE/gwenview / startDragIfSensible

Method startDragIfSensible

lib/documentview/documentview.cpp:401–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399 }
400
401 void startDragIfSensible()
402 {
403 if (q->document()->loadingState() == Document::LoadingFailed) {
404 return;
405 }
406
407 if (q->currentTool()) {
408 return;
409 }
410
411 if (mDrag) {
412 mDrag->deleteLater();
413 }
414 mDrag = new QDrag(q);
415 const auto itemList = KFileItemList({KFileItem(q->document()->url())});
416 auto *mimeData = MimeTypeUtils::selectionMimeData(itemList, MimeTypeUtils::DropTarget);
417 KUrlMimeData::exportUrlsToPortal(mimeData);
418 mDrag->setMimeData(mimeData);
419
420 if (q->document()->isModified()) {
421 setDragPixmap(QPixmap::fromImage(q->document()->image()));
422 executeDrag();
423 } else {
424 // Drag is triggered on success or failure of thumbnail generation
425 if (mDragThumbnailProvider.isNull()) {
426 initDragThumbnailProvider();
427 }
428 mDragThumbnailProvider->appendItems(itemList);
429 }
430 }
431
432 QPointF cursorPosition()
433 {

Callers 2

startDragFromTouchMethod · 0.80
sceneEventFilterMethod · 0.80

Calls 9

selectionMimeDataFunction · 0.85
appendItemsMethod · 0.80
KFileItemListClass · 0.50
KFileItemClass · 0.50
loadingStateMethod · 0.45
documentMethod · 0.45
currentToolMethod · 0.45
urlMethod · 0.45
isModifiedMethod · 0.45

Tested by

no test coverage detected