| 1795 | } |
| 1796 | |
| 1797 | void UBBoardView::dropEvent (QDropEvent *event) |
| 1798 | { |
| 1799 | #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) |
| 1800 | QPointF eventPosition = event->position(); |
| 1801 | #else |
| 1802 | QPointF eventPosition = event->pos(); |
| 1803 | #endif |
| 1804 | QGraphicsItem *onItem = itemAt(eventPosition.x(),eventPosition.y()); |
| 1805 | if (onItem && onItem->type() == UBGraphicsWidgetItem::Type && onItem->acceptDrops()) |
| 1806 | { |
| 1807 | //items like images, sounds, etc.. can be passed to the board or to an application or interactivity. Both actions are acceptable. |
| 1808 | // We should ask the user what he wanted to achieve when object is dropped over a widget. |
| 1809 | if (UBApplication::mainWindow->yesNoQuestion(tr("Is it for Board or Widget ?"), |
| 1810 | tr("Are you trying to drop the object(s) inside the widget ?"))) |
| 1811 | { |
| 1812 | QGraphicsView::dropEvent(event); |
| 1813 | } |
| 1814 | else |
| 1815 | { |
| 1816 | if (!event->source() |
| 1817 | || qobject_cast<UBDocumentThumbnailsView *>(event->source()) |
| 1818 | || qobject_cast<QWebEngineView*>(event->source()) |
| 1819 | || qobject_cast<QListView *>(event->source())) |
| 1820 | { |
| 1821 | mController->processMimeData (event->mimeData(), mapToScene (eventPosition.toPoint())); |
| 1822 | event->acceptProposedAction(); |
| 1823 | } |
| 1824 | } |
| 1825 | } |
| 1826 | else |
| 1827 | { |
| 1828 | if (!event->source() |
| 1829 | || qobject_cast<UBDocumentThumbnailsView *>(event->source()) |
| 1830 | || qobject_cast<QWebEngineView*>(event->source()) |
| 1831 | || qobject_cast<QListView *>(event->source())) |
| 1832 | { |
| 1833 | mController->processMimeData (event->mimeData(), mapToScene (eventPosition.toPoint())); |
| 1834 | event->acceptProposedAction(); |
| 1835 | } |
| 1836 | } |
| 1837 | |
| 1838 | //prevent features in UBFeaturesWidget deletion from the model when event is processing inside |
| 1839 | //Qt base classes |
| 1840 | if (event->dropAction() == Qt::MoveAction) { |
| 1841 | event->setDropAction(Qt::CopyAction); |
| 1842 | } |
| 1843 | |
| 1844 | mMouseButtonIsPressed = false; |
| 1845 | mPendingStylusReleaseEvent = false; |
| 1846 | mTabletStylusIsPressed = false; |
| 1847 | setMovingItem(nullptr); |
| 1848 | } |
| 1849 | |
| 1850 | void UBBoardView::resizeEvent (QResizeEvent * event) |
| 1851 | { |
nothing calls this directly
no test coverage detected