| 1577 | } |
| 1578 | |
| 1579 | void UBDocumentTreeView::dragMoveEvent(QDragMoveEvent *event) |
| 1580 | { |
| 1581 | QModelIndex index; |
| 1582 | if (selectedIndexes().count() > 0) |
| 1583 | { |
| 1584 | index = selectedIndexes().first(); |
| 1585 | } |
| 1586 | |
| 1587 | #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) |
| 1588 | QPoint eventPos = event->position().toPoint(); |
| 1589 | #else |
| 1590 | QPoint eventPos = event->pos(); |
| 1591 | #endif |
| 1592 | bool acceptIt = isAcceptable(index, indexAt(eventPos)); |
| 1593 | |
| 1594 | if (event->mimeData()->hasFormat(UBApplication::mimeTypeUniboardPage)) { |
| 1595 | UBSortFilterProxyModel *proxy = dynamic_cast<UBSortFilterProxyModel*>(model()); |
| 1596 | |
| 1597 | UBDocumentTreeModel *docModel = 0; |
| 1598 | |
| 1599 | if(proxy){ |
| 1600 | docModel = dynamic_cast<UBDocumentTreeModel*>(proxy->sourceModel()); |
| 1601 | }else{ |
| 1602 | docModel = dynamic_cast<UBDocumentTreeModel*>(model()); |
| 1603 | } |
| 1604 | |
| 1605 | QModelIndex targetIndex = mapIndexToSource(indexAt(eventPos)); |
| 1606 | |
| 1607 | if (!docModel || !docModel->isDocument(targetIndex) || docModel->inTrash(targetIndex)) { |
| 1608 | event->ignore(); |
| 1609 | event->setDropAction(Qt::IgnoreAction); |
| 1610 | |
| 1611 | if (docModel) |
| 1612 | { |
| 1613 | docModel->setHighLighted(QModelIndex()); |
| 1614 | } |
| 1615 | |
| 1616 | acceptIt = false; |
| 1617 | } else { |
| 1618 | docModel->setHighLighted(targetIndex); |
| 1619 | acceptIt = true; |
| 1620 | } |
| 1621 | updateIndexEnvirons(indexAt(eventPos)); |
| 1622 | } |
| 1623 | QTreeView::dragMoveEvent(event); |
| 1624 | |
| 1625 | event->setAccepted(acceptIt); |
| 1626 | } |
| 1627 | |
| 1628 | void UBDocumentTreeView::dropEvent(QDropEvent *event) |
| 1629 | { |
nothing calls this directly
no test coverage detected