// ! [7]
  protected void mouseMoveEvent(QMouseEvent event) {
    if (!(event.buttons().isSet(Qt.MouseButton.LeftButton))) return;
    if ((event.pos().subtract(dragStartPosition)).manhattanLength()
        < QApplication.startDragDistance()) return;

    QDrag drag = new QDrag(this);
    QMimeData mimeData = new QMimeData();

    mimeData.setData(mimeType, data);
    drag.setMimeData(mimeData);

    Qt.DropAction dropAction = drag.exec(Qt.DropAction.CopyAction, Qt.DropAction.MoveAction);
    // ! [7]

    switch (dropAction) {
      case CopyAction:
        dragResult.emit(tr("The text was copied."));
        break;
      case MoveAction:
        dragResult.emit(tr("The text was moved."));
        break;
      default:
        dragResult.emit(tr("Unknown action."));
        break;
    }
    // ! [8]
  }
 @Override
 protected void mouseMoveEvent(QMouseEvent event) {
   if ((event.buttons().isSet(Qt.MouseButton.LeftButton)) && scribbling) drawLineTo(event.pos());
 }